Created
October 22, 2008 03:45
-
-
Save jakehow/18534 to your computer and use it in GitHub Desktop.
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
desc "Discover previous revision" | |
task :set_previous_revision do | |
previous_revision = "" | |
run "tail -2 #{deploy_to}/revisions.log" do |ch, stream, out| | |
previous_revision = out.split[3] | |
end | |
set :previous_revision, previous_revision | |
end | |
desc "Send release notes for latest revision via Basecamp" | |
task :send_release_notes do | |
require 'lib/basecamp' | |
BC_URL = 'yoururl' | |
BC_USR = 'username' | |
BC_PWD = 'pass' | |
PROJECT_ID = 1111 | |
CATEGORY_ID = 2222 | |
system "svn log -r HEAD:#{previous_revision} #{repository} > /tmp/rel.notes" | |
notes = IO.read("/tmp/rel.notes") | |
session = Basecamp.new(BC_URL, BC_USR, BC_PWD) | |
body = "This is an automatically generated message notifying the team of updates to the production site.\n\n" + notes | |
#This pulls all the people from the 2 companies on this project, that way if anyone is added, no re-editing | |
NOTIFY_IDS = (session.people(COMPANYID1, PROJECT_ID)+ session.people(COMPANYID2, PROJECT_ID)).map { |p| p.id } | |
msg = session.post_message(PROJECT_ID, | |
{ :title => "New Updates Deployed to the Production Server" | |
:body =>body, | |
:category_id => CATEGORY_ID }, | |
NOTIFY_IDS ) | |
end | |
desc "Send release notes after deploy" | |
task :after_deploy do | |
set_previous_revision | |
send_release_notes | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment