Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
use the latest yeoman-generator API
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jan 20, 2015
1 parent afa3f8c commit 922124c
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 61 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
@@ -1,4 +1,3 @@
# editorconfig.org
root = true

[*]
Expand All @@ -8,5 +7,9 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
11 changes: 2 additions & 9 deletions .jshintrc
Expand Up @@ -4,17 +4,10 @@
"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
"unused": "vars",
"strict": true
}
1 change: 0 additions & 1 deletion .travis.yml
@@ -1,4 +1,3 @@
language: node_js
node_js:
- '0.10'
- '0.8'
49 changes: 25 additions & 24 deletions app/index.js
@@ -1,31 +1,32 @@
'use strict';
var path = require('path');
var chalk = require('chalk');
var yeoman = require('yeoman-generator');

var Generator = module.exports = function () {
var cb = this.async();
var self = this;
module.exports = yeoman.generators.Base.extend({
init: function () {
var cb = this.async();
var self = this;

self.prompt([{
type: 'checkbox',
name: 'modules',
message: 'What would you like?\n' + chalk.gray('Generates to a `pure` subfolder'),
choices:[
'Buttons',
'Forms',
'Grids',
'Menus',
'Tables'
]
}], function (data) {
var pattern = path.join('src', '{' + data.modules.join(',') + ',}', 'css', '*.css');
self.prompt([{
type: 'checkbox',
name: 'modules',
message: 'What would you like?\n' + chalk.gray('Generates to a `pure` subfolder'),
choices:[
'Buttons',
'Forms',
'Grids',
'Menus',
'Tables'
]
}], function (data) {
var pattern = path.join('src', '{' + data.modules.join(',') + ',}', 'css', '*.css');

self.expandFiles(pattern, {cwd: self.sourceRoot(), nocase: true}).forEach(function (el) {
self.copy(el, path.join('pure', path.basename(el)));
});

cb();
});
};
self.expandFiles(pattern, {cwd: self.sourceRoot(), nocase: true}).forEach(function (el) {
self.copy(el, path.join('pure', path.basename(el)));
});

Generator.name = 'YUI Pure';
cb();
});
}
});
21 changes: 21 additions & 0 deletions license
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
26 changes: 7 additions & 19 deletions package.json
Expand Up @@ -9,39 +9,27 @@
"template",
"framework"
],
"homepage": "https://github.com/sindresorhus/generator-pure",
"bugs": "https://github.com/sindresorhus/generator-pure/issues",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
"url": "sindresorhus.com"
},
"main": "app/index.js",
"repository": {
"type": "git",
"url": "git://github.com/sindresorhus/generator-pure.git"
},
"repository": "sindresorhus/generator-pure",
"scripts": {
"test": "mocha"
},
"dependencies": {
"yeoman-generator": "~0.13.4",
"chalk": "~0.2.1"
},
"peerDependencies": {
"yo": ">=1.0.0-rc.1.1"
"chalk": "^0.5.1",
"yeoman-generator": "^0.18.6"
},
"devDependencies": {
"mocha": "~1.13.0"
"mocha": "*"
},
"engines": {
"node": ">=0.8.0"
"node": ">=0.10.0"
},
"licenses": [
{
"type": "MIT"
}
],
"license": "MIT",
"files": [
"app"
]
Expand Down
8 changes: 4 additions & 4 deletions readme.md
Expand Up @@ -2,12 +2,12 @@

> Scaffolds out [YUI Pure](https://github.com/yui/pure)
![screenshot](screenshot.png)
![](screenshot.png)


## Install

```bash
```
$ npm install --global generator-pure
```

Expand All @@ -16,11 +16,11 @@ $ npm install --global generator-pure

Run it with [yo](https://github.com/yeoman/yo):

```bash
```
$ yo pure
```


## License

[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](http://sindresorhus.com)
7 changes: 4 additions & 3 deletions test/test-file-creation.js → test/test.js
Expand Up @@ -9,7 +9,8 @@ describe('Pure generator', function () {

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

this.gen = helpers.createGenerator('pure:app', deps);
Expand All @@ -20,10 +21,10 @@ describe('Pure generator', function () {
it('generates expected files', function (cb) {
var expected = [path.join('pure', 'buttons.css')];

helpers.mockPrompt(this.gen, { modules: ['Buttons'] });
helpers.mockPrompt(this.gen, {modules: ['Buttons']});

this.gen.run({}, function () {
helpers.assertFiles(expected);
helpers.assertFile(expected);
cb();
});
});
Expand Down

0 comments on commit 922124c

Please sign in to comment.