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

Commit

Permalink
Merge branch 'master' into export-import
Browse files Browse the repository at this point in the history
  • Loading branch information
BobVul committed Nov 7, 2015
2 parents 269ee7c + 072d263 commit 7385ed9
Show file tree
Hide file tree
Showing 33 changed files with 2,898 additions and 1,885 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
For usage info, on how to use the bot, see [here](https://github.com/Zirak/SO-ChatBot/wiki/Interacting-with-the-bot).

###Running the bot###

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).

If you wish, you can also run it headlessly on top of phantomjs and node:

* Install [phantomjs 2](http://phantomjs.org/) (yes, it has to be 2 and above). Differs from platform to platform.
* Install nightmare: `npm install nightmare`
* Edit your credentials into `run-headless.js`
* Hit the road: `env DEBUG=nightmare node run-headless.js`

###Building###

```sh
Expand Down
2 changes: 1 addition & 1 deletion bookmarklet-dev.js
Original file line number Diff line number Diff line change
@@ -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)})();
(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)})();
2 changes: 1 addition & 1 deletion bookmarklet.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(function(){var a=document.createElement("script");a.src="https://raw.github.com/Zirak/SO-ChatBot/master/master.js",document.head.appendChild(a)})()
(function(){var a=document.createElement("script");a.src="https://rawgithub.com/Zirak/SO-ChatBot/master/master.js",document.head.appendChild(a)})()
45 changes: 11 additions & 34 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ var build = {
throw err;
}

if ( that.doMinify ) {
minify( that.outputName, that.outputMin, that.minEndCallback );
}

that.endCallback();
});
},
Expand All @@ -126,10 +130,6 @@ var build = {
var code = this.buildFinalCodeString();

this.write( code );

if ( this.doMinify ) {
minify( this.outputName, this.outputMin, this.minEndCallback );
}
code = null;
}
},
Expand Down Expand Up @@ -159,48 +159,25 @@ var exec = require('child_process').exec;

var minifiers = [
{
name : 'closure-compiler',
test : function ( success, fail ) {
exec( 'java -version &> /dev/null; echo $?', finish );

function finish ( err, stdout, stderr ) {
if (err || Number(stdout)) {
fail();
}
else {
success();
}
}
},
minify : function ( sourceFile, outFile, cb ) {
var cmd = [
'java -jar closure-compiler.jar',
'--language_in ECMASCRIPT5_STRICT',
'--compilation_level SIMPLE_OPTIMIZATIONS',
'--js', sourceFile,
'--js_output_file', outFile,
].join( ' ' );

exec( cmd, cb );
}
},
{
name : 'uglify2',
name : 'uglify',
test : function ( success, fail ) {
try {
require.resolve( 'uglify-js2' );
require.resolve( 'uglify-js' );
success();
}
catch ( e ) {
fail();
}
},
minify : function ( sourceFile, outFile, cb ) {
console.log( sourceFile );
var code;
try {
code = require( 'uglify-js2' ).minify( sourceFile ).code;
code = require( 'uglify-js' ).minify( sourceFile ).code;
console.log('floop');
}
catch ( e ) {
console.error(e);
cb( e );
//I find it extremely pleasing how the above lines line up.
return;
Expand All @@ -214,7 +191,7 @@ var minifiers = [
test : function ( success ) {
success();
},
minify : function ( cb ) {
minify : function ( sourceFile, outFile, cb ) {
console.warn( 'no minifier found; skipping' );
cb();
}
Expand Down
Loading

0 comments on commit 7385ed9

Please sign in to comment.