Class: CodeFumesHarvester::QuickBuild

Inherits:
Object
  • Object
show all
Defined in:
lib/codefumes_harvester/quick_build.rb

Class Method Summary collapse

Class Method Details

.finish(build_name, success_or_failure, options = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/codefumes_harvester/quick_build.rb', line 28

def self.finish(build_name, success_or_failure, options = {})
  repo = SourceControl.new(options[:repository_path] || './')

  commit_identifier = options[:commit_identifier] || repo.local_commit_identifier
  public_key        = options[:public_key]  || repo.public_key
  private_key       = options[:private_key] || repo.private_key
  ended_at          = options[:ended_at]  || Time.now

  build = CodeFumes::Build.find(:public_key => public_key,
                                :private_key => private_key,
                                :commit_identifier => commit_identifier,
                                :identifier => build_name
                               )
  return false if build.nil?
  build.state = success_or_failure.to_s
  build.ended_at = ended_at
  build.save
end

.start(build_name, options = {}) ⇒ Object

Creates a new build for the CodeFumes project linked at the specified repository path and associates it with the current local commit identifier

Returns true if the request succeeded.

Returns false if the request failed.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/codefumes_harvester/quick_build.rb', line 10

def self.start(build_name, options = {})
  repo = SourceControl.new(options[:repository_path] || './')

  commit_identifier = options[:commit_identifier] || repo.local_commit_identifier
  public_key        = options[:public_key]  || repo.public_key
  private_key       = options[:private_key] || repo.private_key
  started_at        = options[:started_at]  || Time.now

  build = CodeFumes::Build.new(:public_key => public_key,
                               :private_key => private_key,
                               :commit_identifier => commit_identifier,
                               :name => build_name,
                               :state => "running",
                               :started_at => started_at,
                               :ended_at   => "")
  build.save
end