From 420aac0c0263f094ef75ff924742584c92c4bc5f Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Sun, 17 May 2015 22:39:37 +0200 Subject: [PATCH] Move some subgenerators to a boilerplate generator Moved the git, editorconfig, jscs and jshint subgenerator into a boilerplate generator instead because I like that approach better. --- generators/app/index.js | 16 +---- generators/editorconfig/index.js | 12 ---- .../editorconfig/templates/editorconfig | 12 ---- generators/git/index.js | 17 ----- generators/git/templates/gitattributes | 1 - generators/git/templates/gitignore | 70 ------------------- generators/jscs/index.js | 12 ---- generators/jscs/templates/jscsrc | 3 - generators/jshint/index.js | 12 ---- generators/jshint/templates/jshintrc | 18 ----- test/app.js | 3 +- test/editorconfig.js | 2 +- test/git.js | 2 +- test/gulp.js | 3 +- test/jscs.js | 2 +- test/jshint.js | 2 +- 16 files changed, 10 insertions(+), 177 deletions(-) delete mode 100644 generators/editorconfig/index.js delete mode 100644 generators/editorconfig/templates/editorconfig delete mode 100644 generators/git/index.js delete mode 100644 generators/git/templates/gitattributes delete mode 100644 generators/git/templates/gitignore delete mode 100644 generators/jscs/index.js delete mode 100644 generators/jscs/templates/jscsrc delete mode 100644 generators/jshint/index.js delete mode 100644 generators/jshint/templates/jshintrc diff --git a/generators/app/index.js b/generators/app/index.js index e74ef3e..aad8e0c 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -61,20 +61,8 @@ module.exports = generators.Base.extend({ }, default: function() { - this.composeWith('jekyllized:editorconfig', {}, { - local: require.resolve('../editorconfig') - }); - - this.composeWith('jekyllized:jshint', {}, { - local: require.resolve('../jshint') - }); - - this.composeWith('jekyllized:jscs', {}, { - local: require.resolve('../jscs') - }); - - this.composeWith('jekyllized:git', {}, { - local: require.resolve('../git') + this.composeWith('jekyllized:boilerplate', {}, { + local: require.resolve('../boilerplate') }); this.composeWith('jekyllized:gulp', {}, { diff --git a/generators/editorconfig/index.js b/generators/editorconfig/index.js deleted file mode 100644 index 6cc921f..0000000 --- a/generators/editorconfig/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('editorconfig'), - this.destinationPath('.editorconfig') - ); - } -}); diff --git a/generators/editorconfig/templates/editorconfig b/generators/editorconfig/templates/editorconfig deleted file mode 100644 index 4a7ea30..0000000 --- a/generators/editorconfig/templates/editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -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 diff --git a/generators/git/index.js b/generators/git/index.js deleted file mode 100644 index 259e0c9..0000000 --- a/generators/git/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('gitignore'), - this.destinationPath('.gitignore') - ); - - this.fs.copy( - this.templatePath('gitattributes'), - this.destinationPath('.gitattributes') - ); - } -}); diff --git a/generators/git/templates/gitattributes b/generators/git/templates/gitattributes deleted file mode 100644 index 2125666..0000000 --- a/generators/git/templates/gitattributes +++ /dev/null @@ -1 +0,0 @@ -* text=auto \ No newline at end of file diff --git a/generators/git/templates/gitignore b/generators/git/templates/gitignore deleted file mode 100644 index 1ac3139..0000000 --- a/generators/git/templates/gitignore +++ /dev/null @@ -1,70 +0,0 @@ -# .gitignore for jekyllized projects - -# Ignore hidden folders -# This takes care of .tmp, .sass-cache, and many others -.*/ - -# OSX -._* -.AppleDouble -.DS_Store -.localized -.LSOverride -.Spotlight-V100 -.Trashes -Icon - -# Windows -Desktop.ini -ehthumbs.db -Thumbs.db - -# Linux -*~ - -# Tags -# Ignore tags created by etags and ctags -TAGS -tags - -# Always-ignore files and folders # -*.diff -*.err -*.log -*.orig -*.rej -*.swn -*.swo -*.swp -._* -*~ - -# Ignore packages # -*.7z -*.dmg -*.gz -*.iso -*.jar -*.rar -*.tar -*.zip - -# Packages -node_modules/* -.tmp -test/ - -# Sublime -*.sublime-project -*.sublime-workspace -*.sublime-projectcompletions - -app/_bower_components - -# Output folders -serve -site - -# hide the AWS and Rsync credentials file -aws-credentials.json -rsync-credentials.json diff --git a/generators/jscs/index.js b/generators/jscs/index.js deleted file mode 100644 index 3d25c86..0000000 --- a/generators/jscs/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('jscsrc'), - this.destinationPath('.jscsrc') - ); - } -}); diff --git a/generators/jscs/templates/jscsrc b/generators/jscs/templates/jscsrc deleted file mode 100644 index 4b5fa83..0000000 --- a/generators/jscs/templates/jscsrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "preset": "google" -} diff --git a/generators/jshint/index.js b/generators/jshint/index.js deleted file mode 100644 index 717e3ab..0000000 --- a/generators/jshint/index.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -var generators = require('yeoman-generator'); - -module.exports = generators.Base.extend({ - configuring: function() { - this.fs.copy( - this.templatePath('jshintrc'), - this.destinationPath('.jshintrc') - ); - } -}); diff --git a/generators/jshint/templates/jshintrc b/generators/jshint/templates/jshintrc deleted file mode 100644 index a89f882..0000000 --- a/generators/jshint/templates/jshintrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "node": true, - "browser": true, - "esnext": true, - "bitwise": false, - "curly": false, - "eqeqeq": true, - "eqnull": true, - "immed": true, - "latedef": true, - "newcap": true, - "noarg": true, - "quotmark": "double", - "undef": true, - "strict": false, - "trailing": true, - "smarttabs": true -} diff --git a/test/app.js b/test/app.js index 05ad042..110153f 100644 --- a/test/app.js +++ b/test/app.js @@ -43,7 +43,8 @@ describe('jekyllized:app', function() { '.jscsrc', '.gitignore', '.gitattributes', - 'package.json' + 'package.json', + 'gulpfile.js' ]); }); diff --git a/test/editorconfig.js b/test/editorconfig.js index efe30f4..4c17c0d 100644 --- a/test/editorconfig.js +++ b/test/editorconfig.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:editorconfig', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/editorconfig')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); diff --git a/test/git.js b/test/git.js index bcbe697..d0eff3c 100644 --- a/test/git.js +++ b/test/git.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:git', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/git')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); diff --git a/test/gulp.js b/test/gulp.js index 7afdf6e..3e1994e 100644 --- a/test/gulp.js +++ b/test/gulp.js @@ -8,9 +8,10 @@ describe('jekyllized:gulp', function() { describe('without any uploading', function() { before(function(done) { this.answers = { - uploading: 'noUploadg' + uploading: 'noUpload' }; helpers.run(path.join(__dirname, '../generators/gulp')) + .inDir(path.join(__dirname, 'tmp/gulp')) .withPrompts(this.answers) .on('end', done); }); diff --git a/test/jscs.js b/test/jscs.js index d6ee51d..1faf17d 100644 --- a/test/jscs.js +++ b/test/jscs.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:jscs', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/app')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); }); diff --git a/test/jshint.js b/test/jshint.js index 746f637..bf61454 100644 --- a/test/jshint.js +++ b/test/jshint.js @@ -6,7 +6,7 @@ var helpers = require('yeoman-generator').test; describe('jekyllized:jshint', function() { before(function(done) { - helpers.run(path.join(__dirname, '../generators/jshint')) + helpers.run(path.join(__dirname, '../generators/boilerplate')) .on('end', done); });