diff options
| -rw-r--r-- | .editorconfig | 12 | ||||
| -rw-r--r-- | .gitattributes | 1 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .jshintrc | 21 | ||||
| -rw-r--r-- | .travis.yml | 7 | ||||
| -rw-r--r-- | .yo-rc.json | 3 | ||||
| -rw-r--r-- | README.md | 47 | ||||
| -rwxr-xr-x | RESET_CMD | 3 | ||||
| -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 | ||||
| -rwxr-xr-x | ascii_art.js | 5 | ||||
| -rw-r--r-- | package.json | 36 | ||||
| -rw-r--r-- | test/test-app.js | 28 |
27 files changed, 533 insertions, 0 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..5760be5 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..176a458 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..0cd291c --- /dev/null +++ b/.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/.travis.yml b/.travis.yml new file mode 100644 index 0000000..32a70eb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,7 @@ +language: node_js +node_js: + - '0.10' +before_install: + - currentfolder=${PWD##*/} + - if [ "$currentfolder" != 'generator-unsemantic-express' ]; then cd .. && eval "mv $currentfolder generator-unsemantic-express" && cd generator-unsemantic-express; fi + diff --git a/.yo-rc.json b/.yo-rc.json new file mode 100644 index 0000000..01d1070 --- /dev/null +++ b/.yo-rc.json @@ -0,0 +1,3 @@ +{ + "generator-generator": {} +}
\ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..188d012 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# generator-unsemantic-express [](https://travis-ci.org/pepperpepperpepper/generator-unsemantic-express) + +> [Yeoman](http://yeoman.io) generator + + +## Getting Started + +### What is Yeoman? + +Trick question. It's not a thing. It's this guy: + + + +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.* + +```bash +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-unsemantic-express from npm, run: + +```bash +npm install -g generator-unsemantic-express +``` + +Finally, initiate the generator: + +```bash +yo unsemantic-express +``` + +### 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 diff --git a/RESET_CMD b/RESET_CMD new file mode 100755 index 0000000..d2ec2a5 --- /dev/null +++ b/RESET_CMD @@ -0,0 +1,3 @@ +#!/bin/bash +reset(){ ls | grep -v node_modules | grep -v reset | while read a; do rm -rf "$a"; done; find node_modules -maxdepth 1 -mindepth 1 -type d | grep -v '\.bin' | grep -v 'generator' | while read a; do rm -rf "$a"; done; } +reset 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 diff --git a/ascii_art.js b/ascii_art.js new file mode 100755 index 0000000..3987995 --- /dev/null +++ b/ascii_art.js @@ -0,0 +1,5 @@ +module.exports = function(){ +process.stdout.write("\u001B[2J\u001B[0;0f"); +//exec -out printf "\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\x030,11 \x03\n \x0311,1Y\x03\x037,1O\x03\x037,1 \x03\x0313,1Y\x03\x0313,1O\x03\x0313,1 \x03\x036,1Y\x03\x036,1O\x03\x036,1!\x03\x036,1!\x03\x036,1!\x03\x036,1!\x03\n \x030,11 \x03\x030,11 \x03\x030,11 \x03\n \x030,11 \x03\x030,11 \x03\x030,11 \x03 \x030,11 \x03 \x030,11 \x03\n \x030,11 \x03\n \x030,12 \x03 \x030,12 \x03\n \x030,10 \x03\n \x030,10 \x03\x030,10 \x03 \x030,12 \x03\n \x030,12 \x03\x030,12 \x03\x030,12 \x03\n \x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\x030,12 \x03\n \x030,4 \x03\x030,4 \x03\x030,4 \x03\x030,4 \x03\x030,4 \x03\x030,4 \x03\x030,4 \x03\n \x030,4 \x03\x030,4 \x03\x030,4 \x03 \x030,4 \x03\x030,4 \x03\x030,4 \x03\n \x030,4 \x03\x030,4 \x03\x030,4 \x03\n" +process.stdout.write( "\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\n \033[311m1Y\x03\033[37m1O\x03\033[37m1 \x03\033[313m1Y\x03\033[313m1O\x03\033[313m1 \x03\033[36m1Y\x03\033[36m1O\x03\033[36m1!\x03\033[36m1!\x03\033[36m1!\x03\033[36m1!\x03\n \033[30m11 \x03\033[30m11 \x03\033[30m11 \x03\n \033[30m11 \x03\033[30m11 \x03\033[30m11 \x03 \033[30m11 \x03 \033[30m11 \x03\n \033[30m11 \x03\n \033[30m12 \x03 \033[30m12 \x03\n \033[30m10 \x03\n \033[30m10 \x03\033[30m10 \x03 \033[30m12 \x03\n \033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\n \033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\033[30m12 \x03\n \033[30m4 \x03\033[30m4 \x03\033[30m4 \x03\033[30m4 \x03\033[30m4 \x03\033[30m4 \x03\033[30m4 \x03\n \033[30m4 \x03\033[30m4 \x03\033[30m4 \x03 \033[30m4 \x03\033[30m4 \x03\033[30m4 \x03\n \033[30m4 \x03\033[30m4 \x03\033[30m4 \x03\n"); +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..22ccf79 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "generator-unsemantic-express", + "version": "0.0.0", + "description": "Yeoman generator", + "license": "MIT", + "main": "app/index.js", + "repository": "pepperpepperpepper/generator-unsemantic-express", + "author": { + "name": "", + "email": "", + "url": "https://github.com/pepperpepperpepper" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "app" + ], + "keywords": [ + "yeoman-generator" + ], + "dependencies": { + "yeoman-generator": "^0.17.0", + "chalk": "^0.5.0", + "yosay": "^0.3.0" + }, + "devDependencies": { + "mocha": "*" + }, + "peerDependencies": { + "yo": ">=1.0.0" + } +} diff --git a/test/test-app.js b/test/test-app.js new file mode 100644 index 0000000..38e3583 --- /dev/null +++ b/test/test-app.js @@ -0,0 +1,28 @@ +/*global describe, beforeEach, it*/ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-generator').assert; +var helpers = require('yeoman-generator').test; +var os = require('os'); + +describe('unsemantic-express:app', function () { + before(function (done) { + helpers.run(path.join(__dirname, '../app')) + .inDir(path.join(os.tmpdir(), './temp-test')) + .withOptions({ 'skip-install': true }) + .withPrompt({ + someOption: true + }) + .on('end', done); + }); + + it('creates files', function () { + assert.file([ + 'bower.json', + 'package.json', + '.editorconfig', + '.jshintrc' + ]); + }); +}); |
