From 729ec19acb357f8c8f202e0235616f6c6f208367 Mon Sep 17 00:00:00 2001 From: Sondre Nilsen Date: Wed, 29 Apr 2015 20:56:19 +0200 Subject: [PATCH] Added git submodule and minor formatting changes --- generators/app/index.js | 4 ++ generators/git/index.js | 17 +++++++ generators/git/templates/gitattributes | 1 + generators/git/templates/gitignore | 70 ++++++++++++++++++++++++++ test/app.js | 4 +- test/editorconfig.js | 4 +- test/git.js | 20 ++++++++ test/jscs.js | 4 +- test/jshint.js | 4 +- 9 files changed, 118 insertions(+), 10 deletions(-) create mode 100644 generators/git/index.js create mode 100644 generators/git/templates/gitattributes create mode 100644 generators/git/templates/gitignore create mode 100644 test/git.js diff --git a/generators/app/index.js b/generators/app/index.js index 1ec26be..857b783 100644 --- a/generators/app/index.js +++ b/generators/app/index.js @@ -16,5 +16,9 @@ module.exports = generators.Base.extend({ this.composeWith('jekyllized:jscs', {}, { local: require.resolve('../jscs') }); + + this.composeWith('jekyllized:git', {}, { + local: require.resolve('../git') + }); } }); diff --git a/generators/git/index.js b/generators/git/index.js new file mode 100644 index 0000000..9f18676 --- /dev/null +++ b/generators/git/index.js @@ -0,0 +1,17 @@ +'use strict'; + +var generators = require('yeoman-generator'); + +module.exports = generators.Base.extend({ + initializing: 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 new file mode 100644 index 0000000..2125666 --- /dev/null +++ b/generators/git/templates/gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/generators/git/templates/gitignore b/generators/git/templates/gitignore new file mode 100644 index 0000000..1ac3139 --- /dev/null +++ b/generators/git/templates/gitignore @@ -0,0 +1,70 @@ +# .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/test/app.js b/test/app.js index 98859b8..caae5b5 100644 --- a/test/app.js +++ b/test/app.js @@ -14,7 +14,9 @@ describe('jekyllized:app', function() { assert.file([ '.editorconfig', '.jshintrc', - '.jscsrc' + '.jscsrc', + '.gitignore', + '.gitattributes' ]); }); }); diff --git a/test/editorconfig.js b/test/editorconfig.js index 5d26aca..70f1280 100644 --- a/test/editorconfig.js +++ b/test/editorconfig.js @@ -11,8 +11,6 @@ describe('jekyllized:editorconfig', function() { }); it('created .editorconfig', function() { - assert.file([ - '.editorconfig' - ]); + assert.file('.editorconfig'); }); }); diff --git a/test/git.js b/test/git.js new file mode 100644 index 0000000..bcbe697 --- /dev/null +++ b/test/git.js @@ -0,0 +1,20 @@ +'use strict'; + +var path = require('path'); +var assert = require('yeoman-assert'); +var helpers = require('yeoman-generator').test; + +describe('jekyllized:git', function() { + before(function(done) { + helpers.run(path.join(__dirname, '../generators/git')) + .on('end', done); + }); + + it('creates .gitignore', function() { + assert.file('.gitignore'); + }); + + it('creates .gitattributes', function() { + assert.file('.gitattributes'); + }); +}); diff --git a/test/jscs.js b/test/jscs.js index 49664c5..d6ee51d 100644 --- a/test/jscs.js +++ b/test/jscs.js @@ -11,8 +11,6 @@ describe('jekyllized:jscs', function() { }); it('creates .jscsrc', function() { - assert.file([ - '.jscsrc' - ]); + assert.file('.jscsrc'); }); }); diff --git a/test/jshint.js b/test/jshint.js index d5a8aed..746f637 100644 --- a/test/jshint.js +++ b/test/jshint.js @@ -11,8 +11,6 @@ describe('jekyllized:jshint', function() { }); it('creates .jshintrc', function() { - assert.file([ - '.jshintrc' - ]); + assert.file('.jshintrc'); }); });