Skip to content

Instantly share code, notes, and snippets.

@tomkersten
Forked from anonymous/gist:442767
Created June 26, 2010 16:07
Show Gist options
  • Save tomkersten/454157 to your computer and use it in GitHub Desktop.
Save tomkersten/454157 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
require 'rubygems'
require 'codefumes_harvester'
def cuc_success?
ENV['CUC_RET'] == '0'
end
def spec_success?
ENV['SPEC_RET'] == '0'
end
def ant_success?
ENV['ANT_RET'] == '0'
end
pub_key = ENV['CF_PUBLIC_KEY']
priv_key = ENV['CF_PRIVATE_KEY']
svn_rev = ENV['SVN_REVISION']
latest_rev = CodeFumes::Commit.latest_identifier(pub_key)
if ARGV[0] == "start"
payload = CodeFumes::Payload.new(:public_key => pub_key,
:private_key => priv_key,
:content => {:commits => [{:identifier => svn_rev, :parent_identifiers => latest_rev}]})
payload.save
build = CodeFumes::Build.new(:public_key => pub_key,
:private_key => priv_key,
:commit_identifier => svn_rev,
:name => "StandardBuild",
:started_at => Time.now,
:state => "running")
build.save
elsif ARGV[0] == "end"
if cuc_success? && spec_success?
status = "successful"
else
status = "failed"
end
build = CodeFumes::Build.find(:public_key => pub_key, :private_key => priv_key, :commit_identifier => latest_rev, :identifier => "StandardBuild")
build.state = status
build.ended_at = Time.now
build.save
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment