Created
April 20, 2013 04:43
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
require 'rubygems' | |
require 'bundler' | |
Bundler.require(:default) | |
@config = YAML::load_file('config.yml') | |
def send_deploying_message(rev) | |
send("#{human} is deploying bot (revision #{rev}) to production.") | |
end | |
def send_finished_deploy_message(rev) | |
send("#{human} finished deploying bot (revision #{rev}) to production.", "yellow") | |
end | |
def send(message, color = "green") | |
api_token = @config['hipchat']['token'] | |
client = HipChat::Client.new(api_token) | |
client['Rocodev Log'].send('Deploy', message, :color => color) | |
end | |
def human | |
`git config user.name` | |
end | |
def revision | |
version = `git ls-remote git@github.com:rocodev/Your-repo.git master` | |
version[0..7] | |
end | |
task :deploy do | |
rev = revision | |
send_deploying_message(rev) | |
system "gitploy production" | |
send_finished_deploy_message(rev) | |
puts "done!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment