Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- require 'rubygems'
- require 'codefumes_harvester'
- def cuc_success?
- ENV['CUC_RET'] == '0'
- end
- def spec_success?
- ENV['SPEC_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
Add Comment
Please, Sign In to add comment