Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
radiodario committed Sep 24, 2013
0 parents commit a8ccb65
Show file tree
Hide file tree
Showing 17 changed files with 309 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
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
@@ -0,0 +1 @@
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
node_modules/
temp/
21 changes: 21 additions & 0 deletions .jshintrc
@@ -0,0 +1,21 @@
{
"node": 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,
"white": true
}
4 changes: 4 additions & 0 deletions .travis.yml
@@ -0,0 +1,4 @@
language: node_js
node_js:
- '0.8'
- '0.10'
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Copyright 2013 Dario

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.
47 changes: 47 additions & 0 deletions README.md
@@ -0,0 +1,47 @@
# generator-davteam [![Build Status](https://secure.travis-ci.org/radiodario/generator-davteam.png?branch=master)](https://travis-ci.org/radiodario/generator-davteam)

A generator for [Yeoman](http://yeoman.io).


## Getting Started

### What is Yeoman?

Trick question. It's not a thing. It's this guy:

![](http://i.imgur.com/JHaAlBJ.png)

Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.

Not every new computer comes with a Yeoman pre-installed. He lives in the [npm](https://npmjs.org) package repository. You only have to ask for him once, then he packs up and moves into your hard drive. *Make sure you clean up, he likes new and shiny things.*

```
$ npm install -g yo
```

### Yeoman Generators

Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.

To install generator-davteam from npm, run:

```
$ npm install -g generator-davteam
```

Finally, initiate the generator:

```
$ yo davteam
```

### Getting To Know Yeoman

Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced.

If you'd like to get to know Yeoman better and meet some of his friends, [Grunt](http://gruntjs.com) and [Bower](http://bower.io), check out the complete [Getting Started Guide](https://github.com/yeoman/yeoman/wiki/Getting-Started).


## License

[MIT License](http://en.wikipedia.org/wiki/MIT_License)
62 changes: 62 additions & 0 deletions app/index.js
@@ -0,0 +1,62 @@
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');


var DavteamGenerator = module.exports = function DavteamGenerator(args, options, config) {
yeoman.generators.Base.apply(this, arguments);

this.on('end', function () {
this.installDependencies({ skipInstall: options['skip-install'] });
});

this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};

util.inherits(DavteamGenerator, yeoman.generators.Base);

DavteamGenerator.prototype.askFor = function askFor() {
var cb = this.async();

// have Yeoman greet the user.
console.log(this.yeoman);

var prompts = [
{
name: 'projectName',
message: 'What do you want to call your poject?'
},
{
type: 'confirm',
name: 'someOption',
message: 'Would you like to enable this option?',
default: true
}];

this.prompt(prompts, function (props) {
this.someOption = props.someOption;

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

DavteamGenerator.prototype.app = function app() {
this.mkdir('app');
this.mkdir('app/templates');
this.mkdir('app/scripts');
this.mkdir('app/styles');
this.mkdir('app/img');

this.template('Gruntfile.js', 'Gruntfile.js');
this.tempalte('index.html', 'app/index.html');
this.template('_package.json', 'package.json');
this.template('_bower.json', 'bower.json');

this.copy('404.html', 'app/404.html');
};

DavteamGenerator.prototype.projectfiles = function projectfiles() {
this.copy('editorconfig', '.editorconfig');
this.copy('jshintrc', '.jshintrc');
};
Empty file added app/templates/Gruntfile.js
Empty file.
6 changes: 6 additions & 0 deletions app/templates/_bower.json
@@ -0,0 +1,6 @@
{
"name": "package",
"version": "0.0.0",
"dependencies": {}
}

5 changes: 5 additions & 0 deletions app/templates/_package.json
@@ -0,0 +1,5 @@
{
"name": "package",
"version": "0.0.0",
"dependencies": {}
}
13 changes: 13 additions & 0 deletions app/templates/editorconfig
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
21 changes: 21 additions & 0 deletions app/templates/jshintrc
@@ -0,0 +1,21 @@
{
"node": 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,
"white": true
}
4 changes: 4 additions & 0 deletions app/templates/travis.yml
@@ -0,0 +1,4 @@
language: node_js
node_js:
- '0.8'
- '0.10'
41 changes: 41 additions & 0 deletions package.json
@@ -0,0 +1,41 @@
{
"name": "generator-davteam",
"version": "0.0.0",
"description": "A generator for Yeoman",
"keywords": [
"yeoman-generator"
],
"homepage": "https://github.com/radiodario/generator-davteam",
"bugs": "https://github.com/radiodario/generator-davteam/issues",
"author": {
"name": "Dario",
"email": "dario@alolo.co",
"url": "https://github.com/radiodario"
},
"main": "app/index.js",
"repository": {
"type": "git",
"url": "git://github.com/radiodario/generator-davteam.git"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
"yeoman-generator": "~0.13.0"
},
"devDependencies": {
"mocha": "~1.12.0"
},
"peerDependencies": {
"yo": ">=1.0.0-rc.1"
},
"engines": {
"node": ">=0.8.0",
"npm": ">=1.2.10"
},
"licenses": [
{
"type": "MIT"
}
]
}
38 changes: 38 additions & 0 deletions test/test-creation.js
@@ -0,0 +1,38 @@
/*global describe, beforeEach, it*/
'use strict';

var path = require('path');
var helpers = require('yeoman-generator').test;


describe('davteam generator', function () {
beforeEach(function (done) {
helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
return done(err);
}

this.app = helpers.createGenerator('davteam:app', [
'../../app'
]);
done();
}.bind(this));
});

it('creates expected files', function (done) {
var expected = [
// add files you expect to exist here.
'.jshintrc',
'.editorconfig'
];

helpers.mockPrompt(this.app, {
'someOption': true
});
this.app.options['skip-install'] = true;
this.app.run({}, function () {
helpers.assertFiles(expected);
done();
});
});
});
11 changes: 11 additions & 0 deletions test/test-load.js
@@ -0,0 +1,11 @@
/*global describe, beforeEach, it*/
'use strict';

var assert = require('assert');

describe('davteam generator', function () {
it('can be imported without blowing up', function () {
var app = require('../app');
assert(app !== undefined);
});
});

0 comments on commit a8ccb65

Please sign in to comment.