diff --git a/app/index.js b/app/index.js index d4a946fa7..3178700b0 100644 --- a/app/index.js +++ b/app/index.js @@ -97,6 +97,7 @@ var Generator = module.exports = function Generator(args, options) { }); this.pkg = require('../package.json'); + this.sourceRoot(path.join(__dirname, '../templates/common')); }; util.inherits(Generator, yeoman.generators.Base); @@ -219,7 +220,7 @@ Generator.prototype.askForModules = function askForModules() { Generator.prototype.readIndex = function readIndex() { this.ngRoute = this.env.options.ngRoute; - this.indexFile = this.engine(this.read('../../templates/common/index.html'), this); + this.indexFile = this.engine(this.read('app/index.html'), this); }; Generator.prototype.bootstrapFiles = function bootstrapFiles() { @@ -227,13 +228,13 @@ Generator.prototype.bootstrapFiles = function bootstrapFiles() { var mainFile = 'main.' + (sass ? 's' : '') + 'css'; if (this.bootstrap && !sass) { - this.copy('fonts/glyphicons-halflings-regular.eot', 'app/fonts/glyphicons-halflings-regular.eot'); - this.copy('fonts/glyphicons-halflings-regular.ttf', 'app/fonts/glyphicons-halflings-regular.ttf'); - this.copy('fonts/glyphicons-halflings-regular.svg', 'app/fonts/glyphicons-halflings-regular.svg'); - this.copy('fonts/glyphicons-halflings-regular.woff', 'app/fonts/glyphicons-halflings-regular.woff'); + this.copy('app/fonts/glyphicons-halflings-regular.eot'); + this.copy('app/fonts/glyphicons-halflings-regular.ttf'); + this.copy('app/fonts/glyphicons-halflings-regular.svg'); + this.copy('app/fonts/glyphicons-halflings-regular.woff'); } - this.copy('styles/' + mainFile, 'app/styles/' + mainFile); + this.copy('app/styles/' + mainFile); }; Generator.prototype.appJs = function appJs() { @@ -253,14 +254,13 @@ Generator.prototype.createIndexHtml = function createIndexHtml() { Generator.prototype.packageFiles = function () { this.coffee = this.env.options.coffee; - this.template('../../templates/common/_bower.json', 'bower.json'); - this.template('../../templates/common/_package.json', 'package.json'); - this.template('../../templates/common/Gruntfile.js', 'Gruntfile.js'); + this.template('root/_bower.json', 'bower.json'); + this.template('root/_package.json', 'package.json'); + this.template('root/_Gruntfile.js', 'Gruntfile.js'); }; Generator.prototype.imageFiles = function () { - this.sourceRoot(path.join(__dirname, 'templates')); - this.directory('images', 'app/images', true); + this.directory('app/images'); }; Generator.prototype._injectDependencies = function _injectDependencies() { diff --git a/common/index.js b/common/index.js index ff76074d6..c2473ace3 100644 --- a/common/index.js +++ b/common/index.js @@ -11,9 +11,17 @@ var Generator = module.exports = function Generator() { util.inherits(Generator, yeoman.generators.Base); Generator.prototype.setupEnv = function setupEnv() { - // Copies the contents of the generator `templates` - // directory into your users new application path - this.sourceRoot(path.join(__dirname, '../templates/common')); - this.directory('root', '.', true); + this.sourceRoot(path.join(__dirname, '../templates/common/root')); + this.copy('.bowerrc', '.bowerrc'); + this.copy('.editorconfig', '.editorconfig'); + this.copy('.gitattributes', '.gitattributes'); + this.copy('.jshintrc', '.jshintrc'); this.copy('gitignore', '.gitignore'); + this.directory('../test', 'test', true); + this.copy('../app/.buildignore', 'app/.buildignore'); + this.copy('../app/.htaccess', 'app/.htaccess'); + this.copy('../app/404.html', 'app/404.html'); + this.copy('../app/favicon.ico', 'app/favicon.ico'); + this.copy('../app/robots.txt', 'app/robots.txt'); + this.copy('../app/views/main.html', 'app/views/main.html'); }; diff --git a/main/index.js b/main/index.js index 000bcd62c..9a3efc014 100644 --- a/main/index.js +++ b/main/index.js @@ -1,9 +1,8 @@ 'use strict'; -var util = require('util'); var path = require('path'); -var ScriptBase = require('../script-base.js'); +var util = require('util'); var yeoman = require('yeoman-generator'); - +var ScriptBase = require('../script-base.js'); var Generator = module.exports = function Generator() { ScriptBase.apply(this, arguments); diff --git a/templates/common/root/app/.buildignore b/templates/common/app/.buildignore similarity index 100% rename from templates/common/root/app/.buildignore rename to templates/common/app/.buildignore diff --git a/templates/common/root/app/.htaccess b/templates/common/app/.htaccess similarity index 100% rename from templates/common/root/app/.htaccess rename to templates/common/app/.htaccess diff --git a/templates/common/root/app/404.html b/templates/common/app/404.html similarity index 100% rename from templates/common/root/app/404.html rename to templates/common/app/404.html diff --git a/templates/common/root/app/favicon.ico b/templates/common/app/favicon.ico similarity index 100% rename from templates/common/root/app/favicon.ico rename to templates/common/app/favicon.ico diff --git a/app/templates/fonts/glyphicons-halflings-regular.eot b/templates/common/app/fonts/glyphicons-halflings-regular.eot similarity index 100% rename from app/templates/fonts/glyphicons-halflings-regular.eot rename to templates/common/app/fonts/glyphicons-halflings-regular.eot diff --git a/app/templates/fonts/glyphicons-halflings-regular.svg b/templates/common/app/fonts/glyphicons-halflings-regular.svg similarity index 100% rename from app/templates/fonts/glyphicons-halflings-regular.svg rename to templates/common/app/fonts/glyphicons-halflings-regular.svg diff --git a/app/templates/fonts/glyphicons-halflings-regular.ttf b/templates/common/app/fonts/glyphicons-halflings-regular.ttf similarity index 100% rename from app/templates/fonts/glyphicons-halflings-regular.ttf rename to templates/common/app/fonts/glyphicons-halflings-regular.ttf diff --git a/app/templates/fonts/glyphicons-halflings-regular.woff b/templates/common/app/fonts/glyphicons-halflings-regular.woff similarity index 100% rename from app/templates/fonts/glyphicons-halflings-regular.woff rename to templates/common/app/fonts/glyphicons-halflings-regular.woff diff --git a/app/templates/images/yeoman.png b/templates/common/app/images/yeoman.png similarity index 100% rename from app/templates/images/yeoman.png rename to templates/common/app/images/yeoman.png diff --git a/templates/common/index.html b/templates/common/app/index.html similarity index 100% rename from templates/common/index.html rename to templates/common/app/index.html diff --git a/templates/common/root/app/robots.txt b/templates/common/app/robots.txt similarity index 100% rename from templates/common/root/app/robots.txt rename to templates/common/app/robots.txt diff --git a/app/templates/styles/main.css b/templates/common/app/styles/main.css similarity index 100% rename from app/templates/styles/main.css rename to templates/common/app/styles/main.css diff --git a/app/templates/styles/main.scss b/templates/common/app/styles/main.scss similarity index 100% rename from app/templates/styles/main.scss rename to templates/common/app/styles/main.scss diff --git a/templates/common/root/app/views/main.html b/templates/common/app/views/main.html similarity index 100% rename from templates/common/root/app/views/main.html rename to templates/common/app/views/main.html diff --git a/templates/common/view.html b/templates/common/app/views/view.html similarity index 100% rename from templates/common/view.html rename to templates/common/app/views/view.html diff --git a/templates/common/Gruntfile.js b/templates/common/root/_Gruntfile.js similarity index 100% rename from templates/common/Gruntfile.js rename to templates/common/root/_Gruntfile.js diff --git a/templates/common/_bower.json b/templates/common/root/_bower.json similarity index 100% rename from templates/common/_bower.json rename to templates/common/root/_bower.json diff --git a/templates/common/_package.json b/templates/common/root/_package.json similarity index 100% rename from templates/common/_package.json rename to templates/common/root/_package.json diff --git a/templates/common/gitignore b/templates/common/root/gitignore similarity index 100% rename from templates/common/gitignore rename to templates/common/root/gitignore diff --git a/templates/common/root/test/.jshintrc b/templates/common/test/.jshintrc similarity index 100% rename from templates/common/root/test/.jshintrc rename to templates/common/test/.jshintrc diff --git a/templates/common/root/test/runner.html b/templates/common/test/runner.html similarity index 100% rename from templates/common/root/test/runner.html rename to templates/common/test/runner.html diff --git a/view/index.js b/view/index.js index 7d630509b..0ff28e25a 100644 --- a/view/index.js +++ b/view/index.js @@ -6,7 +6,7 @@ var yeoman = require('yeoman-generator'); var Generator = module.exports = function Generator() { yeoman.generators.NamedBase.apply(this, arguments); - this.sourceRoot(path.join(__dirname, '../templates')); + this.sourceRoot(path.join(__dirname, '../templates/common')); if (typeof this.env.options.appPath === 'undefined') { try { @@ -20,7 +20,7 @@ util.inherits(Generator, yeoman.generators.NamedBase); Generator.prototype.createViewFiles = function createViewFiles() { this.template( - 'common/view.html', + 'app/views/view.html', path.join( this.env.options.appPath, 'views',