├── .gitignore
├── node-cli
├── _gitignore
├── _travis.yml
├── _jshintrc
├── _editorconfig
├── src
│ └── index.js
├── CONTRIBUTING.md
├── bin
│ └── index.js
├── test
│ └── index.js
├── package.json
├── LICENSE.md
└── README.md
├── logo.png
├── CONTRIBUTING.md
├── package.json
├── LICENSE.md
├── slushfile.js
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 |
--------------------------------------------------------------------------------
/node-cli/_gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/afonsopacifer/slush-node-cli/HEAD/logo.png
--------------------------------------------------------------------------------
/node-cli/_travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - stable
4 | script:
5 | - "npm test"
6 |
--------------------------------------------------------------------------------
/node-cli/_jshintrc:
--------------------------------------------------------------------------------
1 | {
2 | "undef": true,
3 | "unused": true,
4 | "eqeqeq": true,
5 | "indent": 2,
6 | "newcap": true,
7 | "curly": true
8 | }
9 |
--------------------------------------------------------------------------------
/node-cli/_editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig helps developers define and maintain consistent
2 | # coding styles between different editors and IDEs
3 | # http://editorconfig.org
4 |
5 | root = true
6 |
7 | [*]
8 | indent_style = space
9 | indent_size = 2
10 | end_of_line = lf
11 | charset = utf-8
12 | trim_trailing_whitespace = true
13 | insert_final_newline = true
14 |
--------------------------------------------------------------------------------
/node-cli/src/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | function example() {
4 |
5 | this.exampleTask1 = function() {
6 | console.log("Taks 1 done");
7 | return "Taks 1 done";
8 | };
9 |
10 | this.exampleTask2 = function() {
11 | console.log("Taks 2 done");
12 | return "Taks 2 done";
13 | };
14 |
15 | }
16 |
17 | module.exports = new example();
18 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ##Contributing
2 |
3 | *1 - Fork it!*
4 |
5 | *2 - Clone*
6 |
7 | *3 - Create your feature branch:*
8 | ```sh
9 | $ git checkout -b my-new-feature
10 | ```
11 | *4 - Commit your changes:*
12 | ```sh
13 | $ git commit -m 'Add some feature'
14 | ```
15 | *5 - Push to the branch:*
16 | ```sh
17 | $ git push origin my-new-feature
18 | ```
19 | *6 - Submit a pull request*
20 |
--------------------------------------------------------------------------------
/node-cli/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ##Contributing
2 |
3 | *1 - Fork it!*
4 |
5 | *2 - Clone*
6 |
7 | *3 - Create your feature branch:*
8 | ```sh
9 | $ git checkout -b my-new-feature
10 | ```
11 | *4 - Commit your changes:*
12 | ```sh
13 | $ git commit -m 'Add some feature'
14 | ```
15 | *5 - Push to the branch:*
16 | ```sh
17 | $ git push origin my-new-feature
18 | ```
19 | *6 - Submit a pull request*
20 |
--------------------------------------------------------------------------------
/node-cli/bin/index.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 |
3 | var example = require('../src/index.js'),
4 | program = require('commander'),
5 | pkg = require('../package.json');
6 |
7 | program
8 | .version(pkg.version)
9 | .description(pkg.description)
10 | .option('-x, --xOption', "Option X example")
11 | .option('-y, --yOption', "Option Y example");
12 |
13 | program.parse(process.argv);
14 |
15 | if (program.xOption) example.exampleTask1();
16 | if (program.yOption) example.exampleTask2();
17 |
--------------------------------------------------------------------------------
/node-cli/test/index.js:
--------------------------------------------------------------------------------
1 | var assert = require('assert'),
2 | example = require('../src/index.js');
3 |
4 | describe('example', function(){
5 |
6 | it('should return a text for first Task', function(){
7 | var result = example.exampleTask1(),
8 | expect = "Taks 1 done";
9 | assert.equal(result, expect);
10 | });
11 |
12 | it('should return a text for seconds Task', function(){
13 | var result = example.exampleTask2(),
14 | expect = "Taks 2 done";
15 | assert.equal(result, expect);
16 | });
17 |
18 | });
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "slush-node-cli",
3 | "version": "0.1.0",
4 | "description": "A slush generator for Nodejs CLI programs.",
5 | "main": "slushfile.js",
6 | "keywords": [
7 | "slushgenerator"
8 | ],
9 | "dependencies": {
10 | "gulp": "~3.9.1",
11 | "gulp-template": "~4.0.0",
12 | "gulp-install": "~0.6.0",
13 | "gulp-conflict": "~0.4.0",
14 | "gulp-rename": "~1.2.2",
15 | "underscore.string": "~3.3.4",
16 | "inquirer": "~1.1.1"
17 | },
18 | "author": {
19 | "name": "Afonso Pacifer",
20 | "email": "afonsopacifer@live.com",
21 | "url": "http://afonsopacifer.com"
22 | },
23 | "license": "MIT"
24 | }
25 |
--------------------------------------------------------------------------------
/node-cli/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "<%= appNameSlug %>",
3 | "description": "<%= appDescription %>",
4 | "version": "<%= appVersion %>",
5 | "author": {
6 | "name": "<%= appAuthor %>",
7 | "email": "<%= appEmail %>"
8 | },
9 | "bugs": {
10 | "url": "https://github.com/<%= appAuthor %>/<%= appNameSlug %>/issues"
11 | },
12 | "repository": {
13 | "type": "git",
14 | "url": "https://github.com/<%= appAuthor %>/<%= appNameSlug %>"
15 | },
16 | "keywords": [
17 | ],
18 | "preferGlobal": true,
19 | "main": "src/index.js",
20 | "bin": {
21 | "<%= appNameSlug %>": "bin/index.js"
22 | },
23 | "dependencies": {
24 | "commander": "^2.9.0"
25 | },
26 | "scripts": {
27 | "test": "mocha"
28 | },
29 | "devDependencies": {
30 | "jshint": "^2.8.0",
31 | "mocha": "^2.2.3"
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/node-cli/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 <%= appAuthor %> - <%= appEmail %>
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) 2016 Afonso Pacifer, [afonsopacifer.com](http://afonsopacifer.com/)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/node-cli/README.md:
--------------------------------------------------------------------------------
1 | # <%= appNameSlug %>
2 |
3 | > <%= appDescription %>
4 |
5 | install your CLI locally:
6 |
7 | ```sh
8 | $ [sudo] npm link
9 | ```
10 |
11 | Run:
12 |
13 | ```sh
14 | $ <%= appNameSlug %>
15 | ```
16 |
17 | ```sh
18 | $ <%= appNameSlug %> -x
19 | ```
20 |
21 | ```sh
22 | $ <%= appNameSlug %> -y
23 | ```
24 |
25 | Run unit tests with mocha:
26 |
27 | ```sh
28 | $ npm test
29 | ```
30 |
31 | Publish:
32 |
33 | ```sh
34 | $ npm punlish
35 | ```
36 |
37 | ## Versioning
38 |
39 | To keep better organization of releases we follow the [Semantic Versioning 2.0.0](http://semver.org/) guidelines.
40 |
41 | ## Contributing
42 |
43 | Find on our [issues](https://github.com/<%= appAuthor %>/<%= appNameSlug %>/issues/) the next steps of the project ;)
44 |
45 | Want to contribute? [Follow these recommendations](https://github.com/<%= appAuthor %>/<%= appNameSlug %>/blob/master/CONTRIBUTING.md).
46 |
47 | ## History
48 |
49 | See [Releases](https://github.com/<%= appAuthor %>/<%= appNameSlug %>/releases) for detailed changelog.
50 |
51 | ## License
52 |
53 | [MIT License](https://github.com/<%= appAuthor %>/<%= appNameSlug %>/blob/master/LICENSE.md) © [Afonso Pacifer](http://<%= appAuthor %>.com/)
54 |
--------------------------------------------------------------------------------
/slushfile.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | var gulp = require('gulp'),
4 | install = require('gulp-install'),
5 | conflict = require('gulp-conflict'),
6 | template = require('gulp-template'),
7 | rename = require('gulp-rename'),
8 | _ = require('underscore.string'),
9 | inquirer = require('inquirer');
10 |
11 | gulp.task('default', function(done) {
12 |
13 | //Answers
14 | var prompts = [{
15 | name: 'appName',
16 | message: 'What the name of program?'
17 | }, {
18 | name: 'appDescription',
19 | message: 'What the description?'
20 | }, {
21 | name: 'appVersion',
22 | message: 'What the version?',
23 | default: '0.1.0'
24 | }, {
25 | name: 'appAuthor',
26 | message: 'Name of author?'
27 | }, {
28 | name: 'appEmail',
29 | message: 'Author e-mail?'
30 | }];
31 |
32 | //Ask
33 | inquirer.prompt(prompts,
34 | function(answers) {
35 | if (!answers.appName) {
36 | return done();
37 | }
38 | answers.appNameSlug = _.slugify(answers.appName)
39 | answers.appAuthorSlug = _.slugify(answers.appAuthor)
40 | gulp.src(__dirname + '/node-cli/**')
41 | .pipe(template(answers))
42 | .pipe(rename(function(file) {
43 | if (file.basename[0] === '_') {
44 | file.basename = '.' + file.basename.slice(1);
45 | }
46 | }))
47 | .pipe(conflict('./'))
48 | .pipe(gulp.dest('./'))
49 | .pipe(install())
50 | .on('end', function() {
51 | done();
52 | });
53 | });
54 | });
55 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | [](https://david-dm.org/afonsopacifer/slush-node-cli)
4 |
5 | # Slush Node CLI
6 |
7 | > A slush generator for Nodejs CLI programs.
8 |
9 | ## How to install and use the generator?
10 |
11 | Install the slush:
12 |
13 | ```sh
14 | $ [sudo] npm install -g slush
15 | ```
16 |
17 | Install the node-cli generator:
18 |
19 | ```sh
20 | $ [sudo] npm install -g slush-node-cli
21 | ```
22 |
23 | Use the generator:
24 |
25 | ```sh
26 | $ mkdir myProgram
27 | $ cd myProgram
28 | $ slush node-cli
29 | ```
30 |
31 | ## The generated program
32 |
33 | Stack based in NodeJS:
34 |
35 | - Generator: [Slush](http://slushjs.github.io/#/)
36 | - Test Framework: [Mocha]()
37 | - Continuous integrations:[TravisCI]()
38 | - Code Quality: [JSHint]()
39 |
40 | Folders Structure:
41 |
42 | .
43 | ├── README.md
44 | ├── LICENSE.md
45 | ├── CONTRIBUTING.md
46 | ├── bin/
47 | | └── index.js
48 | ├── src/
49 | | └── index.js
50 | ├── tests/
51 | | └── index.js
52 | ├── package.json
53 | ├── .editorconfig
54 | ├── .jshintrc
55 | ├── .travis.yml
56 | └── .gitignore
57 |
58 | Automatic Tasks:
59 |
60 | - `$ npm test`: Run unit tests with mocha.
61 |
62 | ## Versioning
63 |
64 | To keep better organization of releases we follow the [Semantic Versioning 2.0.0](http://semver.org/) guidelines.
65 |
66 | ## Contributing
67 |
68 | Find on our [issues](https://github.com/afonsopacifer/slush-node-cli/issues/) the next steps of the project ;)
69 |
70 | Want to contribute? [Follow these recommendations](https://github.com/afonsopacifer/slush-node-cli/blob/master/CONTRIBUTING.md).
71 |
72 | ## History
73 |
74 | See [Releases](https://github.com/afonsopacifer/slush-node-cli/releases) for detailed changelog.
75 |
76 | ## License
77 |
78 | [MIT License](https://github.com/afonsopacifer/slush-node-cli/blob/master/LICENSE.md) © [Afonso Pacifer](http://afonsopacifer.com/)
79 |
--------------------------------------------------------------------------------