├── .gitignore ├── app ├── templates │ ├── bowerrc │ ├── src │ │ ├── app │ │ │ ├── tests │ │ │ │ ├── unit.js │ │ │ │ ├── functional.js │ │ │ │ ├── dojoConfig.js │ │ │ │ ├── remoteReady.js │ │ │ │ ├── ready.js │ │ │ │ └── intern.js │ │ │ ├── _package.json │ │ │ ├── resources │ │ │ │ ├── main.css │ │ │ │ └── main.styl │ │ │ ├── main.js │ │ │ └── _package.js │ │ ├── index.html │ │ └── dojoConfig.js │ ├── gitignore │ ├── editorconfig │ ├── travis.yml │ ├── _bower.json │ ├── _package.json │ ├── gitattributes │ ├── jshintrc │ ├── Gruntfile.js │ └── profiles │ │ └── app.profile.js └── index.js ├── .travis.yml ├── tests ├── load.js ├── intern.js └── creation.js ├── .editorconfig ├── test ├── templates │ ├── unit.js │ ├── functional.js │ └── functional.html └── index.js ├── .gitattributes ├── NamedBase.js ├── package.json ├── .jshintrc ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | temp/ 3 | -------------------------------------------------------------------------------- /app/templates/bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "src" 3 | } 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | 5 | -------------------------------------------------------------------------------- /app/templates/src/app/tests/unit.js: -------------------------------------------------------------------------------- 1 | define([ 2 | // include unit test suites 3 | ], function () {}); 4 | -------------------------------------------------------------------------------- /app/templates/src/app/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= appname %>", 3 | "dojoBuild": "package.js" 4 | } 5 | -------------------------------------------------------------------------------- /app/templates/src/app/tests/functional.js: -------------------------------------------------------------------------------- 1 | define([ 2 | // include functional test suites 3 | ], function () {}); 4 | -------------------------------------------------------------------------------- /app/templates/src/app/resources/main.css: -------------------------------------------------------------------------------- 1 | <% if (dijit) { %>@import "../../dijit/themes/claro/claro.css"; 2 | <% } %><% if (dgrid) { %>@import "../../dgrid/css/skins/claro.css"; 3 | <% } %> 4 | -------------------------------------------------------------------------------- /app/templates/src/app/resources/main.styl: -------------------------------------------------------------------------------- 1 | <% if (dijit) { %>@import "../../dijit/themes/claro/claro.css"; 2 | <% } %><% if (dgrid) { %>@import "../../dgrid/css/skins/claro.css"; 3 | <% } %> 4 | -------------------------------------------------------------------------------- /app/templates/gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | src/dojo<% if (dijit) { %> 4 | src/dijit<% } %><% if (dojox) { %> 5 | src/dojox<% } %><% if (dgrid) { %> 6 | src/put-selector 7 | src/xstyle 8 | src/dgrid<% } %> 9 | src/util 10 | -------------------------------------------------------------------------------- /app/templates/editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /tests/load.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'intern!object', 3 | 'intern/chai!assert', 4 | 'intern/node_modules/dojo/node!../../../../../app' 5 | ], function (registerSuite, assert, app) { 6 | registerSuite({ 7 | name: 'load', 8 | 9 | 'import': function () { 10 | assert(app !== undefined); 11 | } 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /app/templates/travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | env: 5 | global: 6 | - SAUCE_USERNAME: <%= sauceUsername %> 7 | - SAUCE_ACCESS_KEY: <%= sauceAccessKey %> 8 | before_script: 9 | - npm install -g bower grunt-cli 10 | - npm install 11 | - bower install 12 | script: grunt intern 13 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = tab 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | indent_style = space 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /test/templates/unit.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'intern!object', 3 | 'intern/chai!assert' 4 | ], function (registerSuite, assert) { 5 | registerSuite({ 6 | name: '<%= name %>', 7 | 8 | setup: function () { 9 | // before all tests run 10 | }, 11 | 12 | teardown: function () { 13 | // after all tests run 14 | } 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /test/templates/functional.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'intern!object', 3 | 'intern/chai!assert', 4 | '<%= testsUrl %>/remoteReady', 5 | 'require' 6 | ], function (registerSuite, assert, remoteReady, require) { 7 | registerSuite({ 8 | name: '<%= name %>', 9 | 10 | setup: function () { 11 | return this.get('remote') 12 | .get(require.toUrl('./<%= name %>.html')) 13 | .then(remoteReady()); 14 | } 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /app/templates/_bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= appname %>", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "dojo": "<%= dojoVersion %>",<% if (dijit) { %> 7 | "dijit": "<%= dojoVersion %>",<% } %><% if(dojox) { %> 8 | "dojox": "<%= dojoVersion %>",<% } %><% if(dgrid) { %> 9 | "dgrid": "<%= dgridVersion %>",<% } %> 10 | "util": "dojo-util#<%= dojoVersion %>" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/templates/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Dojo Application 6 | 7 | 8 | 9 | class="claro"<% } %>> 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case users don't have core.autocrlf set 2 | * text=auto 3 | 4 | # Files that should always be normalized and converted to native line 5 | # endings on checkout. 6 | *.js text 7 | *.htm text 8 | *.html text 9 | *.styl text 10 | *.json text 11 | *.md text 12 | *.svg text 13 | *.txt text 14 | *.php text 15 | 16 | # Files that are truly binary and should not be modified 17 | *.png binary 18 | *.jpg binary 19 | *.jpeg binary 20 | *.gif binary 21 | -------------------------------------------------------------------------------- /app/templates/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= appname %>", 3 | "version": "0.0.0", 4 | "devDependencies": { 5 | "grunt": "0.4.1", 6 | "grunt-dojo": "0.2.4", 7 | "grunt-contrib-copy": "0.4.1", 8 | "grunt-contrib-connect": "0.5.0", 9 | "grunt-contrib-clean": "0.5.0",<% if (stylus) { %> 10 | "grunt-contrib-watch": "0.5.3", 11 | "grunt-contrib-stylus": "0.8.0",<% } %> 12 | "intern-geezer": "2.0.3", 13 | "load-grunt-tasks": "0.1.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/templates/gitattributes: -------------------------------------------------------------------------------- 1 | # Set the default behavior, in case users don't have core.autocrlf set 2 | * text=auto 3 | 4 | # Files that should always be normalized and converted to native line 5 | # endings on checkout. 6 | *.js text 7 | *.htm text 8 | *.html text 9 | *.styl text 10 | *.json text 11 | *.md text 12 | *.svg text 13 | *.txt text 14 | *.php text 15 | 16 | # Files that are truly binary and should not be modified 17 | *.png binary 18 | *.jpg binary 19 | *.jpeg binary 20 | *.gif binary 21 | -------------------------------------------------------------------------------- /app/templates/src/app/tests/dojoConfig.js: -------------------------------------------------------------------------------- 1 | /*jshint unused:false*/ 2 | var dojoConfig = { 3 | async: true, 4 | baseUrl: location.pathname.replace(/\/<%= appname %>\/.*$/, '/'), 5 | tlmSiblingOfDojo: false, 6 | isDebug: true, 7 | packages: [ 8 | 'dojo',<% if (dijit) { %> 9 | 'dijit',<% } %><% if (dojox) { %> 10 | 'dojox',<% } %><% if (dgrid) { %> 11 | 'put-selector', 12 | 'xstyle', 13 | 'dgrid',<% } %> 14 | '<%= appname %>' 15 | ], 16 | deps: [ '<%= appname %>/tests/ready' ] 17 | }; 18 | -------------------------------------------------------------------------------- /app/templates/src/app/tests/remoteReady.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'intern/dojo/node!leadfoot/helpers/pollUntil' 3 | ], function (pollUntil) { 4 | /* global __ready__ */ 5 | function remoteReady(timeout) { 6 | if (isNaN(timeout)) { 7 | timeout = 5000; 8 | } 9 | return pollUntil( 10 | function () { 11 | if (typeof __ready__ !== 'undefined') { 12 | return __ready__ || null; 13 | } 14 | }, 15 | timeout == null ? 5000 : timeout 16 | ); 17 | } 18 | 19 | return remoteReady; 20 | }); 21 | -------------------------------------------------------------------------------- /test/templates/functional.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <%= name %> test 6 | 7 | 8 | 9 | 10 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/templates/src/dojoConfig.js: -------------------------------------------------------------------------------- 1 | /*jshint unused:false*/ 2 | var dojoConfig = { 3 | async: true, 4 | baseUrl: '', 5 | tlmSiblingOfDojo: false, 6 | isDebug: true, 7 | packages: [ 8 | 'dojo',<% if (dijit) { %> 9 | 'dijit',<% } %><% if (dojox) { %> 10 | 'dojox',<% } %><% if (dgrid) { %> 11 | 'put-selector', 12 | 'xstyle', 13 | 'dgrid',<% } %> 14 | '<%= appname %>' 15 | ], 16 | deps: [ '<%= appname %>' ], 17 | callback: function (<%= _.camelize(appname) %>) { 18 | <%= _.camelize(appname) %>.init(); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /app/templates/src/app/main.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'exports' 3 | ], function (<%= _.camelize(appname) %>) { 4 | <%= _.camelize(appname) %>.init = function () { 5 | // summary: 6 | // This function is executed automatically by the loader configuration. 7 | // It will be executed after the page has loaded, the DOM is ready, and all 8 | // dependencies of this module have been loaded. Use this function to initialize 9 | // the application; for instance, creating a page controller or running the 10 | // Dojo parser. 11 | }; 12 | }); 13 | -------------------------------------------------------------------------------- /NamedBase.js: -------------------------------------------------------------------------------- 1 | /* jshint node:true */ 2 | var yeoman = require('yeoman-generator'); 3 | var path = require('path'); 4 | 5 | module.exports = yeoman.generators.NamedBase.extend({ 6 | constructor: function () { 7 | // By calling `NamedBase` here, we get the argument to the subgenerator call 8 | // as `this.name`. 9 | yeoman.generators.NamedBase.apply(this, arguments); 10 | 11 | this.appname = this.config.get('appname'); 12 | this.subdir = ''; 13 | if (this._.contains(this.name, '/')) { 14 | this.subdir = path.dirname(this.name); 15 | this.name = path.basename(this.name); 16 | } 17 | } 18 | }); 19 | -------------------------------------------------------------------------------- /app/templates/src/app/tests/ready.js: -------------------------------------------------------------------------------- 1 | var __ready__ = false; 2 | define([ 3 | 'dojo/promise/all', 4 | 'dojo/Deferred', 5 | 'dojo/domReady!' 6 | ], function (all, Deferred) { 7 | var promises = []; 8 | var context = { 9 | async: function () { 10 | var deferred = new Deferred(); 11 | promises.push(deferred.promise); 12 | return deferred; 13 | } 14 | }; 15 | function done() { 16 | __ready__ = true; 17 | } 18 | var req = function (config, deps, callback) { 19 | if (!callback) { 20 | callback = deps; 21 | deps = config; 22 | config = {}; 23 | } 24 | var deferred = new Deferred(); 25 | promises.push(deferred.promise); 26 | require(config, deps, function () { 27 | callback.apply(this, arguments); 28 | deferred.resolve(); 29 | }); 30 | }; 31 | if (typeof window.initializeTest === 'function') { 32 | window.initializeTest.call(context, req); 33 | all(promises).then(done); 34 | } 35 | else { 36 | done(); 37 | } 38 | }); 39 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-dojo", 3 | "version": "0.3.0", 4 | "description": "A generator for Yeoman", 5 | "keywords": [ 6 | "yeoman-generator", 7 | "dojo" 8 | ], 9 | "homepage": "https://github.com/bryanforbes/generator-dojo", 10 | "bugs": "https://github.com/bryanforbes/generator-dojo/issues", 11 | "author": { 12 | "name": "Bryan Forbes", 13 | "email": "bryan@reigndropsfall.net", 14 | "url": "https://github.com/bryanforbes" 15 | }, 16 | "main": "app/index.js", 17 | "repository": { 18 | "type": "git", 19 | "url": "git://github.com/bryanforbes/generator-dojo.git" 20 | }, 21 | "scripts": { 22 | "test": "./node_modules/.bin/intern-client config=tests/intern" 23 | }, 24 | "dependencies": { 25 | "yeoman-generator": "^0.16.0" 26 | }, 27 | "devDependencies": { 28 | "intern": "2.0.3" 29 | }, 30 | "engines": { 31 | "node": ">=0.8.0", 32 | "npm": ">=1.2.10" 33 | }, 34 | "licenses": [ 35 | { 36 | "type": "New BSD" 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /tests/intern.js: -------------------------------------------------------------------------------- 1 | // Learn more about configuring this file at . 2 | // These default settings work OK for most people. The options that *must* be changed below are the 3 | // packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites. 4 | define({ 5 | // Configuration options for the module loader; any AMD configuration options supported by the Dojo loader can be 6 | // used here 7 | loader: { 8 | // Packages that should be registered with the loader in each testing environment 9 | packages: [ { name: 'generator-dojo', location: '.' } ] 10 | }, 11 | 12 | // Non-functional test suite(s) to run in each browser 13 | suites: [ 'generator-dojo/tests/load', 'generator-dojo/tests/creation' ], 14 | 15 | // Functional test suite(s) to run in each browser once non-functional tests are completed 16 | functionalSuites: [ /* 'myPackage/tests/functional' */ ], 17 | 18 | // A regular expression matching URLs to files that should not be included in code coverage analysis 19 | excludeInstrumentation: /^(node_modules|tests)\// 20 | }); 21 | -------------------------------------------------------------------------------- /tests/creation.js: -------------------------------------------------------------------------------- 1 | /* jshint node:true */ 2 | define([ 3 | 'intern!object', 4 | 'intern/chai!assert', 5 | 'intern/node_modules/dojo/Deferred', 6 | 'intern/node_modules/dojo/node!path', 7 | 'intern/node_modules/dojo/node!yeoman-generator', 8 | 'module' 9 | ], function (registerSuite, assert, Deferred, path, generator, module) { 10 | var helpers = generator.test, 11 | app; 12 | 13 | registerSuite({ 14 | name: 'creation', 15 | 16 | beforeEach: function () { 17 | var dfd = new Deferred(); 18 | 19 | helpers.testDirectory(path.join(path.dirname(module.uri), 'temp'), function (err) { 20 | if (err) { 21 | return dfd.reject(err); 22 | } 23 | 24 | app = helpers.createGenerator('dojo:app', [ 25 | '../../app' 26 | ]); 27 | 28 | dfd.resolve(); 29 | }); 30 | 31 | return dfd.promise; 32 | }, 33 | 34 | 'expected files': function () { 35 | var dfd = this.async(), 36 | expected = [ 37 | '.jshintrc', 38 | '.editorconfig', 39 | 'src/temp/resources/main.styl' 40 | ]; 41 | 42 | helpers.mockPrompt(app, { 43 | 'dojoVersion': '1.9.1', 44 | 'features': [ 'dijit', 'dgrid', 'stylus' ], 45 | 'dgridVersion': '0.3.10', 46 | 'nib': true, 47 | 'compression': 'closure', 48 | 'travisci': false 49 | }); 50 | app.options['skip-install'] = true; 51 | app.run({}, function () { 52 | helpers.assertFiles(expected); 53 | dfd.resolve(); 54 | }); 55 | } 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": false, 3 | "bitwise": false, 4 | "boss": false, 5 | "browser": true, 6 | "camelcase": true, 7 | "couch": false, 8 | "curly": true, 9 | "debug": false, 10 | "devel": true, 11 | "dojo": false, 12 | "eqeqeq": true, 13 | "eqnull": true, 14 | "es3": true, 15 | "esnext": false, 16 | "evil": false, 17 | "expr": true, 18 | "forin": false, 19 | "funcscope": true, 20 | "globalstrict": false, 21 | "immed": true, 22 | "iterator": false, 23 | "jquery": false, 24 | "lastsemic": false, 25 | "latedef": false, 26 | "laxbreak": true, 27 | "laxcomma": false, 28 | "loopfunc": true, 29 | "mootools": false, 30 | "multistr": false, 31 | "newcap": true, 32 | "noarg": true, 33 | "node": false, 34 | "noempty": false, 35 | "nonew": true, 36 | "nonstandard": false, 37 | "nomen": false, 38 | "onecase": false, 39 | "onevar": false, 40 | "passfail": false, 41 | "plusplus": false, 42 | "proto": false, 43 | "prototypejs": false, 44 | "regexdash": true, 45 | "regexp": false, 46 | "rhino": false, 47 | "undef": true, 48 | "unused": true, 49 | "scripturl": true, 50 | "shadow": false, 51 | "smarttabs": true, 52 | "strict": false, 53 | "sub": false, 54 | "supernew": false, 55 | "trailing": true, 56 | "validthis": true, 57 | "withstmt": false, 58 | "white": true, 59 | "worker": false, 60 | "wsh": false, 61 | "yui": false, 62 | "indent": 4, 63 | "predef": [ "require", "define" ], 64 | "quotmark": "single", 65 | "maxcomplexity": 10 66 | } 67 | -------------------------------------------------------------------------------- /app/templates/jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": false, 3 | "bitwise": false, 4 | "boss": false, 5 | "browser": true, 6 | "camelcase": true, 7 | "couch": false, 8 | "curly": true, 9 | "debug": false, 10 | "devel": true, 11 | "dojo": false, 12 | "eqeqeq": true, 13 | "eqnull": true, 14 | "es3": true, 15 | "esnext": false, 16 | "evil": false, 17 | "expr": true, 18 | "forin": false, 19 | "funcscope": true, 20 | "globalstrict": false, 21 | "immed": true, 22 | "iterator": false, 23 | "jquery": false, 24 | "lastsemic": false, 25 | "latedef": false, 26 | "laxbreak": true, 27 | "laxcomma": false, 28 | "loopfunc": true, 29 | "mootools": false, 30 | "multistr": false, 31 | "newcap": true, 32 | "noarg": true, 33 | "node": false, 34 | "noempty": false, 35 | "nonew": true, 36 | "nonstandard": false, 37 | "nomen": false, 38 | "onecase": false, 39 | "onevar": false, 40 | "passfail": false, 41 | "plusplus": false, 42 | "proto": false, 43 | "prototypejs": false, 44 | "regexdash": true, 45 | "regexp": false, 46 | "rhino": false, 47 | "undef": true, 48 | "unused": true, 49 | "scripturl": true, 50 | "shadow": false, 51 | "smarttabs": true, 52 | "strict": false, 53 | "sub": false, 54 | "supernew": false, 55 | "trailing": true, 56 | "validthis": true, 57 | "withstmt": false, 58 | "white": true, 59 | "worker": false, 60 | "wsh": false, 61 | "yui": false, 62 | "indent": 4, 63 | "predef": [ "require", "define" ], 64 | "quotmark": "single", 65 | "maxcomplexity": 10 66 | } 67 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | New BSD License 2 | 3 | Copyright (c) 2013, Bryan Forbes 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | * Neither the name of the Dojo Foundation nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /test/index.js: -------------------------------------------------------------------------------- 1 | /* jshint node:true */ 2 | var NamedBase = require('../NamedBase'); 3 | var path = require('path'); 4 | 5 | module.exports = NamedBase.extend({ 6 | constructor: function (args, options) { 7 | NamedBase.apply(this, arguments); 8 | 9 | var projectRoot = this.destinationRoot(); 10 | 11 | var basePath = path.join(projectRoot, 'src'), 12 | appPath = path.join(basePath, this.appname), 13 | testsPath = path.join(appPath, 'tests'), 14 | testPath = path.join(testsPath, options.functional ? 'functional' : 'unit', this.subdir), 15 | relativeBaseUrl = path.relative(testPath, basePath), 16 | relativeAppUrl = path.relative(testPath, appPath), 17 | relativeTestsUrl = path.relative(testPath, testsPath); 18 | 19 | if (path.sep === '\\') { 20 | relativeBaseUrl = relativeBaseUrl.replace('\\', '/'); 21 | relativeAppUrl = relativeAppUrl.replace('\\', '/'); 22 | relativeTestsUrl = relativeTestsUrl.replace('\\', '/'); 23 | } 24 | 25 | this.functional = options.functional; 26 | this.testDirPath = testPath; 27 | this.appUrl = relativeAppUrl; 28 | this.testsUrl = relativeTestsUrl; 29 | this.baseUrl = relativeBaseUrl; 30 | 31 | this.on('end', function () { 32 | var type = this.functional ? 'functional' : 'unit'; 33 | 34 | console.log( 35 | 'Don\'t forget to add ./' + 36 | type + '/' + (this.subdir ? this.subdir + '/' : '') + this.name + 37 | ' to the dependency list in ' + 38 | path.join('src', this.appname, 'tests', type + '.js')); 39 | }.bind(this)); 40 | }, 41 | files: function () { 42 | var modulePath = path.join(this.testDirPath, this.name + '.js'); 43 | if (this.functional) { 44 | this.template('functional.js', modulePath); 45 | this.template('functional.html', path.join(this.testDirPath, this.name + '.html')); 46 | } 47 | else { 48 | this.template('unit.js', modulePath); 49 | } 50 | } 51 | }); 52 | -------------------------------------------------------------------------------- /app/templates/src/app/_package.js: -------------------------------------------------------------------------------- 1 | /*jshint unused:false*/ 2 | /** 3 | * This file is referenced by the `dojoBuild` key in `package.json` and provides extra hinting specific to the Dojo 4 | * build system about how certain files in the package need to be handled at build time. Build profiles for the 5 | * application itself are stored in the `profiles` directory. 6 | */ 7 | var profile = { 8 | // Resource tags are functions that provide hints to the build system about the way files should be processed. 9 | // Each of these functions is called once for every file in the package directory. The first argument passed to 10 | // the function is the filename of the file, and the second argument is the computed AMD module ID of the file. 11 | resourceTags: { 12 | // Files that contain test code and should be excluded when the `copyTests` build flag exists and is `false`. 13 | // It is strongly recommended that the `mini` build flag be used instead of `copyTests`. Therefore, no files 14 | // are marked with the `test` tag here. 15 | test: function (filename, moduleId) { 16 | return false; 17 | }, 18 | 19 | // Files that should be copied as-is without being modified by the build system. 20 | // All files in the `win/resources` directory that are not CSS files are marked as copy-only, since these files 21 | // are typically binaries (images, etc.) and may be corrupted by the build system if it attempts to process 22 | // them and naively assumes they are scripts. 23 | copyOnly: function (filename, moduleId) { 24 | return (/^<%= appname %>\/resources\//.test(filename) && !/\.css$/.test(filename)); 25 | }, 26 | 27 | // Files that are AMD modules. 28 | // All JavaScript in this package should be AMD modules if you are starting a new project. If you are copying 29 | // any legacy scripts from an existing project, those legacy scripts should not be given the `amd` tag. 30 | amd: function (filename, moduleId) { 31 | return !this.copyOnly(filename, moduleId) && /\.js$/.test(filename); 32 | }, 33 | 34 | // Files that should not be copied when the `mini` build flag is set to true. 35 | // In this case, we are excluding this package configuration file which is not necessary in a built copy of 36 | // the application. 37 | miniExclude: function (filename, moduleId) { 38 | return (/^<%= appname %>\/tests\//).test(moduleId) || moduleId in { 39 | '<%= appname %>/package': 1 40 | }; 41 | } 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /app/templates/Gruntfile.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | module.exports = function (grunt) { 3 | require('load-grunt-tasks')(grunt, [ 'grunt-*', 'intern-geezer' ]); 4 | var path = require('path'); 5 | 6 | var stripComments = /<\!--.*?-->/g, 7 | collapseWhiteSpace = /\s+/g; 8 | 9 | grunt.initConfig({ 10 | dojo: { 11 | dist: { 12 | options: { 13 | dojo: path.join('src', 'dojo', 'dojo.js'), 14 | dojoConfig: path.join('src', 'dojoConfig.js'), 15 | profile: path.join('profiles', '<%= appname %>.profile.js'), 16 | releaseDir: path.join('..', 'dist'), 17 | basePath: path.join(__dirname, 'src') 18 | } 19 | } 20 | }, 21 | copy: { 22 | config: { 23 | options: { 24 | processContent: function (content) { 25 | return content.replace(/isDebug:\s+(true|1),?\s+/, ''); 26 | } 27 | }, 28 | files: [{ 29 | src: path.join('src', 'dojoConfig.js'), 30 | dest: path.join('dist', 'dojoConfig.js') 31 | }] 32 | }, 33 | index: { 34 | options: { 35 | processContent: function (content) { 36 | return content 37 | .replace(stripComments, '') 38 | .replace(collapseWhiteSpace, ' ') 39 | ; 40 | } 41 | }, 42 | files: [{ 43 | src: path.join('src', 'index.html'), 44 | dest: path.join('dist', 'index.html') 45 | }] 46 | } 47 | }, 48 | connect: { 49 | options: { 50 | port: 8888, 51 | hostname: 'localhost' 52 | }, 53 | test: { 54 | options: { 55 | base: 'src' 56 | } 57 | }, 58 | dist: { 59 | options: { 60 | base: 'dist' 61 | } 62 | } 63 | }, 64 | clean: { 65 | dist: { 66 | files: [{ 67 | dot: true, 68 | src: [ 69 | 'dist' 70 | ] 71 | }] 72 | } 73 | },<% if (stylus) { %> 74 | stylus: { 75 | compile: { 76 | options: { 77 | compress: false<% if (nib) { %>, 78 | 'import': [ 'nib' ]<% } %> 79 | }, 80 | files: { 81 | 'src/<%= appname %>/resources/main.css': 'src/<%= appname %>/resources/main.styl' 82 | } 83 | } 84 | }, 85 | watch: { 86 | stylus: { 87 | files: 'src/<%= appname %>/resources/**/*.styl', 88 | tasks: [ 'stylus:compile' ] 89 | } 90 | },<% } %> 91 | intern: { 92 | local: { 93 | options: { 94 | runType: 'client', 95 | config: 'src/<%= appname %>/tests/intern' 96 | } 97 | }, 98 | remote: { 99 | options: { 100 | runType: 'runner', 101 | config: 'src/<%= appname %>/tests/intern' 102 | } 103 | } 104 | } 105 | }); 106 | 107 | grunt.registerTask('default', [<% if (stylus) { %> 'stylus:compile', 'watch:stylus' <% } %>]); 108 | grunt.registerTask('server', function (target) { 109 | if (target === 'dist') { 110 | return grunt.task.run([ 111 | 'build', 112 | 'connect:dist:keepalive' 113 | ]); 114 | } 115 | 116 | grunt.task.run([ 117 | <% if (stylus) { %>'stylus:compile', 118 | <% } %>'connect:test<% if (!stylus) { %>:keepalive<% } %>'<% if (stylus) { %>, 119 | 'watch:stylus'<% } %> 120 | ]); 121 | }); 122 | grunt.registerTask('build', [ <% if (stylus) { %>'stylus:compile', <% } %>'clean', 'dojo:dist', 'copy' ]); 123 | }; 124 | -------------------------------------------------------------------------------- /app/templates/src/app/tests/intern.js: -------------------------------------------------------------------------------- 1 | // Learn more about configuring this file at . 2 | // These default settings work OK for most people. The options that *must* be changed below are the 3 | // packages, suites, excludeInstrumentation, and (if you want functional tests) functionalSuites. 4 | define({ 5 | // The port on which the instrumenting proxy will listen 6 | proxyPort: 9000, 7 | 8 | // A fully qualified URL to the Intern proxy 9 | proxyUrl: 'http://localhost:9000/', 10 | 11 | // Default desired capabilities for all environments. Individual capabilities can be overridden by any of the 12 | // specified browser environments in the `environments` array below as well. See 13 | // https://code.google.com/p/selenium/wiki/DesiredCapabilities for standard Selenium capabilities and 14 | // https://saucelabs.com/docs/additional-config#desired-capabilities for Sauce Labs capabilities. 15 | // Note that the `build` capability will be filled in with the current commit ID from the Travis CI environment 16 | // automatically 17 | capabilities: { 18 | 'selenium-version': '2.41.0' 19 | }, 20 | 21 | // Browsers to run integration testing against. Note that version numbers must be strings if used with Sauce 22 | // OnDemand. Options that will be permutated are browserName, version, platform, and platformVersion; any other 23 | // capabilities options specified for an environment will be copied as-is 24 | environments: [ 25 | { browserName: 'internet explorer', version: '10', platform: 'Windows 8' }, 26 | { browserName: 'internet explorer', version: '9', platform: 'Windows 7' }, 27 | { browserName: 'firefox', version: '23', platform: [ 'Linux', 'Windows 7' ] }, 28 | { browserName: 'firefox', version: '21', platform: 'Mac 10.6' }, 29 | { browserName: 'chrome', platform: [ 'Linux', 'Mac 10.8', 'Windows 7' ] }, 30 | { browserName: 'safari', version: '6', platform: 'Mac 10.8' } 31 | ], 32 | 33 | // Maximum number of simultaneous integration tests that should be executed on the remote WebDriver service 34 | maxConcurrency: 3, 35 | 36 | // Name of the tunnel class to use for WebDriver tests 37 | tunnel: 'SauceLabsTunnel', 38 | 39 | // The desired AMD loader to use when running unit tests (client.html/client.js). Omit to use the default Dojo 40 | // loader 41 | useLoader: { 42 | 'host-node': 'dojo/dojo', 43 | 'host-browser': 'node_modules/dojo/dojo.js' 44 | }, 45 | 46 | // Configuration options for the module loader; any AMD configuration options supported by the Dojo loader can be 47 | // used here 48 | loader: { 49 | // Packages that should be registered with the loader in each testing environment 50 | packages: [ 51 | { name: 'dojo', location: 'src/dojo' },<% if (dijit) { %> 52 | { name: 'dijit', location: 'src/dijit' },<% } %><% if (dojox) { %> 53 | { name: 'dojox', location: 'src/dojox' },<% } %><% if (dgrid) { %> 54 | { name: 'put-selector', location: 'src/put-selector' }, 55 | { name: 'xstyle', location: 'src/xstyle' }, 56 | { name: 'dgrid', location: 'src/dgrid' },<% } %> 57 | { name: '<%= appname %>', location: 'src/<%= appname %>' } 58 | ] 59 | }, 60 | 61 | // Non-functional test suite(s) to run in each browser 62 | suites: [ '<%= appname %>/tests/unit' ], 63 | 64 | // Functional test suite(s) to run in each browser once non-functional tests are completed 65 | functionalSuites: [ '<%= appname %>/tests/functional' ], 66 | 67 | // A regular expression matching URLs to files that should not be included in code coverage analysis 68 | excludeInstrumentation: /^(?:node_modules|src\/(?:dojo<% if (dijit) { %>|dijit<% } %><% if (dojox) { %>|dojox<% } %><% if (dgrid) { %>|put-selector|xstyle|dgrid<% }%>|<%= appname %>\/tests))\// 69 | }); 70 | -------------------------------------------------------------------------------- /app/templates/profiles/app.profile.js: -------------------------------------------------------------------------------- 1 | /*jshint unused:false */ 2 | var profile = { 3 | basePath: '../src/', 4 | 5 | // Builds a new release. 6 | action: 'release', 7 | 8 | // Strips all comments and whitespace from CSS files and inlines @imports where possible. 9 | cssOptimize: 'comments', 10 | 11 | // Excludes tests, demos, and original template files from being included in the built version. 12 | mini: true, 13 | 14 | // Uses Closure Compiler as the JavaScript minifier. This can also be set to "shrinksafe" to use ShrinkSafe, 15 | // though ShrinkSafe is deprecated and not recommended. 16 | // This option defaults to "" (no compression) if not provided. 17 | optimize: '', 18 | 19 | // We're building layers, so we need to set the minifier to use for those, too. 20 | // This defaults to "shrinksafe" if not provided. 21 | layerOptimize: '<%= compression %>', 22 | 23 | // Strips all calls to console functions within the code. You can also set this to "warn" to strip everything 24 | // but console.error, and any other truthy value to strip everything but console.warn and console.error. 25 | // This defaults to "normal" (strip all but warn and error) if not provided. 26 | stripConsole: 'all', 27 | 28 | // The default selector engine is not included by default in a dojo.js build in order to make mobile builds 29 | // smaller. We add it back here to avoid that extra HTTP request. There is also a "lite" selector available; if 30 | // you use that, you will need to set the `selectorEngine` property in `app/run.js`, too. (The "lite" engine is 31 | // only suitable if you are not supporting IE7 and earlier.) 32 | selectorEngine: 'acme', 33 | 34 | // Since we're using dojoConfig.map to patch dojo/_base/declare, we must build anonymous modules 35 | insertAbsMids: 0, 36 | 37 | // Builds can be split into multiple different JavaScript files called "layers". This allows applications to 38 | // defer loading large sections of code until they are actually required while still allowing multiple modules to 39 | // be compiled into a single file. 40 | layers: { 41 | 'dojo/dojo': { 42 | include: [ 43 | 'dojo/i18n' 44 | ], 45 | 46 | // By default, the build system will try to include `dojo/main` in the built `dojo/dojo` layer, which adds 47 | // a bunch of stuff we do not want or need. We want the initial script load to be as small and quick to 48 | // load as possible, so we configure it as a custom, bootable base. 49 | boot: true, 50 | customBase: true 51 | }, 52 | 53 | '<%= appname %>/main': { 54 | include: [] 55 | } 56 | }, 57 | 58 | // Providing hints to the build system allows code to be conditionally removed on a more granular level than 59 | // simple module dependencies can allow. This is especially useful for creating tiny mobile builds. 60 | // Keep in mind that dead code removal only happens in minifiers that support it! Currently, only Closure Compiler 61 | // to the Dojo build system with dead code removal. 62 | // A documented list of has-flags in use within the toolkit can be found at 63 | // . 64 | staticHasFeatures: { 65 | 'host-browser': 1, 66 | 'host-node': 0, 67 | 'host-rhino': 0, 68 | 'dojo-firebug': 0, 69 | 70 | // The trace & log APIs are used for debugging the loader, so we do not need them in the build. 71 | 'dojo-trace-api': 0, 72 | 'dojo-log-api': 0, 73 | 74 | // This causes normally private loader data to be exposed for debugging. In a release build, we do not need 75 | // that either. 76 | 'dojo-publish-privates': 0, 77 | 78 | // This application is pure AMD, so get rid of the legacy loader. 79 | 'dojo-sync-loader': 0, 80 | 81 | // `dojo-xhr-factory` relies on `dojo-sync-loader`, which we have removed. 82 | 'dojo-xhr-factory': 0, 83 | 84 | // We are not loading tests in production, so we can get rid of some test sniffing code. 85 | 'dojo-test-sniff': 0 86 | } 87 | }; 88 | if (typeof module !== 'undefined') { module.exports = profile; } 89 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dojo generator [![Build Status](https://secure.travis-ci.org/bryanforbes/generator-dojo.png?branch=master)](https://travis-ci.org/bryanforbes/generator-dojo) 2 | 3 | A Dojo application generator for [Yeoman](http://yeoman.io). 4 | 5 | 6 | ## Getting started 7 | 8 | * Make sure you have [yo](https://github.com/yeoman/yo) and [generator-dojo](https://github.com/bryanforbes/generator-dojo) installed: 9 | 10 | ```bash 11 | npm install -g yo generator-dojo 12 | ``` 13 | 14 | * Make a new directory and traverse into it: 15 | 16 | ```bash 17 | mkdir my-app && cd $_ 18 | ``` 19 | 20 | * Run `yo dojo`, optionally passing an application name (the application name and AMD package will default to the directory you are currently in): 21 | 22 | ```bash 23 | yo dojo [app-name] 24 | ``` 25 | 26 | ## Application layout 27 | 28 | `generator-dojo` will scaffold out a Dojo application using best practices for web development. This means the directory structure for development will be in the same structure as it would be after building for production: 29 | 30 | ```bash 31 | src/ 32 | dojo/ 33 | dijit/ 34 | dgrid/ 35 | ... 36 | my-app/ 37 | index.html 38 | ``` 39 | 40 | Because of this structure, a Dojo application is completely agnostic to the server which delivers it in both development and production environments and requires little to no configuration of the server. It will work equally as well with nginx as it would with Apache Tomcat. 41 | 42 | ## Generators 43 | 44 | * [dojo](#dojo) (aka [dojo:app](#dojo)) 45 | * [dojo:test](#test) 46 | 47 | ### Dojo 48 | 49 | Sets up a new Dojo application, generating all of the boilerplate to get started. The application generator also optionally installs Dijit, DojoX, dgrid, and Stylus. 50 | 51 | Example: 52 | ```bash 53 | yo dojo 54 | ``` 55 | 56 | ### Test 57 | 58 | Generates a unit or functional test for [Intern](http://theintern.io) and places it in `src//tests/.{js,html}`. Optionally receives a `--functional` flag. If the flag is passed, a functional test is generated, otherwise a unit test is generated. 59 | 60 | Example: 61 | ```bash 62 | yo dojo:test --functional widgets/functional/MyWidget 63 | ``` 64 | 65 | Produces `src//tests/widgets/functional/MyWidget.js` and `src//tests/widgets/functional/MyWidget.html`. 66 | 67 | Example: 68 | ```bash 69 | yo dojo:test widgets/MyWidget 70 | ``` 71 | 72 | Produces `src//tests/widgets/MyWidget.js`. 73 | 74 | ## Grunt tasks 75 | 76 | The default `Gruntfile.js` defines some common tasks for your Dojo application: 77 | 78 | ### default 79 | 80 | Compiles and watches for changes to changes in stylus files, compiling them if necessary. 81 | 82 | ### build 83 | 84 | Compiles your application into the `dist` directory using the Dojo build tool. The `dist` directory can then be copied, zipped, tarred, warred, etc. to a production server without the need for complex configuration of the server: it's just a directory of static files! 85 | 86 | ### server 87 | 88 | Serves up the `src` directory as the root directory of `localhost:8888` (this can be configured using the `connect.options.port` option in `Gruntfile.js`). This also watches for changes to stylus files, compiling them if necessary. 89 | 90 | `server` also takes an optional `target` flag. If this flag is `dist`, a build will run and the `dist` directory will be served as the root directory of `localhost:8888`: 91 | 92 | ```bash 93 | grunt server:dist 94 | ``` 95 | 96 | ### intern 97 | 98 | Runs unit and functional tests using [Intern](http://theintern.io). Intern allows web developers to run unit and functional tests in various versions of browsers from the command line. 99 | 100 | This task takes an optional `target` flag. If this flag is `local`, only local non-browser tests will be run. If this flag is `remote`, only remote tests will be run using Selenium (via SauceLabs or your own Selenium server). If this flag is not passed, both non-browser and remote tests will be run. 101 | 102 | ### clean 103 | 104 | Removes the `dist` directory (if one exists) to clean up after a build. 105 | 106 | ## License 107 | 108 | `generator-dojo` is available under the terms of the [New BSD License](LICENSE). All code, with the exception of portions generated from Yeoman's [generator-generator](https://github.com/yeoman/generator-generator), is developed under the terms of the [Dojo Foundation CLA](http://dojofoundation.org/about/cla). 109 | 110 | © 2013 Bryan Forbes http://www.reigndropsfall.net
111 | All rights reserved. 112 | -------------------------------------------------------------------------------- /app/index.js: -------------------------------------------------------------------------------- 1 | /*jshint node:true*/ 2 | var path = require('path'); 3 | var yeoman = require('yeoman-generator'); 4 | 5 | module.exports = yeoman.generators.Base.extend({ 6 | constructor: function (args, options) { 7 | yeoman.generators.Base.apply(this, arguments); 8 | 9 | this.argument('appname', { type: String, required: false }); 10 | this.appname = this._.slugify(this.appname || path.basename(process.cwd())); 11 | 12 | this.on('end', function () { 13 | this.installDependencies({ 14 | skipInstall: options['skip-install'], 15 | callback: function () { 16 | // Once dgrid is installed, grab the dependencies from package.json 17 | // and use `bowerInstall` to install them 18 | if (this.dgrid) { 19 | var dgridDeps = this.dest.readJSON('src/dgrid/package.json').dependencies; 20 | this.bowerInstall([ 21 | 'put-selector#~' + dgridDeps['put-selector'], 22 | 'xstyle#~' + dgridDeps.xstyle 23 | ], { 24 | save: true 25 | }); 26 | } 27 | }.bind(this) 28 | }); 29 | }); 30 | 31 | this.config.defaults({ 32 | appname: this.appname 33 | }); 34 | }, 35 | 36 | askFor: function askFor() { 37 | var cb = this.async(), 38 | _ = this._; 39 | 40 | function dgridIncluded(answers) { 41 | return _.contains(answers.features, 'dgrid'); 42 | } 43 | 44 | var prompts = [{ 45 | name: 'dojoVersion', 46 | message: 'What version of Dojo will be used?', 47 | 'default': '1.10.0' 48 | }, { 49 | type: 'checkbox', 50 | name: 'features', 51 | message: 'What packages would you like to include?', 52 | choices: [{ 53 | name: 'Dijit', 54 | value: 'dijit', 55 | checked: true 56 | }, { 57 | name: 'DojoX', 58 | value: 'dojox', 59 | checked: false 60 | }, { 61 | name: 'dgrid', 62 | value: 'dgrid', 63 | checked: true 64 | }, { 65 | name: 'Stylus', 66 | value: 'stylus', 67 | checked: true 68 | }] 69 | }, { 70 | name: 'dgridVersion', 71 | message: 'What version of dgrid?', 72 | when: dgridIncluded, 73 | 'default': '0.3.15' 74 | }, { 75 | type: 'confirm', 76 | name: 'nib', 77 | message: 'Include nib when compiling Stylus files?', 78 | when: function (answers) { 79 | return _.contains(answers.features, 'stylus'); 80 | }, 81 | 'default': true 82 | }, { 83 | type: 'list', 84 | name: 'compression', 85 | message: 'What type of compression should be used when building?', 86 | choices: [{ 87 | name: 'Shrinksafe', 88 | value: 'shrinksafe' 89 | }, { 90 | name: 'Closure', 91 | value: 'closure' 92 | }, { 93 | name: 'Uglify', 94 | value: 'uglify' 95 | }], 96 | 'default': 1 97 | }, { 98 | type: 'confirm', 99 | name: 'travisci', 100 | message: 'Will you be using Travis-CI?', 101 | 'default': false 102 | }, { 103 | name: 'sauceUsername', 104 | message: 'What is your SauceLabs username?', 105 | when: function (answers) { 106 | return answers.travisci; 107 | }, 108 | 'default': process.env.SAUCE_USERNAME || '' 109 | }, { 110 | name: 'sauceAccessKey', 111 | message: 'What is your SauceLabs access key?', 112 | when: function (answers) { 113 | return answers.travisci; 114 | }, 115 | 'default': process.env.SAUCE_ACCESS_KEY || '' 116 | }]; 117 | 118 | this.prompt(prompts, function (props) { 119 | this.dojoVersion = props.dojoVersion; 120 | this.travisci = props.travisci; 121 | this.sauceUsername = props.sauceUsername; 122 | this.sauceAccessKey = props.sauceAccessKey; 123 | 124 | this.dijit = _.contains(props.features, 'dijit'); 125 | this.dojox = _.contains(props.features, 'dojox'); 126 | this.dgrid = _.contains(props.features, 'dgrid'); 127 | this.stylus = _.contains(props.features, 'stylus'); 128 | this.nib = props.nib; 129 | 130 | this.dgridVersion = props.dgridVersion; 131 | this.putSelectorVersion = props.putSelectorVersion; 132 | this.xstyleVersion = props.xstyleVersion; 133 | this.compression = props.compression; 134 | cb(); 135 | }.bind(this)); 136 | }, 137 | 138 | app: function app() { 139 | this.mkdir('src'); 140 | this.mkdir('profiles'); 141 | 142 | this.template('Gruntfile.js', 'Gruntfile.js'); 143 | this.template('_package.json', 'package.json'); 144 | this.template('_bower.json', 'bower.json'); 145 | 146 | this.template('src/index.html', 'src/index.html'); 147 | this.template('src/dojoConfig.js', 'src/dojoConfig.js'); 148 | 149 | this.template('profiles/app.profile.js', 'profiles/' + this.appname + '.profile.js'); 150 | }, 151 | 152 | appPackage: function appPackage() { 153 | var appPath = 'src/' + this.appname; 154 | this.mkdir(appPath); 155 | 156 | this.mkdir(appPath + '/resources'); 157 | this.mkdir(appPath + '/tests'); 158 | 159 | this.template('src/app/main.js', appPath + '/main.js'); 160 | this.template('src/app/_package.json', appPath + '/package.json'); 161 | this.template('src/app/_package.js', appPath + '/package.js'); 162 | 163 | if (this.stylus) { 164 | this.template('src/app/resources/main.styl', appPath + '/resources/main.styl'); 165 | } 166 | else { 167 | this.template('src/app/resources/main.css', appPath + '/resources/main.css'); 168 | } 169 | this.template('src/app/tests/unit.js', appPath + '/tests/unit.js'); 170 | this.template('src/app/tests/functional.js', appPath + '/tests/functional.js'); 171 | this.template('src/app/tests/dojoConfig.js', appPath + '/tests/dojoConfig.js'); 172 | this.template('src/app/tests/intern.js', appPath + '/tests/intern.js'); 173 | this.template('src/app/tests/ready.js', appPath + '/tests/ready.js'); 174 | this.template('src/app/tests/remoteReady.js', appPath + '/tests/remoteReady.js'); 175 | }, 176 | 177 | runtime: function () { 178 | this.copy('bowerrc', '.bowerrc'); 179 | this.template('gitignore', '.gitignore'); 180 | this.copy('gitattributes', '.gitattributes'); 181 | 182 | if (this.travisci) { 183 | this.template('travis.yml', '.travis.yml'); 184 | } 185 | }, 186 | 187 | projectfiles: function () { 188 | this.copy('editorconfig', '.editorconfig'); 189 | this.copy('jshintrc', '.jshintrc'); 190 | } 191 | }); 192 | --------------------------------------------------------------------------------