Skip to content
This repository has been archived by the owner on Jul 25, 2019. It is now read-only.

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Feb 28, 2013
0 parents commit 5865dad
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# editorconfig.org
root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
app/templates
21 changes: 21 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"node": true,
"es5": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true
}
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- 0.8
51 changes: 51 additions & 0 deletions app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
'use strict';

var Generator = module.exports = function () {
var cb = this.async();
var url = 'https://github.com/h5bp/html5-boilerplate/archive/v4.1.0.tar.gz';
var ignores = [
'.git',
'CHANGELOG.md',
'CONTRIBUTING.md',
'LICENSE.md',
'README.md'
];

this.prompt([{
name: 'docs',
message: 'Would you like docs included?',
default: 'y/N'
}], function (err, props) {
if (err) {
return this.emit('error', err);
}

this.tarball(url, this.sourceRoot(), function () {
if (!/n/i.test(props.docs)) {
this.directory('doc');
}

this.directory('css');
this.directory('img');
this.directory('js');
this.expandFiles('*', {
cwd: this.sourceRoot(),
dot: true
}).forEach(function (el) {
if (/n/i.test(props.docs)) {
if (ignores.indexOf(el) === -1) {
this.copy(el, el);
}
} else {
if (el !== '.git') {
this.copy(el, el);
}
}
}, this);

cb();
}.bind(this));
}.bind(this));
};

Generator.name = 'HTML5 Boilerplate';
40 changes: 40 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "generator-h5bp",
"version": "0.1.0",
"description": "HTML5 Boilerplate generator",
"keywords": [
"yeoman-generator",
"html",
"boilerplate",
"template"
],
"homepage": "https://github.com/sindresorhus/generator-h5bp",
"bugs": "https://github.com/sindresorhus/generator-h5bp/issues",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"main": "app/index.js",
"repository": {
"type": "git",
"url": "git://github.com/sindresorhus/generator-h5bp.git"
},
"scripts": {
"test": "mocha test/test-*.js"
},
"dependencies": {
"yeoman-generator": "~0.10.2"
},
"devDependencies": {
"mocha": "~1.8.1"
},
"engines": {
"node": ">=0.8.0"
},
"licenses": [
{
"type": "MIT"
}
]
}
16 changes: 16 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# HTML5 Boilerplate generator [![Build Status](https://secure.travis-ci.org/sindresorhus/generator-h5bp.png?branch=master)](http://travis-ci.org/sindresorhus/generator-h5bp)

Scaffolds out [HTML5 Boilerplate](http://html5boilerplate.com)


## Getting started

- Make sure you have [yo](https://github.com/yeoman/yo) installed: `npm install -g yo`
- Install the generator locally: `npm install generator-h5bp`
- Run: `yo h5bp`


## License

[MIT License](http://en.wikipedia.org/wiki/MIT_License)
(c) [Sindre Sorhus](http://sindresorhus.com)
33 changes: 33 additions & 0 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*global describe beforeEach it */
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;

describe('H5BP generator', function () {
beforeEach(function(cb) {
var deps = ['../../app', [helpers.createDummyGenerator(), 'h5bp:app']];

helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
return cb(err);
}

this.h5bp = helpers.createGenerator('h5bp:app', deps);
cb();
}.bind(this));
});

it('generates expected files', function (cb) {
var expected = ['index.html', 'README.md'];

helpers.mockPrompt(this.h5bp, { docs: 'y' });

this.h5bp.sourceRoot(path.join(__dirname, 'temp'));

this.h5bp.run({}, function () {
// TODO: figure out why this doesn't work
//helpers.assertFiles(expected);
cb();
});
});
});

0 comments on commit 5865dad

Please sign in to comment.