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..9c2b94a --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +Copyright (c) 2016 Nir Galon (http://nirgn.com) + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all +copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..dbddfd2 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +# generator-jekyll-starter-kit [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url] +> Jekyll and Google web-starter-kit = best of both worlds + +## Installation + +First, install [Yeoman](http://yeoman.io) and generator-jekyll-starter-kit 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-jekyll-starter-kit +``` + +Then generate your new project: + +```bash +yo jekyll-starter-kit +``` + +## 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/). + +## Want to help? + +Great! Here is how you can install the local generator to test changes. + + 1. Git clone your fork locally. + 2. `npm install` inside the new directory. + 3. `npm link` - This makes your local system sync with the changes you make + 4. `mkdir app` + 5. Inside the new directory, initiate `yo jekyll-starter-kit` + +## License + +ISC © [Nir Galon](http://nirgn.com) + + +[npm-image]: https://badge.fury.io/js/generator-jekyll-starter-kit.svg +[npm-url]: https://npmjs.org/package/generator-jekyll-starter-kit +[travis-image]: https://travis-ci.org/nirgn975/generator-jekyll-starter-kit.svg?branch=master +[travis-url]: https://travis-ci.org/nirgn975/generator-jekyll-starter-kit +[daviddm-image]: https://david-dm.org/nirgn975/generator-jekyll-starter-kit.svg?theme=shields.io +[daviddm-url]: https://david-dm.org/nirgn975/generator-jekyll-starter-kit +[coveralls-image]: https://coveralls.io/repos/nirgn975/generator-jekyll-starter-kit/badge.svg +[coveralls-url]: https://coveralls.io/r/nirgn975/generator-jekyll-starter-kit diff --git a/generators/app/index.js b/generators/app/index.js new file mode 100644 index 0000000..6ca6fec --- /dev/null +++ b/generators/app/index.js @@ -0,0 +1,36 @@ +'use strict'; +var yeoman = require('yeoman-generator'); +var chalk = require('chalk'); +var yosay = require('yosay'); + +module.exports = yeoman.Base.extend({ + prompting: function () { + // Have Yeoman greet the user. + this.log(yosay( + 'Welcome to the kickass ' + chalk.red('generator-jekyll-starter-kit') + ' generator!' + )); + + var prompts = [{ + type: 'confirm', + name: 'someAnswer', + message: 'Would you like to enable this option?', + default: true + }]; + + return this.prompt(prompts).then(function (props) { + // To access props later use this.props.someAnswer; + this.props = props; + }.bind(this)); + }, + + writing: function () { + this.fs.copy( + this.templatePath('dummyfile.txt'), + this.destinationPath('dummyfile.txt') + ); + }, + + install: function () { + this.installDependencies(); + } +}); diff --git a/generators/app/templates/dummyfile.txt b/generators/app/templates/dummyfile.txt new file mode 100644 index 0000000..e69de29 diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..4840c9d --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,62 @@ +'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'); +var coveralls = require('gulp-coveralls'); + +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('coveralls', ['test'], function () { + if (!process.env.CI) { + return; + } + + return gulp.src(path.join(__dirname, 'coverage/lcov.info')) + .pipe(coveralls()); +}); + +gulp.task('prepublish', ['nsp']); +gulp.task('default', ['static', 'test', 'coveralls']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..3205d50 --- /dev/null +++ b/package.json @@ -0,0 +1,62 @@ +{ + "name": "generator-jekyll-starter-kit", + "version": "0.0.0", + "description": "Jekyll and Google web-starter-kit = best of both worlds", + "homepage": "https://github.com/nirgn975/jekyll-starter-kit", + "author": { + "name": "Nir Galon", + "email": "nirgn975@gmail.com", + "url": "http://nirgn.com" + }, + "files": [ + "generators" + ], + "main": "generators/index.js", + "keywords": [ + "Jekyll", + "Google Web Starter Kit", + "HTML5", + "Jade", + "CSS3", + "SASS", + "SCSS", + "JavaScript", + "jQuery", + "ES6", + "Gulp", + "Travis", + "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", + "gulp-coveralls": "^0.1.0" + }, + "eslintConfig": { + "extends": "xo-space", + "env": { + "mocha": true + } + }, + "repository": "nirgn975/generator-jekyll-starter-kit", + "scripts": { + "prepublish": "gulp prepublish", + "test": "gulp" + }, + "license": "ISC" +} diff --git a/test/app.js b/test/app.js new file mode 100644 index 0000000..47af664 --- /dev/null +++ b/test/app.js @@ -0,0 +1,18 @@ +'use strict'; +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-test'); + +describe('generator-jekyll-starter-kit:app', function () { + before(function () { + return helpers.run(path.join(__dirname, '../generators/app')) + .withPrompts({someAnswer: true}) + .toPromise(); + }); + + it('creates files', function () { + assert.file([ + 'dummyfile.txt' + ]); + }); +});