Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changed the generator to create the directory in case it doesn't exis…

…t. GIT won't add empty folders (eg models) and the generator wasn't creating them
  • Loading branch information...
commit 9ec7c3a2eb75dab49db7ace63df2e83b6159db1b 1 parent 77cf340
Miguel Madero MiguelMadero authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 templates/Jakefile
6 templates/Jakefile
View
@@ -106,6 +106,7 @@ namespace('gen', function () {
, text = fs.readFileSync(path.join(__dirname, filename + '.ejs'), 'utf8').toString()
, bare = options.bare || false // Default to full controller
, templ
+ , fileDir
, filePath;
// Render with the right model name
@@ -113,7 +114,10 @@ namespace('gen', function () {
templ.process({names: names, bare: bare, properties: options.properties});
// Write file
- filePath = path.join('app', dirname, names.filename[options.inflection] + '.js');
+ fileDir = path.join('app', dirname);
+ if (!fs.existsSync(fileDir)) fs.mkdirSync(fileDir);
+
+ filePath = path.join(fileDir, names.filename[options.inflection] + '.js');
fs.writeFileSync(filePath, templ.markup, 'utf8');
console.log('[Added] ' + filePath);
Please sign in to comment.
Something went wrong with that request. Please try again.