Skip to content

Commit

Permalink
Bug fix to stop it from adding .min forever in CI mode. *facepalm*
Browse files Browse the repository at this point in the history
  • Loading branch information
arobson committed Oct 30, 2012
1 parent 029cacc commit c4f60ff
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
8 changes: 6 additions & 2 deletions lib/uglify.js
@@ -1,6 +1,6 @@
/*
anvil.uglify - Uglify plugin for anvil.js
version: 0.0.8
version: 0.0.9
author: Alex Robson <alex@sharplearningcurve.com> (http://sharplearningcurve.com)
copyright: 2011 - 2012
license: Dual licensed
Expand Down Expand Up @@ -144,7 +144,11 @@ var uglifyFactory = function( _, anvil ) {
},

rename: function( name ) {
return name.replace( ".js", ".min.js" );
if( name.match( /[.]min[.]js$/ ) ) {
return name;
} else {
return name.replace( ".js", ".min.js" );
}
}
} );
};
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -2,7 +2,7 @@
"author": "Alex Robson <alex@sharplearningcurve.com> (http://sharplearningcurve.com)",
"name": "anvil.uglify",
"description": "Uglify plugin for anvil.js",
"version": "0.0.8",
"version": "0.0.9",
"repository": {
"type": "git",
"url": "git://github.com/arobson/anvil.uglify.git"
Expand All @@ -26,4 +26,4 @@
],
"optionalDependencies": {},
"keywords": [ "anvil", "uglify" ]
}
}
9 changes: 1 addition & 8 deletions spec/plugin.spec.js
Expand Up @@ -3,18 +3,13 @@ var _ = require( "underscore" );
var api = require( "anvil.js" );
var Harness = api.PluginHarness;

var harness = new Harness( "anvil.uglify", "/git/js/anvil/anvil.uglify" ),
var harness = new Harness( "anvil.uglify", "./" ),
tests = [];

// harness.addFile( "./build.json",
// '{ "anvil.uglify": { "all": true } }' );

harness.addCommandArgs( "--uglify" );

harness.addFile( "./src/test.js",
"var x = 10;\n" +
"var y = 5;" );

harness.expectFile( "./lib/test.min.js",
"var x=10,y=5" );

Expand All @@ -27,7 +22,6 @@ describe( "when uglifying", function() {
},
function( results ) {
tests = results;
console.log( api.files.files );
done();
}
);
Expand All @@ -38,5 +32,4 @@ describe( "when uglifying", function() {
test.call();
} );
} );

} );
6 changes: 5 additions & 1 deletion src/uglify.js
Expand Up @@ -135,7 +135,11 @@ var uglifyFactory = function( _, anvil ) {
},

rename: function( name ) {
return name.replace( ".js", ".min.js" );
if( name.match( /[.]min[.]js$/ ) ) {
return name;
} else {
return name.replace( ".js", ".min.js" );
}
}
} );
};
Expand Down

0 comments on commit c4f60ff

Please sign in to comment.