Class: CodeFumesHarvester::IntegrityNotifier::CodeFumes

Inherits:
Integrity::Notifier::Base
  • Object
show all
Defined in:
lib/codefumes_harvester/integrity_notifier/codefumes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build, config = {}) ⇒ CodeFumes

Returns a new instance of CodeFumes.



16
17
18
19
20
21
22
23
24
# File 'lib/codefumes_harvester/integrity_notifier/codefumes.rb', line 16

def initialize(build, config={})
  @public_key  = config["public_key"]
  @private_key = config["private_key"]
  @build_name  = config["build_name"]
  @repo_path   = Integrity::Repository.new(
    build.id, build.project.uri, build.project.branch, build.commit.identifier
  ).directory
  super(build, config)
end

Instance Attribute Details

#private_keyObject (readonly)

Returns the value of attribute private_key.



10
11
12
# File 'lib/codefumes_harvester/integrity_notifier/codefumes.rb', line 10

def private_key
  @private_key
end

#public_keyObject (readonly)

Returns the value of attribute public_key.



10
11
12
# File 'lib/codefumes_harvester/integrity_notifier/codefumes.rb', line 10

def public_key
  @public_key
end

Class Method Details

.to_hamlObject



12
13
14
# File 'lib/codefumes_harvester/integrity_notifier/codefumes.rb', line 12

def self.to_haml
  @haml ||= File.read(File.dirname(__FILE__) + "/codefumes.haml")
end

Instance Method Details

#deliver!Object



26
27
28
29
30
31
32
33
34
# File 'lib/codefumes_harvester/integrity_notifier/codefumes.rb', line 26

def deliver!
  Integrity.log "Updating build '#{@build_name}' for '#{@public_key}' (state: #{build_state})"
  qb_options = {:public_key  => @public_key,
                :private_key => @private_key,
                :ended_at    => @build.completed_at,
                :repository_path => @repo_path}

  CodeFumesHarvester::QuickBuild.finish(@build_name, build_state, qb_options)
end

#deliver_started_notification!Object



36
37
38
39
40
41
42
43
44
# File 'lib/codefumes_harvester/integrity_notifier/codefumes.rb', line 36

def deliver_started_notification!
  Integrity.log "Adding build '#{@build_name}' for '#{@public_key}' (state: #{build_state})"
  qb_options = {:public_key  => @public_key,
                :private_key => @private_key,
                :started_at  => @build.started_at,
                :repository_path => @repo_path}

  CodeFumesHarvester::QuickBuild.start(@build_name, qb_options)
end