Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
f0537aa9
Unverified
Commit
f0537aa9
authored
Jan 13, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#19 静态站点生成
parent
090a5001
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
src/main/java/org/b3log/solo/processor/console/StaticSiteConsole.java
...a/org/b3log/solo/processor/console/StaticSiteConsole.java
+16
-8
No files found.
src/main/java/org/b3log/solo/processor/console/StaticSiteConsole.java
View file @
f0537aa9
...
...
@@ -141,14 +141,22 @@ public class StaticSiteConsole {
private
static
final
String
STATIC_SITE
=
"static-site"
;
/**
*
Path of generate directory
.
*
Source directory path
.
*/
private
static
final
String
staticSitePath
=
StaticSiteConsole
.
class
.
getResource
(
"/"
+
STATIC_SITE
).
getPath
();
private
static
String
sourcePath
;
static
{
sourcePath
=
StaticSiteConsole
.
class
.
getResource
(
"/repository.json"
).
getPath
();
sourcePath
=
StringUtils
.
substringBeforeLast
(
sourcePath
,
"repository.json"
);
if
(
StringUtils
.
contains
(
sourcePath
,
"/target/classes/"
))
{
sourcePath
=
StringUtils
.
replace
(
sourcePath
,
"classes"
,
"solo"
);
}
}
/**
*
Source directory path
.
*
Path of generate directory
.
*/
private
static
final
String
s
ourcePath
=
StaticSiteConsole
.
class
.
getResource
(
"/"
).
getPath
()
;
private
static
final
String
s
taticSitePath
=
StaticSiteConsole
.
class
.
getResource
(
"/"
).
getPath
()
+
STATIC_SITE
;
private
static
void
genCategories
()
throws
Exception
{
final
BeanManager
beanManager
=
BeanManager
.
getInstance
();
...
...
@@ -270,28 +278,28 @@ public class StaticSiteConsole {
private
static
void
genSkins
()
throws
Exception
{
FileUtils
.
deleteDirectory
(
new
File
(
staticSitePath
+
"/skins"
));
FileUtils
.
forceMkdir
(
new
File
(
staticSitePath
+
"/skins"
));
FileUtils
.
copyDirectory
(
new
File
(
StaticSiteConsole
.
class
.
getResource
(
"/skins"
).
toURI
()
),
new
File
(
staticSitePath
+
"/skins"
));
FileUtils
.
copyDirectory
(
new
File
(
sourcePath
+
"skins"
),
new
File
(
staticSitePath
+
"/skins"
));
LOGGER
.
log
(
Level
.
INFO
,
"Generated skins"
);
}
private
static
void
genJS
()
throws
Exception
{
FileUtils
.
deleteDirectory
(
new
File
(
staticSitePath
+
"/js"
));
FileUtils
.
forceMkdir
(
new
File
(
staticSitePath
+
"/js"
));
FileUtils
.
copyDirectory
(
new
File
(
StaticSiteConsole
.
class
.
getResource
(
"/js"
).
toURI
()
),
new
File
(
staticSitePath
+
"/js"
));
FileUtils
.
copyDirectory
(
new
File
(
sourcePath
+
"js"
),
new
File
(
staticSitePath
+
"/js"
));
LOGGER
.
log
(
Level
.
INFO
,
"Generated js"
);
}
private
static
void
genImages
()
throws
Exception
{
FileUtils
.
deleteDirectory
(
new
File
(
staticSitePath
+
"/images"
));
FileUtils
.
forceMkdir
(
new
File
(
staticSitePath
+
"/images"
));
FileUtils
.
copyDirectory
(
new
File
(
StaticSiteConsole
.
class
.
getResource
(
"/images"
).
toURI
()
),
new
File
(
staticSitePath
+
"/images"
));
FileUtils
.
copyDirectory
(
new
File
(
sourcePath
+
"images"
),
new
File
(
staticSitePath
+
"/images"
));
LOGGER
.
log
(
Level
.
INFO
,
"Generated images"
);
}
private
static
void
genPlugins
()
throws
Exception
{
FileUtils
.
deleteDirectory
(
new
File
(
staticSitePath
+
"/plugins"
));
FileUtils
.
forceMkdir
(
new
File
(
staticSitePath
+
"/plugins"
));
FileUtils
.
copyDirectory
(
new
File
(
StaticSiteConsole
.
class
.
getResource
(
"/plugins"
).
toURI
()
),
new
File
(
staticSitePath
+
"/plugins"
));
FileUtils
.
copyDirectory
(
new
File
(
sourcePath
+
"plugins"
),
new
File
(
staticSitePath
+
"/plugins"
));
genURI
(
"/plugins/kanbanniang/assets/model.json"
);
LOGGER
.
log
(
Level
.
INFO
,
"Generated plugins"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment