Skip to content
This repository was archived by the owner on Jul 17, 2020. It is now read-only.

Commit 7385ed9

Browse files
committed
Merge branch 'master' into export-import
2 parents 269ee7c + 072d263 commit 7385ed9

33 files changed

+2898
-1885
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
For usage info, on how to use the bot, see [here](https://github.com/Zirak/SO-ChatBot/wiki/Interacting-with-the-bot).
22

33
###Running the bot###
4+
45
The bot is currently a big dangle-on script running in your browser. **Run `bookmarklet.js`** in your browser to get it up an' running. For some tips on handling the bot, see [Bot Handling](https://github.com/Zirak/SO-ChatBot/wiki/Bot-Handling).
56

7+
If you wish, you can also run it headlessly on top of phantomjs and node:
8+
9+
* Install [phantomjs 2](http://phantomjs.org/) (yes, it has to be 2 and above). Differs from platform to platform.
10+
* Install nightmare: `npm install nightmare`
11+
* Edit your credentials into `run-headless.js`
12+
* Hit the road: `env DEBUG=nightmare node run-headless.js`
13+
614
###Building###
715

816
```sh

bookmarklet-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(function(){var a=document.createElement("script");a.src="https://raw.github.com/Zirak/SO-ChatBot/master/master.js";a.onload=function(){bot.activateDevMode();};document.head.appendChild(a)})();
1+
(function(){var a=document.createElement("script");a.src="https://rawgithub.com/Zirak/SO-ChatBot/master/master.js";a.onload=function(){bot.activateDevMode();};document.head.appendChild(a)})();

bookmarklet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
(function(){var a=document.createElement("script");a.src="https://raw.github.com/Zirak/SO-ChatBot/master/master.js",document.head.appendChild(a)})()
1+
(function(){var a=document.createElement("script");a.src="https://rawgithub.com/Zirak/SO-ChatBot/master/master.js",document.head.appendChild(a)})()

build.js

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ var build = {
116116
throw err;
117117
}
118118

119+
if ( that.doMinify ) {
120+
minify( that.outputName, that.outputMin, that.minEndCallback );
121+
}
122+
119123
that.endCallback();
120124
});
121125
},
@@ -126,10 +130,6 @@ var build = {
126130
var code = this.buildFinalCodeString();
127131

128132
this.write( code );
129-
130-
if ( this.doMinify ) {
131-
minify( this.outputName, this.outputMin, this.minEndCallback );
132-
}
133133
code = null;
134134
}
135135
},
@@ -159,48 +159,25 @@ var exec = require('child_process').exec;
159159

160160
var minifiers = [
161161
{
162-
name : 'closure-compiler',
163-
test : function ( success, fail ) {
164-
exec( 'java -version &> /dev/null; echo $?', finish );
165-
166-
function finish ( err, stdout, stderr ) {
167-
if (err || Number(stdout)) {
168-
fail();
169-
}
170-
else {
171-
success();
172-
}
173-
}
174-
},
175-
minify : function ( sourceFile, outFile, cb ) {
176-
var cmd = [
177-
'java -jar closure-compiler.jar',
178-
'--language_in ECMASCRIPT5_STRICT',
179-
'--compilation_level SIMPLE_OPTIMIZATIONS',
180-
'--js', sourceFile,
181-
'--js_output_file', outFile,
182-
].join( ' ' );
183-
184-
exec( cmd, cb );
185-
}
186-
},
187-
{
188-
name : 'uglify2',
162+
name : 'uglify',
189163
test : function ( success, fail ) {
190164
try {
191-
require.resolve( 'uglify-js2' );
165+
require.resolve( 'uglify-js' );
192166
success();
193167
}
194168
catch ( e ) {
195169
fail();
196170
}
197171
},
198172
minify : function ( sourceFile, outFile, cb ) {
173+
console.log( sourceFile );
199174
var code;
200175
try {
201-
code = require( 'uglify-js2' ).minify( sourceFile ).code;
176+
code = require( 'uglify-js' ).minify( sourceFile ).code;
177+
console.log('floop');
202178
}
203179
catch ( e ) {
180+
console.error(e);
204181
cb( e );
205182
//I find it extremely pleasing how the above lines line up.
206183
return;
@@ -214,7 +191,7 @@ var minifiers = [
214191
test : function ( success ) {
215192
success();
216193
},
217-
minify : function ( cb ) {
194+
minify : function ( sourceFile, outFile, cb ) {
218195
console.warn( 'no minifier found; skipping' );
219196
cb();
220197
}

0 commit comments

Comments
 (0)