diff options
| author | yo mama <pepper@scannerjammer.com> | 2014-12-02 21:31:51 -0800 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2014-12-02 21:31:51 -0800 |
| commit | cc4f8980980809927e61a00cf7b8d727618ea067 (patch) | |
| tree | 1a340ba30d799b08ffcffe356adbfa2cb12e4654 /app | |
first
Diffstat (limited to 'app')
| -rw-r--r-- | app/index.js | 93 | ||||
| -rw-r--r-- | app/templates/_bower.json | 7 | ||||
| -rw-r--r-- | app/templates/_package.json | 6 | ||||
| -rw-r--r-- | app/templates/jshintrc | 21 | ||||
| -rw-r--r-- | app/templates/templates/Gruntfile.js | 85 | ||||
| -rw-r--r-- | app/templates/templates/_bower.json | 9 | ||||
| -rw-r--r-- | app/templates/templates/_package.json | 15 | ||||
| -rw-r--r-- | app/templates/templates/app.amd.js | 9 | ||||
| -rw-r--r-- | app/templates/templates/app.css | 0 | ||||
| -rw-r--r-- | app/templates/templates/app.js | 11 | ||||
| -rw-r--r-- | app/templates/templates/app.styl | 3 | ||||
| -rw-r--r-- | app/templates/templates/config.js | 6 | ||||
| -rw-r--r-- | app/templates/templates/gitignore | 4 | ||||
| -rw-r--r-- | app/templates/templates/index.html | 35 | ||||
| -rw-r--r-- | app/templates/templates/jshintrc | 65 | ||||
| -rw-r--r-- | app/templates/vimproject.config | 0 |
16 files changed, 369 insertions, 0 deletions
diff --git a/app/index.js b/app/index.js new file mode 100644 index 0000000..d9074fe --- /dev/null +++ b/app/index.js @@ -0,0 +1,93 @@ +'use strict'; +var util = require('util'); +var path = require('path'); +var yeoman = require('yeoman-generator'); +var yosay = require('yosay'); + +var UnsemanticExpressGenerator = yeoman.generators.Base.extend({ + initializing: function () { + this.pkg = require('../package.json'); + this.ascii_art = require('../ascii_art'); + }, + + prompting: function () { + var done = this.async(); + var prompts = [{ + name: 'siteName', + message: 'What is the title of this Web site?', + default: '' + }, { + name: 'siteDescription', + message: 'What is the description of this Web site?', + default: '' + }, { + type: 'confirm', + name: 'vim', + message: 'Are you using vim?', + default: true + }, { + name: 'features', + message: 'What frameworks will it use?', + type: 'checkbox', + choices: [{ + name: 'jQuery', + value: 'jquery', + checked: false + }, { + name: 'Stylus CSS preprocessor', + value: 'preprocess', + checked: false + }, { + name: 'AMD via Require.js', + value: 'amd', + checked: false + }] + }]; + + // Have Yeoman greet the user. + this.ascii_art(); + this.log(yosay( + 'Welcome to the prime UnsemanticExpress generator!' + )); + + this.prompt(prompts, function (props) { + this.jQuery = props.jQuery; + this.vim = props.vim; + this.siteName = props.siteName; + this.siteDescription = props.siteDescription; + done(); + }.bind(this)); + }, + + writing: { + app: function () { + this.dest.mkdir('app'); + this.dest.mkdir('app/templates'); + + this.template('_package.json', 'package.json'); + this.template('_bower.json', 'bower.json'); + }, + + projectfiles: function () { + this.src.copy('vimproject.config', 'vimproject.config'); + this.src.copy('jshintrc', '.jshintrc'); + } + }, + installingExpress: function() { + if (this.jQuery){ +// var done = this.async(); + this.npmInstall(['express'], { 'saveDev': true }); +// this.npmInstall(['express'], { 'saveDev': true }, done); + } + }, + installingUnsemantic: function() { + if (! this.jQuery){ + this.bowerInstall(['unsemantic'], { 'saveDev': true }); + } + }, + end: function () { + this.installDependencies(); + } +}); + +module.exports = UnsemanticExpressGenerator; diff --git a/app/templates/_bower.json b/app/templates/_bower.json new file mode 100644 index 0000000..a39de3e --- /dev/null +++ b/app/templates/_bower.json @@ -0,0 +1,7 @@ +{ + "name": "<%= _.slugify(siteName) %>", + "description": "<%= siteDescription %>", + "version": "0.0.0", + "dependencies": { + } +} diff --git a/app/templates/_package.json b/app/templates/_package.json new file mode 100644 index 0000000..ea68338 --- /dev/null +++ b/app/templates/_package.json @@ -0,0 +1,6 @@ +{ + "name": "<%= _.slugify(siteName) %>", + "description": "<%= siteDescription %>", + "private": true, + "devDependencies": {} +} diff --git a/app/templates/jshintrc b/app/templates/jshintrc new file mode 100644 index 0000000..0cd291c --- /dev/null +++ b/app/templates/jshintrc @@ -0,0 +1,21 @@ +{ + "node": true, + "esnext": true, + "bitwise": true, + "camelcase": true, + "curly": true, + "eqeqeq": true, + "immed": true, + "indent": 2, + "latedef": true, + "newcap": true, + "noarg": true, + "quotmark": "single", + "regexp": true, + "undef": true, + "unused": true, + "strict": true, + "trailing": true, + "smarttabs": true, + "white": true +} diff --git a/app/templates/templates/Gruntfile.js b/app/templates/templates/Gruntfile.js new file mode 100644 index 0000000..56db414 --- /dev/null +++ b/app/templates/templates/Gruntfile.js @@ -0,0 +1,85 @@ +module.exports = function(grunt) { + grunt.initConfig({<% if (amd) { %> + requirejs: { + compile: { + options: { + baseUrl: '.', + name: 'app', + mainConfigFile: 'js/config.js', + out: 'js/app.min.js' + } + } + },<% } else { %> + concat: { + js: { + src: [<% if (jquery) { %> + 'bower_components/jquery/jquery.js',<% } %> + 'js/app.js' + ], + dest: 'js/app.concat.js' + } + }, + uglify: { + build: { + src: 'js/app.concat.js', + dest: 'js/app.min.js' + } + },<% } %><% if (preprocess) { %> + stylus: { + compile: { + files: { + 'css/app.min.css': 'css/app.styl' + } + } + },<% } else { %> + cssmin: { + minify: { + files: { + 'css/app.min.css': 'css/app.css' + } + } + },<% } %> + watch: { + js: { + files: [ + 'bower_components/**/*.js', + 'js/**/!(app.min|app.concat).js' + ], + tasks: ['javascript'] + }, + css: {<% if (preprocess) { %> + files: [ + 'css/**/*.styl' + ],<% } else { %> + files: [ + 'css/**/!(app.min).css' + ], + <% } %> + tasks: ['stylesheets'] + } + } + }); + <% if (amd) { %> + grunt.loadNpmTasks('grunt-contrib-requirejs');<% } else { %> + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify');<% } %><% if (preprocess) { %> + grunt.loadNpmTasks('grunt-contrib-stylus');<% } else { %> + grunt.loadNpmTasks('grunt-contrib-cssmin');<% } %> + grunt.loadNpmTasks('grunt-contrib-watch'); + <% if (amd) { %> + grunt.registerTask('javascript', [ + 'requirejs' + ]);<% } else { %> + grunt.registerTask('javascript', [ + 'concat:js', + 'uglify' + ]);<% } %><% if (preprocess) { %> + grunt.registerTask('stylesheets', [ + 'stylus' + ]);<% } else { %> + grunt.registerTask('stylesheets', [ + 'cssmin' + ]);<% } %> + + grunt.registerTask('default', ['javascript', 'stylesheets', 'watch']); +};
\ No newline at end of file diff --git a/app/templates/templates/_bower.json b/app/templates/templates/_bower.json new file mode 100644 index 0000000..020d0b8 --- /dev/null +++ b/app/templates/templates/_bower.json @@ -0,0 +1,9 @@ +{ + "name": "<%= _.slugify(siteName) %>", + "description": "<%= siteDescription %>", + "version": "0.0.0", + "dependencies": {<% if (jquery) { %> + "jquery": "~2.0.3"<% if (amd) { %>,<% } %><% } %><% if (amd) { %> + "requirejs": "~2.1.9"<% } %> + } +}
\ No newline at end of file diff --git a/app/templates/templates/_package.json b/app/templates/templates/_package.json new file mode 100644 index 0000000..90f5f05 --- /dev/null +++ b/app/templates/templates/_package.json @@ -0,0 +1,15 @@ +{ + "name": "<%= _.slugify(siteName) %>", + "description": "<%= siteDescription %>", + "private": true, + "devDependencies": {<% if (preprocess) { %> + "grunt-contrib-stylus": "*", + "nib": "*",<% } else { %> + "grunt-contrib-cssmin": "*",<% } %><% if (amd) { %> + "grunt-contrib-requirejs": "*",<% } %> + "grunt-contrib-concat": "*", + "grunt-contrib-uglify": "*", + "grunt-contrib-watch": "*", + "grunt": "*" + } +}
\ No newline at end of file diff --git a/app/templates/templates/app.amd.js b/app/templates/templates/app.amd.js new file mode 100644 index 0000000..045610d --- /dev/null +++ b/app/templates/templates/app.amd.js @@ -0,0 +1,9 @@ +define([], function () { + var app = { + init: function () { + + } + }; + + app.init(); +});
\ No newline at end of file diff --git a/app/templates/templates/app.css b/app/templates/templates/app.css new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/templates/templates/app.css diff --git a/app/templates/templates/app.js b/app/templates/templates/app.js new file mode 100644 index 0000000..439a2f5 --- /dev/null +++ b/app/templates/templates/app.js @@ -0,0 +1,11 @@ +/* globals $:false */ + +<% if (jquery) { %>$<% } %>(function () { + var app = { + init: function () { + + } + }; + + app.init(); +})<% if (!jquery) { %>()<% } %>;
\ No newline at end of file diff --git a/app/templates/templates/app.styl b/app/templates/templates/app.styl new file mode 100644 index 0000000..0237647 --- /dev/null +++ b/app/templates/templates/app.styl @@ -0,0 +1,3 @@ +@import '../node_modules/nib' + +global-reset()
\ No newline at end of file diff --git a/app/templates/templates/config.js b/app/templates/templates/config.js new file mode 100644 index 0000000..b680be7 --- /dev/null +++ b/app/templates/templates/config.js @@ -0,0 +1,6 @@ +require.config({ + paths: { + app: 'js/app'<% if (jquery) { %>, + jquery: 'bower_components/jquery/jquery'<% } %> + } +});
\ No newline at end of file diff --git a/app/templates/templates/gitignore b/app/templates/templates/gitignore new file mode 100644 index 0000000..4a3b993 --- /dev/null +++ b/app/templates/templates/gitignore @@ -0,0 +1,4 @@ +node_modules +bower_components +.DS_Store +npm-debug.log
\ No newline at end of file diff --git a/app/templates/templates/index.html b/app/templates/templates/index.html new file mode 100644 index 0000000..89794cb --- /dev/null +++ b/app/templates/templates/index.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <title><%= siteName %></title> + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> + + <meta name="description" content=""> + <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"> + <meta name="apple-mobile-web-app-capable" content="yes"> + <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> + + <meta property="og:title" content="<%= siteName %>"> + <meta property="og:type" content="website"> + <meta property="og:url" content=""> + <meta property="og:image" content=""> + <meta property="og:description" content="<%= siteDescription %>"> + + <link rel="image_src" href=""/> + <link rel="shortcut icon" href=""/> + <link rel="apple-touch-icon" href="" /> + <link rel="apple-touch-icon-precomposed" href="" /> + + <link rel="stylesheet" href="css/app.min.css"> + </head> + <body><% if (amd) { %> + <script src="bower_components/requirejs/require.js"></script> + <script src="js/config.js"></script><% } %> + <script src="js/app.min.js"></script><% if (amd) { %> + <script> + require(['app']); + </script><% } %> + </body> +</html>
\ No newline at end of file diff --git a/app/templates/templates/jshintrc b/app/templates/templates/jshintrc new file mode 100644 index 0000000..f51da24 --- /dev/null +++ b/app/templates/templates/jshintrc @@ -0,0 +1,65 @@ +{ + "asi": false, + "bitwise": false, + "boss": false, + "browser": true, + "camelcase": true, + "couch": false, + "curly": true, + "debug": false, + "devel": true, + "dojo": false, + "eqeqeq": true, + "eqnull": true, + "esnext": false, + "evil": false, + "expr": true, + "forin": false, + "funcscope": true, + "globalstrict": false, + "immed": true, + "iterator": false, + "jquery": false, + "lastsemic": false, + "latedef": false, + "laxbreak": true, + "laxcomma": false, + "loopfunc": true, + "mootools": false, + "multistr": false, + "newcap": true, + "noarg": true, + "node": false, + "noempty": false, + "nonew": true, + "nonstandard": false, + "nomen": false, + "onecase": false, + "onevar": false, + "passfail": false, + "plusplus": false, + "proto": false, + "prototypejs": false, + "regexdash": true, + "regexp": false, + "rhino": false, + "undef": true, + "unused": true, + "scripturl": true, + "shadow": false, + "smarttabs": true, + "strict": false, + "sub": false, + "supernew": false, + "trailing": true, + "validthis": true, + "withstmt": false, + "white": true, + "worker": false, + "wsh": false, + "yui": false, + "indent": 4, + "predef": [ "require", "define" ], + "quotmark": "single", + "maxcomplexity": 10 +}
\ No newline at end of file diff --git a/app/templates/vimproject.config b/app/templates/vimproject.config new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/app/templates/vimproject.config |
