├── .editorconfig ├── .gitattributes ├── .gitignore ├── .jshintrc ├── .travis.yml ├── LICENSE ├── README.md ├── app ├── index.js └── templates │ ├── _bower.json │ ├── _gruntfile.js │ ├── _package.json │ ├── editorconfig │ └── jshintrc ├── header.png ├── libs ├── ascii.js └── clone-bones.js ├── package.json └── test ├── test-creation.js └── test-load.js /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | temp/ 3 | *~ 4 | app/templates/theme 5 | npm-debug.log 6 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 2, 10 | "latedef": true, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "single", 14 | "regexp": true, 15 | "undef": true, 16 | "unused": true, 17 | "strict": true, 18 | "trailing": true, 19 | "smarttabs": true, 20 | "white": true 21 | } 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.8' 4 | - '0.10' 5 | before_install: 6 | - currentfolder=${PWD##*/} 7 | - if [ "$currentfolder" != 'generator-wp-bones' ]; then cd .. && eval "mv $currentfolder generator-wp-bones" && cd generator-wp-bones; fi 8 | 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | <<<<<<< HEAD 2 | Copyright 2014 Johan Nielsen 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | ======= 23 | The MIT License (MIT) 24 | 25 | Copyright (c) 2014 Johan Nielsen 26 | 27 | Permission is hereby granted, free of charge, to any person obtaining a copy 28 | of this software and associated documentation files (the "Software"), to deal 29 | in the Software without restriction, including without limitation the rights 30 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 31 | copies of the Software, and to permit persons to whom the Software is 32 | furnished to do so, subject to the following conditions: 33 | 34 | The above copyright notice and this permission notice shall be included in all 35 | copies or substantial portions of the Software. 36 | 37 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 38 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 39 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 40 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 41 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 42 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 43 | SOFTWARE. 44 | >>>>>>> 8bdc4ca896a9233bec8301ab1317fb46bf123e7d 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt tag](https://raw.github.com/0dp/generator-wp-bones/master/header.png) 2 | ![npm version](http://img.shields.io/badge/generator--wp--bones-0.0.9-brightgreen.svg) 3 | # generator-wp-bones 4 | 5 | A WordPress theme [Yeoman](http://yeoman.io) generator, to kickstart your [WordPress Bones 6 | theme development](https://github.com/eddiemachado/bones) with yo, sass and grunt. 7 | 8 | **Note:** Still in development 9 | 10 | 11 | ## Getting Started 12 | 13 | 14 | Install generator-wp-bones from npm: 15 | 16 | ``` 17 | $ npm install -g generator-wp-bones 18 | ``` 19 | 20 | Finally, initiate the generator. run this command in 21 | a working WordPress installations *themes* directory: 22 | 23 | ``` 24 | $ yo wp-bones 25 | ``` 26 | 27 | ## Known Issues 28 | 29 | * ~~Theme author info is never stored~~ Thanks to [LaboratorioEfe5](https://github.com/LaboratorioEfe5) 30 | 31 | ## TODO 32 | 33 | * A fancy deploy-to-production plan [Issue #9] (https://github.com/0dp/generator-wp-bones/issues/9) 34 | * ~~Instead of having the Bones Wordpress starter theme living in a folder in templates it would be nice to 'fetch' (dunno if this is the right term because i'm still a noob at git) it fresh from it's repo here at git. I have already included simple-git into the generator so it just need to be setup right.~~ Thanks to [iam4x](https://github.com/iam4x) 35 | * Convince my girlfriend to get a second cat 36 | 37 | 38 | ## License 39 | 40 | [MIT License](http://en.wikipedia.org/wiki/MIT_License) 41 | 42 | 43 | ## Thanks To 44 | Glen Geenen - 45 | Maxime Tyler - 46 | LaboratorioEfe5 - 47 | yivi - 48 | jbmicolai - 49 | kjbissell - 50 | -------------------------------------------------------------------------------- /app/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var util = require('util'); 3 | var path = require('path'); 4 | var async = require('async'); 5 | var yeoman = require('yeoman-generator'); 6 | var fs = require('fs'); 7 | var chalk = require('chalk'); 8 | 9 | // Libs 10 | var libsPath = path.join(__dirname + '/../' + '/libs/'); 11 | var cloneBones = require(libsPath + 'clone-bones'); 12 | var ascii = require(libsPath + 'ascii'); 13 | 14 | var WpBonesGenerator = module.exports = function (args, options) { 15 | yeoman.generators.Base.apply(this, arguments); 16 | 17 | // Need to override the default yeoman method in order to make 18 | // this works. If someone has a better idea, tell me. (@iam4x) 19 | this.directory = function (source, destination, process) { 20 | // Yeah just for this line, need to set the root as the source 21 | // or it will look inside the generator itself 22 | var root = source; 23 | var files = this.expandFiles('**', {dot: true, cwd: root}); 24 | var self = this; 25 | 26 | destination = destination || source; 27 | 28 | if (typeof destination === 'function') { 29 | process = destination; 30 | destination = source; 31 | } 32 | 33 | // get the path relative to the template root, and copy to the relative destination 34 | var resolveFiles = function (filepath) { 35 | return function (next) { 36 | if (!filepath) { 37 | self.emit('directory:end'); 38 | return next(); 39 | } 40 | 41 | var dest = path.join(destination, filepath); 42 | self.copy(path.join(root, filepath), dest, process); 43 | 44 | return next(); 45 | }; 46 | }; 47 | 48 | async.parallel(files.map(resolveFiles)); 49 | return this; 50 | }; 51 | 52 | this.on('end', function () { 53 | try { 54 | process.chdir(process.cwd() + '/' + this.themeNameSpace + '/library/grunt'); 55 | this.installDependencies({ 56 | skipInstall: options['skip-install'], 57 | callback: function () { 58 | this.spawnCommand('grunt', ['default']); 59 | }.bind(this) 60 | }); 61 | 62 | } catch (err) { 63 | console.log('Failed to install dependencies: ' + err); 64 | } 65 | }); 66 | 67 | this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '/../', '/package.json'))); 68 | }; 69 | 70 | util.inherits(WpBonesGenerator, yeoman.generators.Base); 71 | 72 | WpBonesGenerator.prototype.askFor = function () { 73 | var cb = this.async(); 74 | var _ = this._; 75 | ascii(); 76 | 77 | var prompts = [ 78 | { 79 | name: 'themeName', 80 | message: 'Name of the theme you want to create?', 81 | default: 'bones' 82 | }, 83 | { 84 | name: 'themeNameSpace', 85 | message: 'Uniq name-space for the theme (alphanumeric)?', 86 | default: function (answers) { 87 | return _.slugify(answers.themeName); 88 | } 89 | }, 90 | { 91 | name: 'themeAuthor', 92 | message: 'Name of the themes author?', 93 | default: function () { 94 | return 'John Doe'; 95 | } 96 | }, 97 | { 98 | name: 'themeAuthorURI', 99 | message: 'Website of the themes authors?', 100 | default: function (answers) { 101 | return 'http://www.' + answers.themeAuthor.replace(/\W/g, '').toLowerCase() + '.com'; 102 | } 103 | }, 104 | { 105 | name: 'themeURI', 106 | message: 'Website of the theme?', 107 | default: function (answers) { 108 | return answers.themeAuthorURI + '/' + answers.themeNameSpace; 109 | } 110 | }, 111 | { 112 | name: 'themeDescription', 113 | message: 'Description of the theme?', 114 | default: function (answers) { 115 | return 'This is a description for the ' + answers.themeName + ' theme.'; 116 | } 117 | } 118 | ]; 119 | 120 | var self = this; 121 | // Fetch theme from github before starting... 122 | console.log('\nDownloading latest version of the boilerplate...\n'); 123 | cloneBones().then(function (directory) { 124 | self.prompt(prompts, function (props) { 125 | self.themeName = props.themeName; 126 | self.themeNameSpace = props.themeNameSpace; 127 | self.themeAuthor = props.themeAuthor; 128 | self.themeAuthorURI = props.themeAuthorURI; 129 | self.themeURI = props.themeURI; 130 | self.themeDescription = props.themeDescription; 131 | self.directory(directory, self.themeNameSpace); 132 | self.jshintTag = '<%= jshint.all %>'; 133 | cb(); 134 | }.bind(self)); 135 | }); 136 | }; 137 | 138 | 139 | /* 140 | * basic replace function take from https://github.com/kdo/generator-wp-underscores 141 | * thanks 142 | */ 143 | function findandreplace(dir) { 144 | var self = this; 145 | var _ = this._; 146 | 147 | var files = fs.readdirSync(dir); 148 | files.forEach(function (file) { 149 | file = path.join(dir, file); 150 | var stat = fs.statSync(file); 151 | 152 | if (stat.isFile() && (path.extname(file) == '.php' || path.extname(file) == '.css')) { 153 | self.log.info('Find and replace bones in ' + chalk.yellow(file)); 154 | var data = fs.readFileSync(file, 'utf8'); 155 | var result; 156 | result = data.replace(/Text Domain: bonestheme/g, "Text Domain: " + _.slugify(self.themeName) + ""); 157 | result = result.replace(/'bonestheme'/g, "'" + _.slugify(self.themeName) + "'"); 158 | result = result.replace(/bones_/g, _.underscored(_.slugify(self.themeName)) + "_"); 159 | result = result.replace(/ bones/g, " " + self.themeName); 160 | result = result.replace(/bones-/g, _.slugify(self.themeName) + "-"); 161 | if (file == path.join(self.themeNameSpace,'style.css')) { 162 | self.log.info('Updating theme information in ' + file); 163 | result = result.replace(/(Theme Name: )(.+)/g, '$1' + self.themeName); 164 | result = result.replace(/(Theme URI: )(.+)/g, '$1' + self.themeURI); 165 | result = result.replace(/(Author: )(.+)/g, '$1' + self.themeAuthor); 166 | result = result.replace(/(Author URI: )(.+)/g, '$1' + self.themeAuthorURI); 167 | result = result.replace(/(Description: )(.+)/g, '$1' + self.themeDescription); 168 | //result = result.replace(/(Version: )(.+)/g, '$10.0.1'); 169 | 170 | } 171 | 172 | fs.writeFileSync(file, result, 'utf8'); 173 | } 174 | 175 | else if (stat.isDirectory()) { 176 | findandreplace.call(self, file); 177 | } 178 | }); 179 | } 180 | 181 | WpBonesGenerator.prototype.renameunderscores = function renameunderscores() { 182 | var self = this; 183 | findandreplace.call(this, './'+self.themeNameSpace); 184 | this.log.ok('Done replacing string ' + chalk.yellow('bones')); 185 | }; 186 | 187 | 188 | WpBonesGenerator.prototype.app = function () { 189 | var currentDate = new Date(); 190 | this.themeCreated = currentDate.getFullYear() + '-' + (currentDate.getMonth() + 1) + '-' + currentDate.getDate(); 191 | 192 | this.template('_gruntfile.js', this.themeNameSpace + '/library/grunt/gruntfile.js'); 193 | this.template('_package.json', this.themeNameSpace + '/library/grunt/package.json'); 194 | }; 195 | -------------------------------------------------------------------------------- /app/templates/_bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "package", 3 | "version": "0.0.0", 4 | "dependencies": {} 5 | } 6 | 7 | -------------------------------------------------------------------------------- /app/templates/_gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | 3 | grunt.initConfig({ 4 | 5 | pkg: grunt.file.readJSON('package.json'), 6 | 7 | // chech our JS 8 | jshint: { 9 | options: { 10 | "bitwise": true, 11 | "browser": true, 12 | "curly": true, 13 | "eqeqeq": true, 14 | "eqnull": true, 15 | "esnext": true, 16 | "immed": true, 17 | "jquery": true, 18 | "latedef": true, 19 | "newcap": true, 20 | "noarg": true, 21 | "node": true, 22 | "strict": false, 23 | "trailing": true, 24 | "undef": true, 25 | "globals": { 26 | "jQuery": true, 27 | "alert": true 28 | } 29 | }, 30 | all: [ 31 | 'gruntfile.js', 32 | '../js/scripts.js' 33 | ] 34 | }, 35 | 36 | // concat and minify our JS 37 | uglify: { 38 | dist: { 39 | files: { 40 | '../js/scripts.min.js': [ 41 | '../js/scripts.js' 42 | ] 43 | } 44 | } 45 | }, 46 | 47 | // compile your sass 48 | sass: { 49 | dev: { 50 | options: { 51 | style: 'expanded' 52 | }, 53 | files: { 54 | '../css/style.css': '../scss/style.scss', 55 | '../css/ie.css': '../scss/ie.scss', 56 | '../css/login.css': '../scss/login.scss', 57 | '../css/admin.css': '../scss/admin.scss' 58 | } 59 | }, 60 | prod: { 61 | options: { 62 | style: 'compressed' 63 | }, 64 | files: { 65 | '../css/style.css': '../scss/style.scss', 66 | '../css/ie.css': '../scss/ie.scss', 67 | '../css/login.css': '../scss/login.scss', 68 | '../css/admin.css': '../scss/admin.scss' 69 | } 70 | } 71 | }, 72 | 73 | // watch for changes 74 | watch: { 75 | grunt: { 76 | files: ['gruntfile.js'], 77 | }, 78 | scss: { 79 | files: ['../scss/**/*.scss'], 80 | tasks: [ 81 | 'sass:dev', 82 | 'notify:scss' 83 | ], 84 | options: { 85 | livereload: true 86 | } 87 | }, 88 | js: { 89 | files: [ 90 | '<%= jshintTag %>' 91 | ], 92 | tasks: [ 93 | 'jshint', 94 | 'uglify', 95 | 'notify:js' 96 | ], 97 | options: { 98 | livereload: true 99 | } 100 | }, 101 | php: { 102 | files: ['../../*.php', '../../**/*.php'], 103 | options: { 104 | livereload: true 105 | } 106 | } 107 | }, 108 | 109 | // check your php 110 | phpcs: { 111 | application: { 112 | dir: '../*.php' 113 | }, 114 | options: { 115 | bin: '/usr/bin/phpcs' 116 | } 117 | }, 118 | 119 | // notify cross-OS 120 | notify: { 121 | scss: { 122 | options: { 123 | title: 'Grunt, grunt!', 124 | message: 'SCSS is all gravy' 125 | } 126 | }, 127 | js: { 128 | options: { 129 | title: 'Grunt, grunt!', 130 | message: 'JS is all good' 131 | } 132 | }, 133 | dist: { 134 | options: { 135 | title: 'Grunt, grunt!', 136 | message: 'Theme ready for production' 137 | } 138 | } 139 | }, 140 | 141 | clean: { 142 | dist: { 143 | src: ['../dist'], 144 | options: { 145 | force: true 146 | } 147 | } 148 | }, 149 | 150 | copyto: { 151 | dist: { 152 | files: [ 153 | {cwd: '../', src: ['**/*'], dest: '../dist/'} 154 | ], 155 | options: { 156 | ignore: [ 157 | '../dist{,/**/*}', 158 | '../doc{,/**/*}', 159 | '../grunt{,/**/*}', 160 | '../scss{,/**/*}' 161 | ] 162 | } 163 | } 164 | } 165 | }); 166 | 167 | // Load NPM's via matchdep 168 | require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); 169 | 170 | // Development task 171 | grunt.registerTask('default', [ 172 | 'jshint', 173 | 'uglify', 174 | 'sass:dev' 175 | ]); 176 | 177 | // Production task 178 | grunt.registerTask('dist', function() { 179 | grunt.task.run([ 180 | 'jshint', 181 | 'uglify', 182 | 'sass:prod', 183 | 'clean:dist', 184 | 'copyto:dist', 185 | 'notify:dist' 186 | ]); 187 | }); 188 | }; 189 | -------------------------------------------------------------------------------- /app/templates/_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-<%= themeNameSpace %>", 3 | "version": "0.0.1", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/0dp/generator-wp-bones.git" 7 | }, 8 | "devDependencies": { 9 | "grunt": "~0.4.5", 10 | "grunt-contrib-watch": "~0.6.0", 11 | "grunt-contrib-uglify": "~0.8.0", 12 | "matchdep": "~0.3.0", 13 | "grunt-sass": "1.0.0", 14 | "grunt-phpcs": "~0.2.1", 15 | "grunt-contrib-jshint": "~0.7.2", 16 | "grunt-notify": "~0.2.16", 17 | "grunt-contrib-copy": "~0.5.0", 18 | "grunt-copy-to": "0.0.10", 19 | "grunt-rm": "0.0.4", 20 | "grunt-contrib-clean": "~0.6.0", 21 | "grunt-contrib-sass": "~0.9.2" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/templates/editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /app/templates/jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esnext": true, 4 | "bitwise": true, 5 | "camelcase": true, 6 | "curly": true, 7 | "eqeqeq": true, 8 | "immed": true, 9 | "indent": 4, 10 | "latedef": true, 11 | "newcap": true, 12 | "noarg": true, 13 | "quotmark": "single", 14 | "regexp": true, 15 | "undef": true, 16 | "unused": true, 17 | "strict": true, 18 | "trailing": true, 19 | "smarttabs": true, 20 | "white": true 21 | } 22 | -------------------------------------------------------------------------------- /header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0dp/generator-wp-bones/525acf6c9d04a47da14cdda8aeb2f7a46d6156b3/header.png -------------------------------------------------------------------------------- /libs/ascii.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var chalk = require('chalk'); 4 | 5 | module.exports = function () { 6 | console.log(chalk.blue.bold(" +++++++++++++++++ ")); 7 | console.log(chalk.blue.bold(" +++++++++++++++++++++ ")); 8 | console.log(chalk.blue.bold(" +++++++++++")+chalk.magenta.bgMagenta.bold("+=++")+chalk.white.bgWhite.bold(" ")+chalk.magenta.bgMagenta.bold(";")+chalk.blue.bold("++++ ")); 9 | console.log(chalk.blue.bold(" +++++++++++")+chalk.magenta.bgMagenta.bold(";")+chalk.white.bgWhite.bold(" ")+chalk.magenta.bgMagenta.bold("==-")+chalk.white.bgWhite.bold(" ")+chalk.blue.bold("++++ ")); 10 | console.log(chalk.blue.bold(" ++++++++++=")+chalk.magenta.bgMagenta.bold(".")+chalk.white.bgWhite.bold(" ")+chalk.magenta.bgMagenta.bold("-+==;")+chalk.white.bgWhite.bold(" ")+chalk.magenta.bgMagenta.bold("-+==")+chalk.blue.bold("=++ ")); 11 | console.log(chalk.blue.bold(" +++++++++++")+chalk.magenta.bgMagenta.bold("x ...++++++++=++ ")+chalk.blue.bold("-++ ")); 12 | console.log(chalk.blue.bold(" +++++++++++")+chalk.white.bgWhite.bold(".......")+chalk.magenta.bgMagenta.bold("++=,-+++=+")+chalk.white.bgWhite.bold(" ")+chalk.blue.bold("-++ ")); 13 | console.log(chalk.blue.bold(" +++++++++=")+chalk.white.bgWhite.bold("............ ")+chalk.magenta.bgMagenta.bold("=++=.")+chalk.white.bgWhite.bold(" ")+chalk.blue.bold("=++ ")); 14 | console.log(chalk.blue.bold(" ++++++++=")+chalk.white.bgWhite.bold(".... ........... ")+chalk.magenta.bgMagenta.bold("++=+")+chalk.white.bgWhite.bold(" ")+chalk.blue.bold("+++ ")); 15 | console.log(chalk.blue.bold(" +++++++,")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold("+xx+")+chalk.white.bgWhite.bold("............")+chalk.magenta.bgMagenta.bold(",xx+x,")+chalk.white.bgWhite.bold(".")+chalk.magenta.bgMagenta.bold("-")+chalk.blue.bold("++ ")); 16 | console.log(chalk.blue.bold(" +++++++-")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold("++++++=")+chalk.white.bgWhite.bold("...........")+chalk.magenta.bgMagenta.bold("+++++xx")+chalk.blue.bold("+++ ")); 17 | console.log(chalk.blue.bold(" +++++++")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold("=++++++x")+chalk.white.bgWhite.bold(" ..........")+chalk.magenta.bgMagenta.bold("+x++++xx")+chalk.blue.bold("++ ")); 18 | console.log(chalk.blue.bold(" ++++++++")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold("xxx+=xxx")+chalk.white.bgWhite.bold(" .........")+chalk.magenta.bgMagenta.bold("-+x+")+chalk.white.bgWhite.bold(",, .")+chalk.magenta.bgMagenta.bold("x")+chalk.blue.bold("+++ ")); 19 | console.log(chalk.blue.bold(" ++++++++")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold("xx")+chalk.white.bgWhite.bold(".. ")+chalk.black.bgBlack.bold("+xx")+chalk.white.bgWhite.bold(" ..........")+chalk.magenta.bgMagenta.bold("xx")+chalk.white.bgWhite.bold("- -")+chalk.magenta.bgMagenta.bold("x")+chalk.blue.bold("++ + ")); 20 | console.log(chalk.blue.bold(" +++++++++")+chalk.white.bgWhite.bold("..")+chalk.black.bgBlack.bold("+xxx+=xx")+chalk.white.bgWhite.bold(" ...........")+chalk.magenta.bgMagenta.bold("x")+chalk.white.bgWhite.bold("-,.-..")+chalk.magenta.bgMagenta.bold("x")+chalk.blue.bold("++++ ")); 21 | console.log(chalk.blue.bold(" +++++++++-")+chalk.white.bgWhite.bold(". ")+chalk.black.bgBlack.bold("xxxxxx+")+chalk.white.bgWhite.bold("......,.....")+chalk.magenta.bgMagenta.bold("xx")+chalk.white.bgWhite.bold("-,=.")+chalk.magenta.bgMagenta.bold("=x")+chalk.blue.bold("++++ ")); 22 | console.log(chalk.blue.bold(" ++++++++++")+chalk.white.bgWhite.bold("..")+chalk.black.bgBlack.bold(",+xxx+")+chalk.white.bgWhite.bold(".........,,,,.")+chalk.magenta.bgMagenta.bold("x-.,.xxx")+chalk.blue.bold("+++ ")); 23 | console.log(chalk.blue.bold(" +++++++++++")+chalk.white.bgWhite.bold(".. .........")+chalk.black.bgBlack.bold("++++x,")+chalk.white.bgWhite.bold("...")+chalk.magenta.bgMagenta.bold("xxxxxx")+chalk.white.bgWhite.bold("..")+chalk.blue.bold("+++ ")); 24 | console.log(chalk.blue.bold(" ++++++++++=")+chalk.white.bgWhite.bold(".....")+chalk.black.bgBlack.bold("+=")+chalk.white.bgWhite.bold("....")+chalk.black.bgBlack.bold("x+++++x")+chalk.white.bgWhite.bold(",,,")+chalk.magenta.bgMagenta.bold("-xxxx")+chalk.white.bgWhite.bold("...")+chalk.blue.bold("+++ ")); 25 | console.log(chalk.blue.bold(" ++++++++++")+chalk.white.bgWhite.bold("....")+chalk.black.bgBlack.bold("-xxx-")+chalk.white.bgWhite.bold("..")+chalk.black.bgBlack.bold(",++xx+++-")+chalk.white.bgWhite.bold(",,,")+chalk.magenta.bgMagenta.bold(".-xx")+chalk.white.bgWhite.bold("...")+chalk.blue.bold("+++ ")); 26 | console.log(chalk.blue.bold(" +++++++++")+chalk.white.bgWhite.bold(" ...")+chalk.black.bgBlack.bold("-xxxx")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold("=x=")+chalk.white.bgWhite.bold("..")+chalk.black.bgBlack.bold("=xx+")+chalk.white.bgWhite.bold(";;--")+chalk.magenta.bgMagenta.bold(".+x")+chalk.white.bgWhite.bold("...")+chalk.blue.bold("+++ ")); 27 | console.log(chalk.blue.bold(" ++++++++")+chalk.white.bgWhite.bold(".....")+chalk.black.bgBlack.bold("xxxxx")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold("=x=x=-xx+;")+chalk.white.bgWhite.bold("---")+chalk.magenta.bgMagenta.bold(".;x")+chalk.white.bgWhite.bold("...")+chalk.blue.bold("+++ ")); 28 | console.log(chalk.blue.bold(" +++++++=")+chalk.white.bgWhite.bold(".....")+chalk.black.bgBlack.bold(";xxx")+chalk.white.bgWhite.bold("....,")+chalk.black.bgBlack.bold("xxx-+xx-;")+chalk.white.bgWhite.bold(";-")+chalk.magenta.bgMagenta.bold("=.-x")+chalk.white.bgWhite.bold(",.")+chalk.blue.bold("=+++ ")); 29 | console.log(chalk.blue.bold(" ++++++++")+chalk.white.bgWhite.bold(".......")+chalk.black.bgBlack.bold("x=")+chalk.white.bgWhite.bold("....,")+chalk.black.bgBlack.bold("+xxxxxx;;")+chalk.white.bgWhite.bold("--")+chalk.magenta.bgMagenta.bold("=.xxx,")+chalk.blue.bold("++++ ")); 30 | console.log(chalk.blue.bold(" ++++++++=")+chalk.white.bgWhite.bold("......")+chalk.blue.bold("")+chalk.white.bgWhite.bold(",.....,")+chalk.black.bgBlack.bold(";;+xx=;;")+chalk.white.bgWhite.bold("---")+chalk.magenta.bgMagenta.bold("=+xx")+chalk.blue.bold("++++++ ")); 31 | console.log(chalk.blue.bold(" +++++++++=")+chalk.white.bgWhite.bold("...")+chalk.blue.bold("")+chalk.white.bgWhite.bold(",.....,..,;;")+chalk.white.bgWhite.bold("---;;;")+chalk.blue.bold("-=Xxxx+= +++ ")); 32 | console.log(chalk.blue.bold(" ++++++++++=")+chalk.white.bgWhite.bold(".;......")+chalk.black.bgBlack.bold("=+x-")+chalk.white.bgWhite.bold(",,,,,,;;")+chalk.blue.bold("-=x++xx+ x ")); 33 | console.log(chalk.blue.bold(" ++++++++++++,")+chalk.white.bgWhite.bold("..;..")+chalk.black.bgBlack.bold("xxxx;")+chalk.white.bgWhite.bold("=;,;;;;")+chalk.blue.bold(";-,++xx++ . ")); 34 | console.log(chalk.blue.bold(" ++++++++++++xx,")+chalk.white.bgWhite.bold("..")+chalk.black.bgBlack.bold("xxxx")+chalk.white.bgWhite.bold(";;--+====")+chalk.yellow.bgYellow.bold("++")+chalk.blue.bold(";xxxxxx+, ")); 35 | console.log(chalk.blue.bold(" ++++=")+chalk.white.bgWhite.bold("..")+chalk.black.bgBlack.bold(";")+chalk.blue.bold("++xxxx+")+chalk.black.bgBlack.bold("xxxx")+chalk.white.bgWhite.bold(",;;;-")+chalk.blue.bold("+++-")+chalk.yellow.bgYellow.bold("=")+chalk.blue.bold("+")+chalk.yellow.bgYellow.bold("+.")+chalk.blue.bold("xxxxxxx ")); 36 | console.log(chalk.blue.bold(" ++++=")+chalk.white.bgWhite.bold(".... ")+chalk.blue.bold(",=xx")+chalk.black.bgBlack.bold("xxxx")+chalk.white.bgWhite.bold(",;;;;")+chalk.blue.bold("++++")+chalk.yellow.bgYellow.bold("=")+chalk.blue.bold("-=-")+chalk.yellow.bgYellow.bold(".")+chalk.blue.bold("xxxx++x ")); 37 | console.log(chalk.blue.bold(" +++- ")+chalk.white.bgWhite.bold("...")+chalk.black.bgBlack.bold(";")+chalk.white.bgWhite.bold(".. ")+chalk.black.bgBlack.bold("xxx")+chalk.white.bgWhite.bold(",,.,,")+chalk.blue.bold("++++++")+chalk.yellow.bgYellow.bold("=;;")+chalk.blue.bold("+xxxx++ ")); 38 | console.log(chalk.blue.bold(" +++-")+chalk.white.bgWhite.bold(".....,.,")+chalk.black.bgBlack.bold(".xx")+chalk.white.bgWhite.bold("....,")+chalk.blue.bold("++++++++++++xxx++ ")); 39 | console.log(chalk.blue.bold(" ++=")+chalk.white.bgWhite.bold(".....,.........")+chalk.blue.bold("++++++++++++++xx+ ")); 40 | console.log(chalk.blue.bold(" ++")+chalk.white.bgWhite.bold("..............")+chalk.blue.bold("=++++++++++++++++ ")); 41 | console.log(chalk.blue.bold(" +++-")+chalk.white.bgWhite.bold("..,,,,")+chalk.white.bgWhite.bold("...")+chalk.blue.bold(",+++++++++++++++++ ")); 42 | console.log(chalk.blue.bold(" +++++++")+chalk.white.bgWhite.bold("===")+chalk.blue.bold("+++++++++++++++++++ ")); 43 | console.log(chalk.blue.bold(" +++++++++++++++++++++++++++ ")); 44 | console.log(chalk.blue.bold(" +++++++++++++++++++++++++ ")); 45 | console.log(chalk.blue.bold(" +++++++++++++++++++++ ")); 46 | console.log(chalk.blue.bold(" +++++++++++++++++ ")); 47 | console.log(chalk.blue.bold(" x+++++++++++x ")); 48 | 49 | 50 | 51 | console.log(chalk.blue.bold(" ::::::::: :::::::: :::: ::: :::::::::: :::::::: ")); 52 | console.log(chalk.blue.bold(" :+: :+: :+: :+: :+:+: :+: :+: :+: :+: ")); 53 | console.log(chalk.blue.bold(" +:+ +:+ +:+ +:+ :+:+:+ +:+ +:+ +:+ ")); 54 | console.log(chalk.blue.bold(" +#++:++#+ +#+ +:+ +#+ +:+ +#+ +#++:++# +#++:++#++ ")); 55 | console.log(chalk.blue.bold(" +#+ +#+ +#+ +#+ +#+ +#+#+# +#+ +#+ ")); 56 | console.log(chalk.blue.bold(" #+# #+# #+# #+# #+# #+#+# #+# #+# #+# ")); 57 | console.log(chalk.blue.bold("######### ######## ### #### ########## ######## ")); 58 | }; 59 | -------------------------------------------------------------------------------- /libs/clone-bones.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // dependancies 4 | var RSVP = require('rsvp'); 5 | var simpleGit = require('simple-git')(); 6 | var tmp = require('temporary'); 7 | 8 | // Bones git repo url 9 | var bones = 'git://github.com/eddiemachado/bones.git'; 10 | 11 | // Configure RSVP promise to yell when something goes wrong 12 | // -------------------------------------------------------- 13 | RSVP.on('error', function (event) { 14 | console.log(event.message); 15 | console.log(event.stack); 16 | }); 17 | 18 | // Module: cloneBones 19 | // ------------------ 20 | // this our module, it's a Promise 21 | // it will be used to create our theme directory or to clean git 22 | // then it will clone the `bones` repository in the temporary files 23 | // 24 | // I prefered to use clone, cause if something goes wrong with 25 | // the bones directory, we would have to do execute 26 | // ``` 27 | // $ git fetch 28 | // $ git reset --hard origin/master 29 | // $ git pull origin master 30 | // ``` 31 | var cloneBones = function () { 32 | var promise = new RSVP.Promise(function (resolve, reject) { 33 | // Let's create a temporary directory 34 | var dir = new tmp.Dir(); 35 | // then we clone into our new tempory directory 36 | simpleGit.clone(bones, dir.path, function (err) { 37 | if (err) { 38 | // something wrong? tell RSVP 39 | return reject(err); 40 | } 41 | // good! everthing is okey, we can go on :D 42 | return resolve(dir.path); 43 | }); 44 | }); 45 | return promise; 46 | }; 47 | 48 | // export our module outside :) 49 | module.exports = cloneBones; 50 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-wp-bones", 3 | "version": "0.0.9", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/0dp/generator-wp-bones.git" 7 | }, 8 | "description": "Installs Bones Wordpress starter theme into the current directory - goto the themes folder and run yo wp-bones ", 9 | "keywords": [ 10 | "yeoman-generator", 11 | "Bones Wordpress starter theme" 12 | ], 13 | "homepage": "https://github.com/0dp/generator-wp-bones", 14 | "bugs": "https://github.com/0dp/generator-wp-bones/issues", 15 | "author": { 16 | "name": "Johan Nielsen", 17 | "email": "odinp123@gmail.com", 18 | "url": "https://github.com/0dp" 19 | }, 20 | "main": "app/index.js", 21 | "scripts": { 22 | "test": "mocha" 23 | }, 24 | "dependencies": { 25 | "yeoman-generator": "~0.13.0", 26 | "simple-git": "~0.7.0", 27 | "chalk": "~1.0.0", 28 | "rsvp": "~3.0.6", 29 | "temporary": "0.0.8", 30 | "async": "~0.7.0" 31 | }, 32 | "devDependencies": { 33 | "mocha": "~1.12.0" 34 | }, 35 | "peerDependencies": { 36 | "yo": ">=1.0.0" 37 | }, 38 | "engines": { 39 | "node": ">=0.8.x", 40 | "npm": ">=1.2.10" 41 | }, 42 | "licenses": [ 43 | { 44 | "type": "MIT" 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /test/test-creation.js: -------------------------------------------------------------------------------- 1 | /*global describe, beforeEach, it*/ 2 | 'use strict'; 3 | 4 | var path = require('path'); 5 | var helpers = require('yeoman-generator').test; 6 | 7 | 8 | describe('wp-bones generator', function () { 9 | beforeEach(function (done) { 10 | helpers.testDirectory(path.join(__dirname, 'temp'), function (err) { 11 | if (err) { 12 | return done(err); 13 | } 14 | 15 | this.app = helpers.createGenerator('wp-bones:app', [ 16 | '../../app' 17 | ]); 18 | done(); 19 | }.bind(this)); 20 | }); 21 | 22 | it('creates expected files', function (done) { 23 | var expected = [ 24 | // add files you expect to exist here. 25 | '.jshintrc', 26 | '.editorconfig' 27 | ]; 28 | 29 | helpers.mockPrompt(this.app, { 30 | 'someOption': true 31 | }); 32 | this.app.options['skip-install'] = true; 33 | this.app.run({}, function () { 34 | helpers.assertFiles(expected); 35 | done(); 36 | }); 37 | }); 38 | }); 39 | -------------------------------------------------------------------------------- /test/test-load.js: -------------------------------------------------------------------------------- 1 | /*global describe, beforeEach, it*/ 2 | 'use strict'; 3 | 4 | var assert = require('assert'); 5 | 6 | describe('wp-bones generator', function () { 7 | it('can be imported without blowing up', function () { 8 | var app = require('../app'); 9 | assert(app !== undefined); 10 | }); 11 | }); 12 | --------------------------------------------------------------------------------