Skip to content

Commit

Permalink
Package and basic generator
Browse files Browse the repository at this point in the history
  • Loading branch information
logeshpaul committed Jan 25, 2015
1 parent 55cad04 commit bce96fa
Show file tree
Hide file tree
Showing 7 changed files with 175 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
17 changes: 17 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"node": true,
"esnext": true,
"bitwise": false,
"camelcase": true,
"curly": false,
"eqeqeq": true,
"immed": true,
"indent": 2,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true
}
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
contributing.md
.editorconfig
.gitattributes
.jshintrc
.npmignore
test
.travis.yml
coverage/
107 changes: 107 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
'use strict';
var generators = require('yeoman-generator');

var MyBase = generators.Base.extend({

// TODO
// [X] initializing
// [ ] prompting
// [ ] configuring
// [ ] default
// [ ] writing
// [ ] conflicts
// [ ] install
// [ ] end

init: function () {
console.log('Welcome to SMACSS!');
},

prompting: function () {
var done = this.async();

var prompts = [{
name: 'appname',
message: 'What would you like to name your app/site?',
default: 'New Project'
},{
name: 'apptype',
message: 'Kind of app/site you are trying to build?',
type: 'list',
choices:[{
name: 'Static HTML',
value: 'includeStaticApp',
checked: false
},{
name: 'Angular App',
value: 'includeAngularApp',
checked: false
},{
name: 'Ember App',
value: 'includeEmberApp',
checked: false
},{
name: 'Mobile App',
value: 'includeMobileApp',
checked: false
}],
default: 1 // default : this.appname // Default to current folder name
},{
name: 'appfeatures',
message: 'How about some additional features',
type: 'checkbox',
choices:[{
name: 'Modernizr',
value: 'includeModernizr',
checked: false
},{
name: 'jQuery',
value: 'includeQuery',
checked: false
},{
name: 'Respond',
value: 'includeRespond',
checked: false
}]
}];

this.prompt(prompts, function (props) {

var appName = props.appname;
var appType = props.apptype;
var appFeatures = props.appfeatures;

this.log("=============================== Creating project with following details ===============================")
this.log('App Name: ' + appName);
this.log('App Type: ' + appType);
this.log('App Features: ' + appFeatures);

done();
}.bind(this));
},

constructor: function () {
generators.Base.apply(this, arguments);

// This method adds support for a `--coffee` flag
this.option('coffee');
// And you can then access it later on this way; e.g.
this.scriptSuffix = (this.options.coffee ? ".coffee": ".js");
},

helper: function () {
console.log('won\'t be called');
},
errorHanding: function () {
this.log('Something has gone wrong!');
}
});

module.exports = MyBase.extend({
exec: function () {
//this.prompt("What?");
this.init();

this.prompting();
}
});
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "generator-smacss",
"version": "0.0.1",
"description": "Perfectionist Frontend Generator",
"author": "",
"license": "ISC",
"keywords": [
"yeoman-generator",
"scaffold",
"framework",
"mvc",
"smacss",
"web-generator"
],
"homepage": "https://github.com/yeoman/generator-backbone",
"bugs": "https://github.com/yeoman/generator-backbone/issues",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"yeoman-generator": "^0.17.3"
},
"repository": {
"type": "git",
"url": ""
},
"main": "index.js"
}

0 comments on commit bce96fa

Please sign in to comment.