From ce951f8819eb0b1f60ac35d2419b0f1c734ea1aa Mon Sep 17 00:00:00 2001 From: James Fleeting Date: Fri, 23 Sep 2016 12:20:41 -0500 Subject: [PATCH] Initial commit. --- .editorconfig | 11 ++++++++ .gitattributes | 1 + .gitignore | 2 ++ .travis.yml | 7 +++++ LICENSE | 21 +++++++++++++++ README.md | 45 ++++++++++++++++++++++++++++++++ generators/app/index.js | 58 +++++++++++++++++++++++++++++++++++++++++ gulpfile.js | 52 ++++++++++++++++++++++++++++++++++++ package.json | 50 +++++++++++++++++++++++++++++++++++ test/app.js | 21 +++++++++++++++ 10 files changed, 268 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 generators/app/index.js create mode 100644 gulpfile.js create mode 100644 package.json create mode 100644 test/app.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..beffa30 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ba2a97b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +coverage diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f2f84e8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - v6 + - v5 + - v4 + - '0.12' + - '0.10' diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a973e40 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Monkee-Boy (https://www.monkee-boy.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..cf685c0 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +![Monkee-Boy](https://dujrsrsgsd3nh.cloudfront.net/img/emoticons/113009/mboy-1403710932.jpg) generator-mboy-deploy [![npm version](https://img.shields.io/npm/v/generator-mboy-gulp.svg?style=flat-square)](http://badge.fury.io/js/generator-mboy-gulp) [![Build Status](https://img.shields.io/travis/Monkee-Boy/generator-mboy-gulp.svg?style=flat-square)](https://travis-ci.org/Monkee-Boy/generator-mboy-deploy) [![Test Coverage](https://img.shields.io/coveralls/Monkee-Boy/generator-mboy-gulp.svg?style=flat-square)](https://coveralls.io/r/Monkee-Boy/generator-mboy-gulp) + +> Generate the Monkee-Boy gulp setup. + +## Installation + +First, install [Yeoman](http://yeoman.io) and generator-mboy-gulp using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). + +```bash +npm install -g yo +npm install -g generator-mboy-gulp +``` + +Then generate your new project: + +```bash +yo mboy-gulp +``` + +## Getting To Know Yeoman + + * Yeoman has a heart of gold. + * Yeoman is a person with feelings and opinions, but is very easy to work with. + * Yeoman can be too opinionated at times but is easily convinced not to be. + * Feel free to [learn more about Yeoman](http://yeoman.io/). + +## Running Tests + +```bash +npm test +``` + +## The Dev Team + +Handcrafted with ♥ in Austin, Texas by the [Monkee-Boy Troop](http://www.monkee-boy.com/about/the-troop.php). + +[![James Fleeting](https://avatars0.githubusercontent.com/u/23062?s=144)](https://github.com/fleeting) | [![Pete Gautier](https://avatars2.githubusercontent.com/u/5394199?v=3&s=144)](https://github.com/pgautier404) | [![John Hoover](https://avatars3.githubusercontent.com/u/48278?v=3&s=144)](https://github.com/defvayne23) | [![David Saunders](https://avatars3.githubusercontent.com/u/4614981?v=3&s=144)](https://github.com/djsaun) +:---:|:---:|:---:|:---:|:---: +[James Fleeting](https://github.com/fleeting) | [Pete Gautier](https://github.com/pgautier404) | [John Hoover](https://github.com/defvayne23) | [David Saunders](https://github.com/djsaun) + +## License + +MIT © [Monkee-Boy](https://www.monkee-boy.com) + +![Monkee-Boy](http://assets.monkee-boy.com/mboy-logo-tagline.jpg) diff --git a/generators/app/index.js b/generators/app/index.js new file mode 100644 index 0000000..9f7ac1e --- /dev/null +++ b/generators/app/index.js @@ -0,0 +1,58 @@ +'use strict'; +var yeoman = require('yeoman-generator'); +var chalk = require('chalk'); +var yosay = require('yosay'); +var string = require('underscore.string'); + +module.exports = yeoman.Base.extend({ + prompting: function () { + this.log(['\n', + chalk.yellow(' ## ## ##### ## ## ## ## ####### ####### ##### ##### ## ##'), + chalk.yellow('### ### ####### ### ## ## ## ####### ####### ###### ####### ## ##'), + chalk.yellow('#### ### ## ## ### ## ## ## ## ## ## ## ## ## ## ##'), + chalk.yellow('#### #### ## ## #### ## #### ## ## ## ## ## ## ## ##'), + chalk.yellow('## #### ## ## ## ## ## ## #### ###### ###### #### ###### ## ## ####'), + chalk.yellow('## ## ## ## ## ## ## ## ##### ###### ###### #### ###### ## ## ##'), + chalk.yellow('## ## ## ## ## ## #### ## ### ## ## ## ## ## ## ##'), + chalk.yellow('## ## ## ## ## ### ## ## ## ## ## ## ## ## ##'), + chalk.yellow('## ## ####### ## ### ## ## ####### ####### ####### ####### ##'), + chalk.yellow('## ## ##### ## ## ## ### ####### ####### ###### ##### ##')].join('\n') + ); + + // Have Yeoman greet the user. + this.log(yosay( + 'Welcome to the ' + chalk.green('MBoy Gulp') + ' v1.0 generator!' + )); + + this.log('I am going to generate the default Monkee-Boy gulp setup. Reference https://github.com/Monkee-Boy/gulpfile for more details.\n\nFirst a couple of quick questions.\n'); + + this.remote('Monkee-Boy', 'gulpfile', function (err, remote) { + remote.directory('.', '.'); + }); + + var prompts = [ + { + name: 'projectName', + message: 'What would you like to call this project (typically client name)?', + default: 'Project Name' + }, { + name: 'repoUrl', + message: 'What is the git repo url for this project?', + default: 'git@bitbucket.org:monkeeboy/PROJECTREPONAME.git' + } + ]; + + return this.prompt(prompts).then(function (props) { + this.props = props; + this.props.projectName = string.slugify(props.projectName); + }.bind(this)); + }, + + writing: function () { + // this.template('package.json', 'package.json'); + }, + + install: function () { + this.log('\nYour gulp files and structure are ready.\n' + chalk.green('May the code be with you.')); + } +}); diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..e7b81d1 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,52 @@ +'use strict'; +var path = require('path'); +var gulp = require('gulp'); +var eslint = require('gulp-eslint'); +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('static', function () { + return gulp.src('**/*.js') + .pipe(excludeGitignore()) + .pipe(eslint()) + .pipe(eslint.format()) + .pipe(eslint.failAfterError()); +}); + +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', ['static', 'test']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..f502c16 --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "generator-mboy-gulp", + "version": "1.0.0", + "description": "Generate the Monkee-Boy gulp setup.", + "homepage": "https://github.com/Monkee-Boy/generator-mboy-gulp", + "author": { + "name": "James Fleeting", + "email": "james@monkee-boy.com", + "url": "https://www.monkee-boy.com" + }, + "files": [ + "generators" + ], + "main": "generators/index.js", + "keywords": [ + "", + "yeoman-generator" + ], + "dependencies": { + "yeoman-generator": "^0.23.0", + "chalk": "^1.0.0", + "yosay": "^1.0.0" + }, + "devDependencies": { + "yeoman-test": "^1.0.0", + "yeoman-assert": "^2.0.0", + "eslint": "^3.1.1", + "eslint-config-xo-space": "^0.14.0", + "gulp": "^3.9.0", + "gulp-eslint": "^2.0.0", + "gulp-exclude-gitignore": "^1.0.0", + "gulp-line-ending-corrector": "^1.0.1", + "gulp-istanbul": "^1.0.0", + "gulp-mocha": "^2.0.0", + "gulp-plumber": "^1.0.0", + "gulp-nsp": "^2.1.0" + }, + "eslintConfig": { + "extends": "xo-space", + "env": { + "mocha": true + } + }, + "repository": "Monkee-Boy/generator-mboy-gulp", + "scripts": { + "prepublish": "gulp prepublish", + "test": "gulp" + }, + "license": "MIT" +} diff --git a/test/app.js b/test/app.js new file mode 100644 index 0000000..1c23455 --- /dev/null +++ b/test/app.js @@ -0,0 +1,21 @@ +'use strict'; +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +var expected = [ + 'package.json', + 'gulpfile.js' +]; + +describe('generator-mboy-gulp:app', function () { + before(function () { + return helpers.run(path.join(__dirname, '../generators/app')) + .withPrompts({someAnswer: true}) + .toPromise(); + }); + + it('creates files', function () { + assert.file(expected); + }); +});