Skip to content

Commit

Permalink
Basic yo generator.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir Galon committed Sep 4, 2016
0 parents commit 05fe792
Show file tree
Hide file tree
Showing 11 changed files with 262 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .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
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules
coverage
7 changes: 7 additions & 0 deletions .travis.yml
@@ -0,0 +1,7 @@
language: node_js
node_js:
- v6
- v5
- v4
- '0.12'
- '0.10'
15 changes: 15 additions & 0 deletions LICENSE
@@ -0,0 +1,15 @@
Copyright (c) 2016 Nir Galon <nirgn975@gmail.com> (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.
48 changes: 48 additions & 0 deletions 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
36 changes: 36 additions & 0 deletions 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();
}
});
Empty file.
62 changes: 62 additions & 0 deletions 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']);
62 changes: 62 additions & 0 deletions 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"
}
18 changes: 18 additions & 0 deletions 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'
]);
});
});

0 comments on commit 05fe792

Please sign in to comment.