Permalink
Browse files

console controller;add statistics result

  • Loading branch information...
switer committed Jan 21, 2013
1 parent a2af470 commit 2f31aa29cb46226539164ebb9a03d8cc41a829ec
Showing with 103 additions and 26 deletions.
  1. +12 −3 bin/doverjs
  2. +27 −2 examples/package.js
  3. +0 −1 lib/css_parser.js
  4. +1 −0 lib/underscore-min.js
  5. +1 −1 package.json
  6. +62 −19 phantomrun.js
View
@@ -8,24 +8,33 @@ var program = require('commander'),
program
.version('0.1.0')
.usage('[options] <file ...>')
+ .option('-c, --console', 'print process result in console')
.option('-d, --destination <files>', 'destination file <file, file, ...>')
.option('-j, --json <file>', 'using json config file')
.option('-o, --output <file>', 'Output result')
+ .option('-S, --statistics', 'print statistics in console')
.option('-s, --style <files>', 'covering style-sheet file <file, file, ...>')
.parse(process.argv);
-
+function encodeOpts(optionstr) {
+ return encodeURIComponent(optionstr).replace(/\-/g, ',');
+}
process.chdir(__dirname + '/../');
var outputFile = encodeURIComponent(program.output) || '';
+var optionstr = 'doverjs params ' + (program.console ? '-c ' : '') + (program.statistics ? '-S ' : '');
if (program.json) {
- cmd = "node phantomrun.js json '" + currentPath + "' " + encodeURIComponent(program.json) + ' ' + outputFile
+ optionstr += '-j';
+ optionstr = encodeOpts(optionstr);
+ cmd = "node phantomrun.js " + optionstr + " '" + currentPath + "' " + encodeURIComponent(program.json) + ' ' + outputFile
console.log(NOTICE_MSG);
chiProc.exec(cmd, function (e, std, ste) {
e && console.log( e );
console.log( std );
console.log( ste );
});
} else if (program.style && program.destination) {
- cmd = "node phantomrun.js source '" + currentPath + "' " + encodeURIComponent(program.style) + ' ' + encodeURIComponent(program.destination) + ' ' + outputFile;
+ optionstr += '-s';
+ optionstr = encodeOpts(optionstr);
+ cmd = "node phantomrun.js " + optionstr + " '" + currentPath + "' " + encodeURIComponent(program.style) + ' ' + encodeURIComponent(program.destination) + ' ' + outputFile;
console.log(NOTICE_MSG);
chiProc.exec(cmd, function (e, std, ste) {
e && console.log( e );
View
@@ -1,8 +1,33 @@
{
"style" : [
- "https://a248.e.akamai.net/assets.github.com/assets/github-b6e4a9de2a215d2d19f092cdbe4739e525ed6061.css"
+ "http://localhost:3000/h5_2.2.1/develop/app/vertical/common/css/style_sdk.css"
],
"html" : [
- "http://www.12306.cn/mormhweb/"
+ {
+ "prefix" :"http://localhost:3000/h5_2.2.1/develop/app/vertical/user/user.html",
+ "suffix" :[
+ "!sso/login",
+ "!sso/login/123123123",
+ "!sso/gameLogin",
+ "!sso/loginSuccess",
+ "!sso/firstGameLogin",
+ "!user",
+ "!user/userInfo",
+ "!user/updatePassword",
+ "!user/agreement",
+ "!user/multiAccount" ,
+ "!register/regSuccess",
+ "!vip/showVipArea",
+ "!secrecy/preBind",
+ "!secrecy/bind",
+ "!secrecy/securityQuestions/user",
+ "!findPassword/passwordRetake",
+ "!findPassword/securityAnswer",
+ "!findPassword/resetPassword/123123123",
+ "!user/regActivate",
+ "!user/activate"
+ ]
+ }
+
]
}
View
@@ -30,7 +30,6 @@ function _removeEmptyAndEncode(cssCtn) {
return selectors;
}
function exec_parse (cssCtn, encoding) {
- console.log('parse');
var selectors = []
/*remove empty comment*/
cssCtn = cssCtn.replace(/\/\*\*\//g,'')
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,6 +1,6 @@
{
"name": "doverjs",
- "version": "0.1.2",
+ "version": "0.1.3",
"private": false,
"scripts": {
"start": "node ./bin/doverjs"
Oops, something went wrong.

0 comments on commit 2f31aa2

Please sign in to comment.