Permalink
Browse files

Merge pull request #613 from attomos/master

Added GeneratorUtilities.prototype.isBaseDirExists function.
  • Loading branch information...
2 parents 831d5ea + f31d44e commit 5c3b77c25e6a73b122f1124b9ecfef3b04a734bf @1602 committed Mar 4, 2014
Showing with 12 additions and 2 deletions.
  1. +3 −1 lib/server/generators/app_generator.js
  2. +9 −1 lib/server/generators/generator_utils.js
@@ -47,7 +47,9 @@ AppGenerator.prototype.perform = function (args) {
if (this.options.appName) {
this.baseDir = path.join(this.baseDir, this.options.appName);
}
-
+ if (this.isBaseDirExists()) {
+ return;
+ }
this.createDirectoryStructure();
this.copyFiles();
};
@@ -425,7 +425,7 @@ GeneratorUtilities.prototype.getDatabaseDependency = function() {
}
};
-GeneratorUtilities.prototype.isEvalAllowed = function () {
+GeneratorUtilities.prototype.isEvalAllowed = function() {
return !('noeval' in this.options);
};
@@ -436,4 +436,12 @@ GeneratorUtilities.prototype.generateSecret = function() {
.digest('hex');
};
+GeneratorUtilities.prototype.isBaseDirExists = function() {
+ var exists = fs.existsSync(this.baseDir);
+ if (exists) {
+ this.log($('"' + this.baseDir + '" exists', this.baseDir).bold.red);
+ }
+ return exists;
+};
+
module.exports = GeneratorUtilities;

0 comments on commit 5c3b77c

Please sign in to comment.