-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the update examples task and tests
- Loading branch information
1 parent
ed68eae
commit 8d3ddc6
Showing
9 changed files
with
485 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,6 @@ node_modules | |
|
||
# Users Environment Variables | ||
.lock-wscript | ||
|
||
# Test results | ||
test/actual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"predef": [ | ||
"console", | ||
"describe", | ||
"it", | ||
"after", | ||
"afterEach", | ||
"before", | ||
"beforeEach" | ||
], | ||
|
||
"indent": 4, | ||
"node": true, | ||
"devel": true, | ||
|
||
"bitwise": false, | ||
"curly": false, | ||
"eqeqeq": true, | ||
"forin": false, | ||
"immed": true, | ||
"latedef": false, | ||
"newcap": true, | ||
"noarg": true, | ||
"noempty": false, | ||
"nonew": true, | ||
"plusplus": false, | ||
"regexp": false, | ||
"undef": true, | ||
"unused": "vars", | ||
"quotmark": "single", | ||
"strict": false, | ||
"trailing": true, | ||
"camelcase": true, | ||
|
||
"asi": false, | ||
"boss": true, | ||
"debug": false, | ||
"eqnull": true, | ||
"es5": false, | ||
"esnext": false, | ||
"evil": false, | ||
"expr": false, | ||
"funcscope": false, | ||
"globalstrict": false, | ||
"iterator": false, | ||
"lastsemic": false, | ||
"laxbreak": true, | ||
"laxcomma": false, | ||
"loopfunc": true, | ||
"multistr": false, | ||
"onecase": true, | ||
"regexdash": false, | ||
"scripturl": false, | ||
"smarttabs": false, | ||
"shadow": false, | ||
"sub": false, | ||
"supernew": true, | ||
"validthis": false, | ||
|
||
"nomen": false, | ||
"white": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
|
||
before_install: | ||
- npm instal -g grunt-cli | ||
|
||
script: | ||
- grunt travis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
module.exports = function (grunt) { | ||
require('load-grunt-tasks')(grunt, { | ||
pattern: ['grunt-*', '!grunt-run-task'] | ||
}); | ||
|
||
grunt.initConfig({ | ||
jshint: { | ||
options: { | ||
jshintrc: '.jshintrc' | ||
}, | ||
files: [ | ||
'Gruntfile.js', | ||
'tasks/**/*.js', | ||
'test/**/*.js', | ||
] | ||
}, | ||
simplemocha: { | ||
options: { | ||
reporter: 'spec', | ||
timeout: '5000' | ||
}, | ||
full: { | ||
src: ['test/test.js'] | ||
}, | ||
short: { | ||
options: { | ||
reporter: 'dot' | ||
}, | ||
src: ['test/test.js'] | ||
} | ||
} | ||
}); | ||
|
||
grunt.registerTask('test', ['jshint','simplemocha:full']); | ||
grunt.registerTask('travis', ['test']); | ||
grunt.registerTask('default', 'test'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Web Experience Toolkit (WET) Post Build Grunt Module | ||
|
||
[](http://travis-ci.org/wet-boew/grunt-wet-boew-postbuild) | ||
[](https://david-dm.org/wet-boew/grunt-wet-boew-postbuild) | ||
[](https://david-dm.org/wet-boew/grunt-wet-boew-postbuild#info=devDependencies) | ||
|
||
This module performs various post build task in Continuous Intergration environment. | ||
|
||
## Install | ||
|
||
```sh | ||
$ npm install grunt-wet-boew-postbuild --save-dev | ||
``` | ||
|
||
wet-boew-postbuild depends on nodejs, grunt and git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"name": "grunt-wet-boew-postbuild", | ||
"version": "0.0.0", | ||
"description": "Grunt post build tasks for the Web Experience Toolkit", | ||
"scripts": { | ||
"test": "grunt test" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/wet-boew/grunt-wet-boew-postbuild.git" | ||
}, | ||
"author": "Laurent Goderre <[email protected]> (http://github.com/LaurentGoderre)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/wet-boew/grunt-wet-boew-postbuild/issues" | ||
}, | ||
"homepage": "https://github.com/wet-boew/grunt-wet-boew-postbuild", | ||
"dependencies": { | ||
"node-git-simple": "wet-boew/node-git-simple#v0.1.1" | ||
}, | ||
"devDependencies": { | ||
"expect.js": "^0.3.1", | ||
"grunt": "^0.4.5", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-simple-mocha": "^0.4.0", | ||
"grunt-run-task": "0.1.0-rc8", | ||
"load-grunt-tasks": "^0.6.0", | ||
"mocha": "^1.21.4", | ||
"rimraf": "^2.2.8" | ||
}, | ||
"peerDependencies": { | ||
"grunt": "~0.4.0" | ||
}, | ||
"files": [ | ||
"tasks" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
var Git = require('node-git-simple'); | ||
|
||
module.exports = function(grunt) { | ||
|
||
var callback, silent; | ||
|
||
function errorLog(error) { | ||
if (!silent) { | ||
callback(error); | ||
} else { | ||
callback('Unspecified error (run without silent option for detail)'); | ||
} | ||
} | ||
|
||
function updateExample(repo, options, done) { | ||
var branch = options.branch || 'gh-pages', | ||
oldBranch; | ||
|
||
repo.exec('branch') | ||
.then(function(repo) { | ||
oldBranch = repo.lastCommand.stdout.match(/\*\s*([^\n]*)/)[1]; | ||
return repo.exec('checkout', branch); | ||
}, errorLog) | ||
.then(function(repo) { | ||
return repo.exec('submodule', 'update', '--remote', '--init'); | ||
}, errorLog) | ||
.then(function(repo){ | ||
return repo.exec('add', '.'); | ||
}, errorLog) | ||
.then(function(repo){ | ||
return repo.exec('commit', '-m', options.message); | ||
}, errorLog) | ||
.then(function(repo){ | ||
return repo.exec('push', 'origin', branch); | ||
}, errorLog) | ||
.then(function() { | ||
return repo.exec('checkout', oldBranch); | ||
}) | ||
.then(function(){ | ||
done(); | ||
}); | ||
|
||
} | ||
|
||
grunt.registerMultiTask('wb-update-examples', 'Update working examples', function () { | ||
var options = this.options(), | ||
done; | ||
|
||
if (!options.message){ | ||
return grunt.fail.warn('Mandatory option \'message\' not found.'); | ||
} | ||
|
||
done = this.async(); | ||
callback = done; | ||
|
||
silent = options.slient; | ||
|
||
if (options.repo) { | ||
Git.clone(process.cwd(), options.repo) | ||
.then(function(repo) { | ||
return updateExample(repo, options, done); | ||
}, function(err) { | ||
done(err); | ||
}); | ||
} else { | ||
return updateExample(new Git(process.cwd()), options, done); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
var fs = require('fs'); | ||
var rimraf = require('rimraf'); | ||
|
||
var actual = './test/actual'; | ||
|
||
require('./updateexamples'); | ||
|
||
before(function() { | ||
fs.mkdirSync(actual); | ||
}); | ||
|
||
after(function(){ | ||
rimraf.sync(actual); | ||
}); |
Oops, something went wrong.