Updates from generator-generator
This patch adds the initial project structure constructed by yeoman's project generator.
This commit is contained in:
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* text=auto
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -25,6 +25,7 @@ build/Release
|
||||
|
||||
# Dependency directory
|
||||
node_modules
|
||||
coverage
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
6
.travis.yml
Normal file
6
.travis.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- v5
|
||||
- v4
|
||||
- '0.12'
|
||||
- '0.10'
|
||||
44
generators/app/index.js
Normal file
44
generators/app/index.js
Normal file
@@ -0,0 +1,44 @@
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
var yeoman = require('yeoman-generator');
|
||||
var chalk = require('chalk');
|
||||
var yosay = require('yosay');
|
||||
|
||||
module.exports = yeoman.generators.Base.extend({
|
||||
prompting: function () {
|
||||
var done = this.async();
|
||||
|
||||
// Have Yeoman greet the user.
|
||||
this.log(yosay(
|
||||
'Welcome to the fabulous ' + chalk.red('generator-openstack') +
|
||||
' generator!'
|
||||
));
|
||||
|
||||
var prompts = [{
|
||||
type: 'confirm',
|
||||
name: 'someOption',
|
||||
message: 'Would you like to enable this option?',
|
||||
default: true
|
||||
}];
|
||||
|
||||
this.prompt(prompts, function (props) {
|
||||
this.props = props;
|
||||
// To access props later use this.props.someOption;
|
||||
|
||||
done();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
writing: function () {
|
||||
this.fs.copy(
|
||||
this.templatePath('dummyfile.txt'),
|
||||
this.destinationPath('dummyfile.txt')
|
||||
);
|
||||
},
|
||||
|
||||
install: function () {
|
||||
this.installDependencies();
|
||||
}
|
||||
});
|
||||
})();
|
||||
0
generators/app/templates/dummyfile.txt
Normal file
0
generators/app/templates/dummyfile.txt
Normal file
47
gulpfile.js
Normal file
47
gulpfile.js
Normal file
@@ -0,0 +1,47 @@
|
||||
(function () {
|
||||
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var gulp = require('gulp');
|
||||
var excludeGitignore = require('gulp-exclude-gitignore');
|
||||
var mocha = require('gulp-mocha');
|
||||
var istanbul = require('gulp-istanbul');
|
||||
var nsp = require('gulp-nsp');
|
||||
var plumber = require('gulp-plumber');
|
||||
|
||||
gulp.task('nsp', function (cb) {
|
||||
nsp({package: path.resolve('package.json')}, cb);
|
||||
});
|
||||
|
||||
gulp.task('pre-test', function () {
|
||||
return gulp.src('generators/**/*.js')
|
||||
.pipe(excludeGitignore())
|
||||
.pipe(istanbul({
|
||||
includeUntested: true
|
||||
}))
|
||||
.pipe(istanbul.hookRequire());
|
||||
});
|
||||
|
||||
gulp.task('test', ['pre-test'], function (cb) {
|
||||
var mochaErr;
|
||||
|
||||
gulp.src('test/**/*.js')
|
||||
.pipe(plumber())
|
||||
.pipe(mocha({reporter: 'spec'}))
|
||||
.on('error', function (err) {
|
||||
mochaErr = err;
|
||||
})
|
||||
.pipe(istanbul.writeReports())
|
||||
.on('end', function () {
|
||||
cb(mochaErr);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('watch', function () {
|
||||
gulp.watch(['generators/**/*.js', 'test/**'], ['test']);
|
||||
});
|
||||
|
||||
gulp.task('prepublish', ['nsp']);
|
||||
gulp.task('default', ['test']);
|
||||
|
||||
})();
|
||||
27
package.json
27
package.json
@@ -1,10 +1,13 @@
|
||||
{
|
||||
"name": "generator-openstack",
|
||||
"homepage": "http://www.openstack.org/",
|
||||
"version": "1.0.0",
|
||||
"description": "Yeoman Project Generator for OpenStack JavaScript Projects",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "gulp",
|
||||
"prepublish": "gulp prepublish",
|
||||
"lint": "eslint ./"
|
||||
},
|
||||
"keywords": [
|
||||
"yeoman-generator"
|
||||
@@ -15,5 +18,25 @@
|
||||
"generators/library"
|
||||
],
|
||||
"author": "OpenStack <openstack-dev@lists.openstack.org> (http://www.openstack.org/)",
|
||||
"license": "Apache-2.0"
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"yeoman-generator": "^0.21.1",
|
||||
"chalk": "^1.0.0",
|
||||
"yosay": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"yeoman-assert": "2.0.0",
|
||||
"eslint": "1.10.3",
|
||||
"eslint-config-openstack": "1.2.4",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-exclude-gitignore": "1.0.0",
|
||||
"gulp-istanbul": "0.10.3",
|
||||
"gulp-mocha": "2.0.0",
|
||||
"gulp-plumber": "1.0.0",
|
||||
"gulp-nsp": "2.1.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "openstack"
|
||||
},
|
||||
"repository": "https://github.com/krotscheck/generator-openstack"
|
||||
}
|
||||
|
||||
21
test/app.js
Normal file
21
test/app.js
Normal file
@@ -0,0 +1,21 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var assert = require('yeoman-assert');
|
||||
var helpers = require('yeoman-generator').test;
|
||||
|
||||
describe('generator-openstack:app', function () {
|
||||
before(function (done) {
|
||||
helpers.run(path.join(__dirname, '../generators/app'))
|
||||
.withOptions({someOption: true})
|
||||
.withPrompts({someAnswer: true})
|
||||
.on('end', done);
|
||||
});
|
||||
|
||||
it('creates files', function () {
|
||||
assert.file([
|
||||
'dummyfile.txt'
|
||||
]);
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user