| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -18,6 +18,7 @@ | |||
| 18 | 18 | "es6-shim": "^0.33.6", | |
| 19 | 19 | "inquirer": "^0.11.0", | |
| 20 | 20 | "lodash": "^3.10.1", | |
| 21 | + "q": "^1.4.1", | ||
| 21 | 22 | "reflect-metadata": "0.1.1", | |
| 22 | 23 | "shelljs": "^0.5.3", | |
| 23 | 24 | "zone.js": "0.5.8" | |
@@ -57,7 +58,6 @@ | |||
| 57 | 58 | "minimist": "^1.1.3", | |
| 58 | 59 | "node-html-encoder": "0.0.2", | |
| 59 | 60 | "node-libs-browser": "^0.5.2", | |
| 60 | - "q": "^1.4.1", | ||
| 61 | 61 | "request": "2.53.0", | |
| 62 | 62 | "run-sequence": "^1.1.0", | |
| 63 | 63 | "semver": "^5.0.1", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,7 +10,7 @@ Generate.__defineGetter__('generators', function() { | |||
| 10 | 10 | if (!Generate._generators) { | |
| 11 | 11 | Generate._generators = Generate.loadGenerators(); | |
| 12 | 12 | } | |
| 13 | - | ||
| 13 | + | ||
| 14 | 14 | return Generate._generators; | |
| 15 | 15 | }); | |
| 16 | 16 | ||
@@ -24,21 +24,17 @@ Generate.generate = function generate(options) { | |||
| 24 | 24 | if (!options) { | |
| 25 | 25 | throw new Error('No options passed to generator'); | |
| 26 | 26 | } | |
| 27 | - | ||
| 27 | + | ||
| 28 | 28 | //add optional logger for CLI or other tools | |
| 29 | 29 | if (options.log) { | |
| 30 | 30 | Generate.log = options.log; | |
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | - if (options.q) { | ||
| 34 | - Generate.q = options.q; | ||
| 35 | - } | ||
| 36 | - | ||
| 37 | 33 | if (!options.generatorName) { | |
| 38 | 34 | options.generatorName = 'page'; | |
| 39 | 35 | } | |
| 40 | 36 | ||
| 41 | - var generateOptions = { | ||
| 37 | + var generateOptions = { | ||
| 42 | 38 | appDirectory: options.appDirectory, | |
| 43 | 39 | fileAndClassName: Generate.fileAndClassName(options.name), | |
| 44 | 40 | javascriptClassName: Generate.javascriptClassName(options.name), | |
@@ -78,7 +74,7 @@ Generate.loadGenerator = function loadGenerator(file) { | |||
| 78 | 74 | } | |
| 79 | 75 | return generateModule; | |
| 80 | 76 | }; | |
| 81 | - | ||
| 77 | + | ||
| 82 | 78 | Generate.loadGenerators = function loadGenerators() { | |
| 83 | 79 | var generators = {}; | |
| 84 | 80 | fs.readdirSync(path.join(__dirname, 'generators')) | |
@@ -92,7 +88,7 @@ Generate.loadGenerators = function loadGenerators() { | |||
| 92 | 88 | return generators; | |
| 93 | 89 | }; | |
| 94 | 90 | ||
| 95 | - /* | ||
| 91 | + /* | ||
| 96 | 92 | Will take options to render an html, js, or scss template. | |
| 97 | 93 | options: | |
| 98 | 94 | they differ based on what is needed in template | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,7 @@ | |||
| 1 | 1 | var fs = require('fs'), | |
| 2 | 2 | path = require('path'), | |
| 3 | 3 | inquirer = require('inquirer'), | |
| 4 | + Q = require('q'), | ||
| 4 | 5 | Generator = module.exports, | |
| 5 | 6 | Generate = require('../../generate'); | |
| 6 | 7 | ||
@@ -16,7 +17,7 @@ Generator.validate = function(input) { | |||
| 16 | 17 | Generator.numberNames = ['first', 'second', 'third', 'fourth', 'fifth']; | |
| 17 | 18 | ||
| 18 | 19 | Generator.promptForTabCount = function promptForTabCount() { | |
| 19 | - var q = Generate.q.defer(); | ||
| 20 | + var q = Q.defer(); | ||
| 20 | 21 | ||
| 21 | 22 | inquirer.prompt({choices: ['1', '2', '3', '4', '5'], message: 'How many tabs will you have?', name: 'count', type: 'list', validate: Generator.validate}, function(result) { | |
| 22 | 23 | q.resolve(result.count); | |
@@ -26,7 +27,7 @@ Generator.promptForTabCount = function promptForTabCount() { | |||
| 26 | 27 | }; | |
| 27 | 28 | ||
| 28 | 29 | Generator.promptForTabName = function promptForTabName(tabIndex, options) { | |
| 29 | - var q = Generate.q.defer(); | ||
| 30 | + var q = Q.defer(); | ||
| 30 | 31 | ||
| 31 | 32 | inquirer.prompt({message: 'Enter the ' + Generator.numberNames[tabIndex] + ' tab name:', name: 'name', type: 'input'}, function(nameResult) { | |
| 32 | 33 | Generator.tabs.push({ appDirectory: options.appDirectory, fileAndClassName: Generate.fileAndClassName(nameResult.name), javascriptClassName: Generate.javascriptClassName(nameResult.name), name: nameResult.name }); | |
@@ -39,7 +40,6 @@ Generator.promptForTabName = function promptForTabName(tabIndex, options) { | |||
| 39 | 40 | Generator.run = function run(options) { | |
| 40 | 41 | // console.log('got options!', options); | |
| 41 | 42 | ||
| 42 | - // Generator.q = Generate.q; | ||
| 43 | 43 | //Need to query user for tabs: | |
| 44 | 44 | options.rootDirectory = options.rootDirectory || path.join('www', 'app'); | |
| 45 | 45 | var savePath = path.join(options.appDirectory, options.rootDirectory, options.fileAndClassName); | |
@@ -49,7 +49,7 @@ Generator.run = function run(options) { | |||
| 49 | 49 | return Generator.promptForTabCount() | |
| 50 | 50 | .then(function(count) { | |
| 51 | 51 | console.log('count', count); | |
| 52 | - var promise = Generate.q(); | ||
| 52 | + var promise = Q(); | ||
| 53 | 53 | for(var i = 0, j = parseInt(count); i < j; i++) { | |
| 54 | 54 | (function(index) { | |
| 55 | 55 | promise = promise.then(function() { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments