Created
February 10, 2012 18:13
-
-
Save tritonrc/1791382 to your computer and use it in GitHub Desktop.
Example Dreadnot stack with Rails 3.2 and Heroku
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
var async = require('async') | |
var git = require('util/git') | |
var misc = require('util/misc') | |
exports.get_deployedRevision = function(args, callback) { | |
git.revParse(this.config.program_creator_dir, 'HEAD', function(err, stdout) { | |
callback(null, stdout.replace(/^\s+|\s+$/g, '')) | |
}) | |
} | |
exports.task_preDeploy = function(stack, baton, args, callback) { | |
var env = process.env | |
env['RAILS_ENV'] = stack.config.env | |
var opts = { cwd: stack.config.program_creator_dir, env: env } | |
async.series([ | |
function pullFromGithub(callback) { | |
misc.taskSpawn(baton, args, ['git', 'pull'], opts, callback) | |
}, | |
function bundleInstall(callback) { | |
misc.taskSpawn(baton, args, ['bundle', 'install'], opts, callback) | |
}, | |
function dbDrop(callback) { | |
misc.taskSpawn(baton, args, ['bundle', 'exec', 'rake', 'db:drop'], opts, callback) | |
}, | |
function dbMigrate(callback) { | |
misc.taskSpawn(baton, args, ['bundle', 'exec', 'rake', 'db:migrate'], opts, callback) | |
}, | |
function dbSeed(callback) { | |
misc.taskSpawn(baton, args, ['bundle', 'exec', 'rake', 'db:seed'], opts, callback) | |
}, | |
function compileAssets(callback) { | |
misc.taskSpawn(baton, args, ['bundle', 'exec', 'rake', 'assets:precompile'], opts, callback) | |
} | |
], callback) | |
} | |
exports.task_deploy = function(stack, baton, args, callback) { | |
var opts = { cwd: stack.config.program_creator_dir, env: process.env } | |
async.series([ | |
function pushToHeroku(callback) { | |
misc.taskSpawn(baton, args, ['git', 'push', 'heroku', 'master'], opts, callback) | |
} | |
], callback) | |
} | |
exports.targets = { | |
'deploy' : [ | |
'task_preDeploy' | |
, 'task_deploy' | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment