-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added gulp tasks for release process.
- Includes commands to build and release browser builds - Commands to run node and browser tests with karma
- Loading branch information
Braydon Fuller
committed
Sep 18, 2015
1 parent
452dc53
commit 66a3dbb
Showing
14 changed files
with
284 additions
and
50 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 |
---|---|---|
@@ -1,2 +1,6 @@ | ||
node_modules | ||
bitauth.js | ||
bitauth.min.js | ||
tests.js | ||
|
||
|
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
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 |
---|---|---|
@@ -1,4 +1,12 @@ | ||
language: node_js | ||
sudo: false | ||
node_js: | ||
- '0.10' | ||
- '0.10' | ||
- '0.12' | ||
before_install: | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
install: | ||
- npm install | ||
|
||
|
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
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,29 @@ | ||
{ | ||
"name": "bitauth", | ||
"main": "./bitauth.min.js", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/bitpay/bitauth", | ||
"authors": [ | ||
"BitPay, Inc." | ||
], | ||
"description": "Passwordless authentication using Bitcoin cryptography", | ||
"moduleType": [ | ||
"globals" | ||
], | ||
"keywords": [ | ||
"bitcoin", | ||
"bitcore", | ||
"btc", | ||
"satoshi" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"CONTRIBUTING.md", | ||
"gulpfile.js", | ||
"lib", | ||
"index.js", | ||
"karma.conf.js", | ||
"test" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
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,176 @@ | ||
'use strict'; | ||
|
||
// Run these commands to make a release: | ||
// | ||
// gulp release:checkout-releases | ||
// gulp release:install | ||
// gulp test | ||
// gulp release:bump:<major|minor|patch> | ||
// gulp browser | ||
// gulp release:build-commit | ||
// gulp release:push-tag | ||
// npm publish | ||
// gulp release:checkout-master | ||
// gulp release:bump:<major|minor|patch> | ||
// gulp release:version-commit | ||
// gulp release:push | ||
|
||
var path = require('path'); | ||
var gulp = require('gulp'); | ||
var shell = require('gulp-shell'); | ||
var mocha = require('gulp-mocha'); | ||
var runsequence = require('run-sequence'); | ||
runsequence.use(gulp); | ||
var bump = require('gulp-bump'); | ||
var git = require('gulp-git'); | ||
|
||
var binPath = path.resolve(__dirname, './node_modules/.bin/'); | ||
var browserifyPath = path.resolve(binPath, './browserify'); | ||
var uglifyPath = path.resolve(binPath, './uglifyjs'); | ||
var indexPath = path.resolve(__dirname, './lib/bitauth-browserify'); | ||
var namePath = path.resolve(__dirname, './bitauth'); | ||
var bundlePath = namePath + '.js'; | ||
var minPath = namePath + '.min.js'; | ||
|
||
var browserifyCommand = browserifyPath + ' --require ' + indexPath + ':bitauth -o ' + bundlePath; | ||
var uglifyCommand = uglifyPath + ' ' + bundlePath + ' --compress --mangle -o ' + minPath; | ||
|
||
gulp.task('browser:uncompressed', shell.task([ | ||
browserifyCommand | ||
])); | ||
|
||
gulp.task('browser:compressed', ['browser:uncompressed'], shell.task([ | ||
uglifyCommand | ||
])); | ||
|
||
gulp.task('browser:maketests', shell.task([ | ||
'find test/ -type f -name "*.js" | xargs ' + browserifyPath + ' -o tests.js' | ||
])); | ||
|
||
gulp.task('browser', function(callback) { | ||
runsequence(['browser:compressed'], callback); | ||
}); | ||
|
||
|
||
gulp.task('release:install', function() { | ||
return shell.task([ | ||
'npm install', | ||
]); | ||
}); | ||
|
||
var releaseFiles = ['./package.json', './bower.json']; | ||
|
||
var bumpVersion = function(importance) { | ||
return gulp.src(releaseFiles) | ||
.pipe(bump({ | ||
type: importance | ||
})) | ||
.pipe(gulp.dest('./')); | ||
}; | ||
|
||
['patch', 'minor', 'major'].forEach(function(importance) { | ||
gulp.task('release:bump:' + importance, function() { | ||
bumpVersion(importance); | ||
}); | ||
}); | ||
|
||
gulp.task('release:checkout-releases', function(cb) { | ||
var tempBranch = 'releases/' + new Date().getTime() + '-build'; | ||
git.branch(tempBranch, { | ||
args: '' | ||
}, function() { | ||
git.checkout(tempBranch, { | ||
args: '' | ||
}, cb); | ||
}); | ||
}); | ||
|
||
gulp.task('release:checkout-master', function(cb) { | ||
git.checkout('master', { | ||
args: '' | ||
}, cb); | ||
}); | ||
|
||
gulp.task('release:sign-built-files', shell.task([ | ||
'gpg --yes --out ' + namePath + '.js.sig --detach-sig ' + namePath + '.js', | ||
'gpg --yes --out ' + namePath + '.min.js.sig --detach-sig ' + namePath + '.min.js' | ||
])); | ||
|
||
var buildFiles = ['./package.json']; | ||
var signatureFiles = []; | ||
buildFiles.push(namePath + '.js'); | ||
buildFiles.push(namePath + '.js.sig'); | ||
buildFiles.push(namePath + '.min.js'); | ||
buildFiles.push(namePath + '.min.js.sig'); | ||
buildFiles.push('./bower.json'); | ||
signatureFiles.push(namePath + '.js.sig'); | ||
signatureFiles.push(namePath + '.min.js.sig'); | ||
|
||
var addFiles = function() { | ||
return gulp.src(buildFiles) | ||
.pipe(git.add({ | ||
args: '-f' | ||
})); | ||
}; | ||
|
||
var buildCommit = function() { | ||
var pjson = require('./package.json'); | ||
return gulp.src(buildFiles) | ||
.pipe(git.commit('Build: ' + pjson.version, { | ||
args: '' | ||
})); | ||
}; | ||
|
||
gulp.task('release:add-signed-files', ['release:sign-built-files'], addFiles); | ||
gulp.task('release:add-built-files', addFiles); | ||
gulp.task('release:build-commit', [ | ||
'release:add-signed-files' | ||
], buildCommit); | ||
|
||
gulp.task('release:version-commit', function() { | ||
var pjson = require('./package.json'); | ||
return gulp.src(releaseFiles) | ||
.pipe(git.commit('Bump package version to ' + pjson.version, { | ||
args: '' | ||
})); | ||
}); | ||
|
||
gulp.task('release:push', function(cb) { | ||
git.push('upstream', 'master', { | ||
args: '' | ||
}, cb); | ||
}); | ||
|
||
gulp.task('release:push-tag', function(cb) { | ||
var pjson = require('./package.json'); | ||
var name = 'v' + pjson.version; | ||
git.tag(name, 'Release ' + name, function() { | ||
git.push('upstream', name, cb); | ||
}); | ||
}); | ||
|
||
gulp.task('release:publish', shell.task([ | ||
'npm publish' | ||
])); | ||
|
||
var tests = ['test/**/*.js']; | ||
var testmocha = function() { | ||
return gulp.src(tests).pipe(new mocha({ | ||
recursive: true | ||
})); | ||
}; | ||
var testkarma = shell.task([ | ||
path.resolve(__dirname, './node_modules/karma/bin/karma') + | ||
' start ' + path.resolve(__dirname, './karma.conf.js') | ||
]); | ||
|
||
gulp.task('test:node', testmocha); | ||
gulp.task('test:browser', ['browser:uncompressed', 'browser:maketests'], testkarma); | ||
|
||
gulp.task('test', function(callback) { | ||
runsequence(['test:node'], ['test:browser'], callback); | ||
}); | ||
|
||
gulp.task('benchmark', shell.task([ | ||
'node benchmarks/index.js' | ||
])); |
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
// get base functionality | ||
var bitauth = require('./lib/bitauth-node'); | ||
'use strict'; | ||
|
||
// add node-specific encrypt/decrypt | ||
bitauth.encrypt = require('./lib/encrypt'); | ||
bitauth.decrypt = require('./lib/decrypt'); | ||
bitauth.middleware = require('./lib/middleware/bitauth'); | ||
var bitauth; | ||
if (process.browser) { | ||
bitauth = require('./lib/bitauth-browserify'); | ||
} else { | ||
bitauth = require('./lib/bitauth-node'); | ||
|
||
// add node-specific encrypt/decrypt | ||
bitauth.encrypt = require('./lib/encrypt'); | ||
bitauth.decrypt = require('./lib/decrypt'); | ||
bitauth.middleware = require('./lib/middleware/bitauth'); | ||
} | ||
|
||
module.exports = bitauth; |
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,18 @@ | ||
'use strict'; | ||
|
||
module.exports = function(config) { | ||
|
||
config.set({ | ||
browsers: ['Firefox'], | ||
frameworks: ['mocha'], | ||
singleRun: true, | ||
files: [ | ||
'./tests.js' | ||
], | ||
plugins: [ | ||
'karma-mocha', | ||
'karma-firefox-launcher' | ||
] | ||
}); | ||
|
||
}; |
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
Oops, something went wrong.