Skip to content

Commit

Permalink
references #254, adding bower.json, removing old artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
dbashford committed Aug 14, 2013
1 parent 0a4ea42 commit 3375b1c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 44 deletions.
14 changes: 12 additions & 2 deletions lib/command/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ NewCommand = (function() {
this.program = program;
this._done = __bind(this._done, this);
this.removeFromPackageDeps = __bind(this.removeFromPackageDeps, this);
this._modifyBowerJSONName = __bind(this._modifyBowerJSONName, this);
this._create = __bind(this._create, this);
this._createWithDefaults = __bind(this._createWithDefaults, this);
this._prompting = __bind(this._prompting, this);
Expand Down Expand Up @@ -169,11 +170,22 @@ NewCommand = (function() {
} else {
this._usingOwnServer(name, chosen);
}
this._modifyBowerJSONName(name);
this._moveViews(chosen);
logger.debug("Renaming .gitignore");
return fs.renameSync(path.join(this.skeletonOutPath, ".ignore"), path.join(this.skeletonOutPath, ".gitignore"));
};

NewCommand.prototype._modifyBowerJSONName = function(name) {
var bowerJson, bowerPath;
if (name) {
bowerPath = path.join(this.skeletonOutPath, "bower.json");
bowerJson = require(bowerPath);
bowerJson.name = name;
return fs.writeFileSync(bowerPath, JSON.stringify(bowerJson, null, 2));
}
};

NewCommand.prototype._moveDirectoryContents = function(sourcePath, outPath) {
var fileContents, fileStats, fullOutPath, fullSourcePath, item, _i, _len, _ref, _results;
if (!fs.existsSync(outPath)) {
Expand Down Expand Up @@ -240,8 +252,6 @@ NewCommand = (function() {
safePaths = _.flatten([comps.javascript.defaultExtensions, comps.css.defaultExtensions, comps.template.defaultExtensions]).map(function(path) {
return "\\." + path + "$";
});
safePaths.push("jquery\.js");
safePaths.push("require\.js");
assetsPath = path.join(this.skeletonOutPath, 'assets');
allItems = wrench.readdirSyncRecursive(assetsPath);
files = allItems.filter(function(i) {
Expand Down
4 changes: 0 additions & 4 deletions skeletons/project/assets/javascripts/vendor/jquery.js

This file was deleted.

36 changes: 0 additions & 36 deletions skeletons/project/assets/javascripts/vendor/require.js

This file was deleted.

8 changes: 8 additions & 0 deletions skeletons/project/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "appname",
"version": "0.1.0",
"dependencies": {
"jquery":"2.0.3",
"requirejs":"2.1.8"
}
}
11 changes: 9 additions & 2 deletions src/command/new.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,20 @@ class NewCommand
else
@_usingOwnServer name, chosen

@_modifyBowerJSONName name

@_moveViews chosen

logger.debug "Renaming .gitignore"
fs.renameSync (path.join @skeletonOutPath, ".ignore"), (path.join @skeletonOutPath, ".gitignore")

_modifyBowerJSONName: (name) =>
if name
bowerPath = path.join @skeletonOutPath, "bower.json"
bowerJson = require(bowerPath)
bowerJson.name = name
fs.writeFileSync bowerPath, JSON.stringify(bowerJson, null, 2)

_moveDirectoryContents: (sourcePath, outPath) ->
unless fs.existsSync outPath
fs.mkdirSync outPath
Expand Down Expand Up @@ -199,8 +208,6 @@ class NewCommand
_copyCompilerSpecificExampleFiles: (comps) ->
safePaths = _.flatten([comps.javascript.defaultExtensions, comps.css.defaultExtensions, comps.template.defaultExtensions]).map (path) ->
"\\.#{path}$"
safePaths.push "jquery\.js"
safePaths.push "require\.js"

assetsPath = path.join @skeletonOutPath, 'assets'
allItems = wrench.readdirSyncRecursive(assetsPath)
Expand Down

0 comments on commit 3375b1c

Please sign in to comment.