-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added subgenerator 'service' for bootstrapping 'microservice-base'
- Loading branch information
Martin Hecher
committed
Feb 4, 2015
1 parent
24d8a87
commit 9387b35
Showing
17 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"node": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"camelcase": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"immed": true, | ||
"indent": 2, | ||
"latedef": true, | ||
"newcap": true, | ||
"noarg": true, | ||
"quotmark": "single", | ||
"undef": true, | ||
"unused": true, | ||
"strict": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
before_install: | ||
- currentfolder=${PWD##*/} | ||
- if [ "$currentfolder" != 'generator-duraark' ]; then cd .. && eval "mv $currentfolder generator-duraark" && cd generator-duraark; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"generator-generator": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# generator-duraark | ||
|
||
CLI to bootstrap (micro)services and UIs for the DURAARK platform. It can also be used outside the DURAARK project, as it provides very generic blueprints for services and UIs. | ||
|
||
The generator is based on [Yeoman](http://yeoman.io). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
var yeoman = require('yeoman-generator'); | ||
var chalk = require('chalk'); | ||
var yosay = require('yosay'); | ||
|
||
module.exports = yeoman.generators.Base.extend({ | ||
initializing: function () { | ||
this.pkg = require('../package.json'); | ||
}, | ||
|
||
prompting: function () { | ||
var done = this.async(); | ||
|
||
// Have Yeoman greet the user. | ||
this.log(yosay( | ||
'Welcome to the super-excellent' + chalk.red('Duraark') + ' generator!' | ||
)); | ||
|
||
var prompts = [{ | ||
type: 'confirm', | ||
name: 'someOption', | ||
message: 'Would you like to enable this option?', | ||
default: true | ||
}]; | ||
|
||
this.prompt(prompts, function (props) { | ||
this.someOption = props.someOption; | ||
|
||
done(); | ||
}.bind(this)); | ||
}, | ||
|
||
writing: { | ||
app: function () { | ||
this.fs.copy( | ||
this.templatePath('_package.json'), | ||
this.destinationPath('package.json') | ||
); | ||
this.fs.copy( | ||
this.templatePath('_bower.json'), | ||
this.destinationPath('bower.json') | ||
); | ||
}, | ||
|
||
projectfiles: function () { | ||
this.fs.copy( | ||
this.templatePath('editorconfig'), | ||
this.destinationPath('.editorconfig') | ||
); | ||
this.fs.copy( | ||
this.templatePath('jshintrc'), | ||
this.destinationPath('.jshintrc') | ||
); | ||
} | ||
}, | ||
|
||
install: function () { | ||
this.installDependencies({ | ||
skipInstall: this.options['skip-install'] | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "package", | ||
"version": "0.0.0", | ||
"dependencies": {} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "package", | ||
"version": "0.0.0", | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"node": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"camelcase": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"immed": true, | ||
"indent": 2, | ||
"latedef": true, | ||
"newcap": true, | ||
"noarg": true, | ||
"quotmark": "single", | ||
"undef": true, | ||
"unused": true, | ||
"strict": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "generator-duraark", | ||
"version": "0.1.0", | ||
"description": "CLI for developing duraark services and UIs", | ||
"license": "MIT", | ||
"main": "app/index.js", | ||
"repository": "duraark/generator-duraark", | ||
"author": { | ||
"name": "Martin Hecher", | ||
"email": "[email protected]", | ||
"url": "https://github.com/duraark" | ||
}, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"files": [ | ||
"app", | ||
"service" | ||
], | ||
"keywords": [ | ||
"yeoman-generator" | ||
], | ||
"dependencies": { | ||
"yeoman-generator": "^0.18.0", | ||
"chalk": "^0.5.0", | ||
"yosay": "^0.3.0", | ||
"duraark-microservice-base": "^0.2.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
}, | ||
"peerDependencies": { | ||
"yo": ">=1.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
'use strict'; | ||
var yeoman = require('yeoman-generator'), | ||
path = require('path'); | ||
|
||
module.exports = yeoman.generators.NamedBase.extend({ | ||
initializing: function() { | ||
this.log('You called the Duraark subgenerator with the argument ' + this.name + '.'); | ||
|
||
// this.argument('name', { | ||
// required: true, | ||
// type: String, | ||
// desc: 'The subgenerator name' | ||
// }); | ||
|
||
this.bootstrapRoot = this.destinationRoot(); | ||
}, | ||
|
||
writing: function() { | ||
var templateRoot = path.join(__dirname, '..', 'node_modules', 'duraark-microservice-base', 'src') + '/**', | ||
deploymentScriptsRoot = path.join(__dirname, '..', 'node_modules', 'duraark-microservice-base', 'deployment') + '/**', | ||
developmentScriptsRoot = path.join(__dirname, '..', 'node_modules', 'duraark-microservice-base', 'src', 'scripts') + '/**'; | ||
|
||
console.log('Copying template files from "' + templateRoot + '" to "' + this.bootstrapRoot + '"'); | ||
|
||
this.fs.copy( | ||
templateRoot, | ||
this.bootstrapRoot | ||
); | ||
|
||
var deploymentTarget = this.bootstrapRoot + '/deployment'; | ||
|
||
console.log('Copying deployment scripts from "' + deploymentScriptsRoot + '" to "' + deploymentTarget + '"'); | ||
|
||
this.fs.copy( | ||
deploymentScriptsRoot, | ||
deploymentTarget | ||
); | ||
|
||
var serviceInfoPath = path.join(deploymentTarget, 'service-info.txt'); | ||
|
||
console.log('Configuring deployment scripts ...'); | ||
|
||
this.write(serviceInfoPath, this.name); | ||
|
||
var developmentTarget = this.bootstrapRoot + '/scripts'; | ||
|
||
console.log('Copying development scripts from "' + developmentScriptsRoot + '" to "' + developmentTarget + '"'); | ||
|
||
this.fs.copy( | ||
developmentScriptsRoot, | ||
developmentTarget | ||
); | ||
|
||
console.log('Configuring development scripts ...'); | ||
|
||
serviceInfoPath = path.join(developmentTarget, 'service-info.txt'); | ||
|
||
this.write(serviceInfoPath, this.name); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// This is a file copied by your subgenerator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var assert = require('yeoman-generator').assert; | ||
var helpers = require('yeoman-generator').test; | ||
var os = require('os'); | ||
|
||
describe('duraark:app', function () { | ||
before(function (done) { | ||
helpers.run(path.join(__dirname, '../app')) | ||
.inDir(path.join(os.tmpdir(), './temp-test')) | ||
.withOptions({ 'skip-install': true }) | ||
.withPrompt({ | ||
someOption: true | ||
}) | ||
.on('end', done); | ||
}); | ||
|
||
it('creates files', function () { | ||
assert.file([ | ||
'bower.json', | ||
'package.json', | ||
'.editorconfig', | ||
'.jshintrc' | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var assert = require('yeoman-generator').assert; | ||
var helpers = require('yeoman-generator').test; | ||
|
||
describe('Duraark:service', function () { | ||
before(function (done) { | ||
helpers.run(path.join(__dirname, '../service')) | ||
.withArguments('name', '--force') | ||
.withOptions({ 'skip-install': true }) | ||
.on('end', done); | ||
}); | ||
|
||
it('creates files', function () { | ||
assert.file([ | ||
'somefile.js' | ||
]); | ||
}); | ||
}); |