add build script
parent
81bb809dba
commit
4cd3e1d871
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
VERSION="0.4.1-SNAPTHOS"
|
||||||
|
mvn clean package
|
||||||
|
cp target/webmagic-scripts-${VERSION}.jar /usr/local/webmagic/webmagic-console.jar
|
||||||
|
rsync -avz --delete target/lib/ /usr/local/webmagic/lib/
|
|
@ -105,6 +105,7 @@ public class ScriptConsole {
|
||||||
options.addOption(new Option("l", true, "language"));
|
options.addOption(new Option("l", true, "language"));
|
||||||
options.addOption(new Option("t", true, "thread"));
|
options.addOption(new Option("t", true, "thread"));
|
||||||
options.addOption(new Option("f", true, "script file"));
|
options.addOption(new Option("f", true, "script file"));
|
||||||
|
options.addOption(new Option("s", true, "sleep time"));
|
||||||
CommandLineParser commandLineParser = new PosixParser();
|
CommandLineParser commandLineParser = new PosixParser();
|
||||||
CommandLine commandLine = commandLineParser.parse(options, args);
|
CommandLine commandLine = commandLineParser.parse(options, args);
|
||||||
return readOptions(commandLine);
|
return readOptions(commandLine);
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class ScriptProcessor implements PageProcessor {
|
||||||
context.setAttribute("page", page, ScriptContext.ENGINE_SCOPE);
|
context.setAttribute("page", page, ScriptContext.ENGINE_SCOPE);
|
||||||
context.setAttribute("config", site, ScriptContext.ENGINE_SCOPE);
|
context.setAttribute("config", site, ScriptContext.ENGINE_SCOPE);
|
||||||
try {
|
try {
|
||||||
engine.eval(defines + script, context);
|
engine.eval(defines + "\n" + script, context);
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue