Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
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
Commits
c53b3170
Commit
c53b3170
authored
Nov 22, 2012
by
Liang Ding
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #128 from b3log/0.5.5
tools 不影响用户功能
parents
537f58bf
9f7ebb62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
111 deletions
+76
-111
war/src/main/webapp/js/tools/compress.js
war/src/main/webapp/js/tools/compress.js
+48
-17
war/src/main/webapp/js/tools/get-static.js
war/src/main/webapp/js/tools/get-static.js
+0
-86
war/src/main/webapp/js/tools/update-version.js
war/src/main/webapp/js/tools/update-version.js
+28
-8
No files found.
war/src/main/webapp/js/tools/compress.js
View file @
c53b3170
var
fs
=
require
(
"
fs
"
),
var
fs
=
require
(
"
fs
"
),
path
=
require
(
'
path
'
),
exec
=
require
(
"
child_process
"
).
exec
;
exec
=
require
(
"
child_process
"
).
exec
;
// skin js compress
var
getCompressFiles
=
function
(
root
)
{
var
jsPaths
=
[
"
ease
"
];
var
res
=
[],
for
(
var
i
=
0
;
i
<
jsPaths
.
length
;
i
++
)
{
files
=
fs
.
readdirSync
(
root
);
exec
(
"
uglifyjs ../../skins/
"
+
jsPaths
[
i
]
+
"
/js/
"
+
jsPaths
[
i
]
+
"
.js > ../../skins/
"
+
jsPaths
[
i
]
+
"
/js/
"
+
jsPaths
[
i
]
+
"
.min.js
"
,
function
(
error
,
stdout
,
stderr
)
{
if
(
error
!==
null
)
{
files
.
forEach
(
function
(
file
)
{
console
.
log
(
error
);
var
pathname
=
root
+
'
/
'
+
file
,
}
stat
=
fs
.
lstatSync
(
pathname
);
if
(
!
stat
.
isDirectory
())
{
if
(
pathname
.
indexOf
(
"
mobile
"
)
<
0
&&
path
.
basename
(
pathname
).
indexOf
(
"
.min
"
)
<
0
)
{
if
(
path
.
dirname
(
pathname
).
indexOf
(
"
css
"
)
>
-
1
)
{
res
.
push
(
"
css-
"
+
pathname
);
}
if
(
path
.
dirname
(
pathname
).
indexOf
(
"
js
"
)
>
-
1
)
{
res
.
push
(
"
js-
"
+
pathname
);
}
}
}
else
{
res
=
res
.
concat
(
getCompressFiles
(
pathname
));
}
});
});
}
return
res
;
};
// skin css compress
(
function
()
{
var
csses
=
[
"
ease
"
,
"
ease-ie8
"
];
var
compressFiles
=
getCompressFiles
(
"
../../skins
"
);
for
(
var
i
=
0
;
i
<
csses
.
length
;
i
++
)
{
exec
(
"
lessc -compress ../../skins/ease/css/
"
+
csses
[
i
]
+
"
.css > ../../skins/ease/css/
"
+
csses
[
i
]
+
"
.min.css
"
,
function
(
error
,
stdout
,
stderr
)
{
for
(
var
i
=
0
;
i
<
compressFiles
.
length
;
i
++
)
{
if
(
error
!==
null
)
{
// skin js compress
console
.
log
(
error
);
if
(
compressFiles
[
i
].
indexOf
(
"
js-
"
)
>
-
1
)
{
}
var
pathname
=
compressFiles
[
i
].
split
(
"
js-
"
)[
1
];
});
exec
(
"
uglifyjs
"
+
pathname
+
"
>
"
+
path
.
dirname
(
pathname
)
+
"
/
"
+
path
.
basename
(
pathname
,
"
.js
"
)
+
"
.min.js
"
,
function
(
error
,
stdout
,
stderr
)
{
}
if
(
error
!==
null
)
{
\ No newline at end of file
console
.
log
(
error
);
}
});
}
// skin css compress
if
(
compressFiles
[
i
].
indexOf
(
"
css-
"
)
>
-
1
)
{
var
pathname
=
compressFiles
[
i
].
split
(
"
css-
"
)[
1
];
exec
(
"
lessc -compress
"
+
pathname
+
"
>
"
+
path
.
dirname
(
pathname
)
+
"
/
"
+
path
.
basename
(
pathname
,
"
.css
"
)
+
"
.min.css
"
,
function
(
error
,
stdout
,
stderr
)
{
if
(
error
!==
null
)
{
console
.
log
(
error
);
}
});
}
}
})();
war/src/main/webapp/js/tools/get-static.js
deleted
100644 → 0
View file @
537f58bf
var
fs
=
require
(
'
fs
'
),
path
=
require
(
'
path
'
);
var
getAllFiles
=
function
(
root
){
var
res
=
[],
files
=
fs
.
readdirSync
(
root
);
files
.
forEach
(
function
(
file
){
var
pathname
=
root
+
'
/
'
+
file
,
stat
=
fs
.
lstatSync
(
pathname
);
if
(
!
stat
.
isDirectory
()){
if
(
file
.
indexOf
(
"
.ftl
"
)
<
0
&&
file
.
indexOf
(
"
.properties
"
)
<
0
&&
root
.
indexOf
(
"
js/tools
"
)
<
0
)
{
res
.
push
(
pathname
);
}
}
else
{
res
=
res
.
concat
(
getAllFiles
(
pathname
));
}
});
return
res
;
};
var
mkdirsSync
=
function
(
dirpath
)
{
if
(
fs
.
existsSync
(
dirpath
)){
return
;
}
var
dirs
=
dirpath
.
split
(
'
/
'
);
var
dir
=
''
;
for
(
var
i
=
0
;
i
<
dirs
.
length
;
i
++
)
{
dir
+=
dirs
[
i
]
+
'
/
'
;
if
(
!
fs
.
existsSync
(
dir
)){
fs
.
mkdirSync
(
dir
);
}
}
};
var
css
=
getAllFiles
(
"
../../css
"
),
image
=
getAllFiles
(
"
../../images
"
),
js
=
getAllFiles
(
"
../../js
"
),
plugin
=
getAllFiles
(
"
../../plugins
"
),
skins
=
getAllFiles
(
"
../../skins
"
);
(
function
()
{
mkdirsSync
(
"
static/css
"
);
for
(
var
i
=
0
;
i
<
css
.
length
;
i
++
)
{
if
(
css
[
i
].
indexOf
(
"
.min.css
"
)
>
-
1
)
{
fs
.
writeFileSync
(
css
[
i
].
replace
(
"
../..
"
,
"
static
"
),
fs
.
readFileSync
(
css
[
i
]),
"
UTF-8
"
);
}
}
for
(
var
i
=
0
;
i
<
image
.
length
;
i
++
)
{
mkdirsSync
(
path
.
dirname
(
image
[
i
].
replace
(
"
../..
"
,
"
static
"
)));
fs
.
writeFileSync
(
image
[
i
].
replace
(
"
../..
"
,
"
static
"
),
fs
.
readFileSync
(
image
[
i
]),
"
UTF-8
"
);
}
for
(
var
i
=
0
;
i
<
js
.
length
;
i
++
)
{
var
pathdir
=
path
.
dirname
(
js
[
i
].
replace
(
"
../..
"
,
"
static
"
));
if
(
pathdir
.
indexOf
(
"
/js/tools
"
)
<
0
)
{
mkdirsSync
(
pathdir
);
}
if
((
pathdir
.
indexOf
(
"
/js/admin
"
)
>
-
1
&&
path
.
basename
(
js
[
i
])
===
"
latkeAdmin.min.js
"
)
||
pathdir
.
indexOf
(
"
/js/lib
"
)
>
-
1
||
(
pathdir
.
split
(
"
/
"
).
length
==
2
&&
js
[
i
].
indexOf
(
"
.min.js
"
)
>
-
1
))
{
fs
.
writeFileSync
(
js
[
i
].
replace
(
"
../..
"
,
"
static
"
),
fs
.
readFileSync
(
js
[
i
]),
"
UTF-8
"
);
}
}
for
(
var
i
=
0
;
i
<
plugin
.
length
;
i
++
)
{
mkdirsSync
(
path
.
dirname
(
plugin
[
i
].
replace
(
"
../..
"
,
"
static
"
)));
fs
.
writeFileSync
(
plugin
[
i
].
replace
(
"
../..
"
,
"
static
"
),
fs
.
readFileSync
(
plugin
[
i
]),
"
UTF-8
"
);
}
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
if
(
path
.
basename
(
skins
[
i
])
===
"
ease-ie8.css
"
||
path
.
basename
(
skins
[
i
])
===
"
ease.css
"
||
path
.
basename
(
skins
[
i
])
===
"
ease.js
"
)
{
}
else
{
mkdirsSync
(
path
.
dirname
(
skins
[
i
].
replace
(
"
../..
"
,
"
static
"
)));
fs
.
writeFileSync
(
skins
[
i
].
replace
(
"
../..
"
,
"
static
"
),
fs
.
readFileSync
(
skins
[
i
]),
"
UTF-8
"
);
}
}
fs
.
writeFileSync
(
"
static/favicon.ico
"
,
fs
.
readFileSync
(
"
../../favicon.ico
"
),
"
UTF-8
"
);
fs
.
writeFileSync
(
"
static/favicon.png
"
,
fs
.
readFileSync
(
"
../../favicon.png
"
),
"
UTF-8
"
);
})();
\ No newline at end of file
war/src/main/webapp/js/tools/update-version.js
View file @
c53b3170
var
version
=
""
,
var
version
=
""
,
newVersion
=
""
;
newVersion
=
""
;
process
.
argv
.
forEach
(
function
(
val
,
index
,
array
)
{
process
.
argv
.
forEach
(
function
(
val
,
index
)
{
if
(
index
===
2
)
{
if
(
index
===
2
)
{
version
=
val
;
version
=
val
;
}
}
...
@@ -11,12 +11,32 @@ process.argv.forEach(function (val, index, array) {
...
@@ -11,12 +11,32 @@ process.argv.forEach(function (val, index, array) {
}
}
});
});
var
fs
=
require
(
"
fs
"
);
var
fs
=
require
(
"
fs
"
),
var
skins
=
[
"
ease
"
,
"
mobile
"
];
path
=
require
(
'
path
'
);
var
getPropertiesFiles
=
function
(
root
)
{
var
res
=
[],
files
=
fs
.
readdirSync
(
root
);
files
.
forEach
(
function
(
file
)
{
var
pathname
=
root
+
'
/
'
+
file
,
stat
=
fs
.
lstatSync
(
pathname
);
if
(
!
stat
.
isDirectory
())
{
if
(
path
.
basename
(
pathname
)
===
"
skin.properties
"
)
{
res
.
push
(
pathname
);
}
}
else
{
res
=
res
.
concat
(
getPropertiesFiles
(
pathname
));
}
});
return
res
;
};
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
(
function
(
)
{
var
fileName
=
"
../../skins/
"
+
skins
[
i
]
+
"
/skin.properties
"
;
var
skins
=
getPropertiesFiles
(
"
../../skins
"
)
;
var
file
=
fs
.
readFileSync
(
fileName
,
"
UTF-8
"
);
for
(
var
i
=
0
;
i
<
skins
.
length
;
i
++
)
{
fs
.
writeFileSync
(
fileName
,
file
.
replace
(
"
forSolo=
"
+
version
,
"
forSolo=
"
+
newVersion
),
"
UTF-8
"
);
var
file
=
fs
.
readFileSync
(
skins
[
i
],
"
UTF-8
"
);
}
fs
.
writeFileSync
(
skins
[
i
],
file
.
replace
(
"
forSolo=
"
+
version
,
"
forSolo=
"
+
newVersion
),
"
UTF-8
"
);
\ No newline at end of file
}
})();
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