Class: Celebrations::PivotalTracker

Inherits:
Celebration show all
Includes:
Announce
Defined in:
lib/release_party/celebrations/pivotal_tracker.rb

Instance Attribute Summary collapse

Attributes inherited from Celebration

#environment

Instance Method Summary collapse

Methods included from Announce

#announce

Methods inherited from Celebration

inherited, #tasks

Constructor Details

#initialize(env) ⇒ PivotalTracker

Returns a new instance of PivotalTracker.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/release_party/celebrations/pivotal_tracker.rb', line 14

def initialize(env)
  super env
  arguments_required(:project_id, :project_api_key)

  require 'pivotal-tracker'

  @project_id = environment.project_id
  @project_api_key = environment.project_api_key

  ::PivotalTracker::Client.token = environment.project_api_key

  begin
    @project = ::PivotalTracker::Project.find(environment.project_id)
  rescue RestClient::Request::Unauthorized => e
    announce 'Unable to authenticate with pivotal, perhaps your API key is wrong.' +
      "Message: #{e.message}"
  end
end

Instance Attribute Details

#projectObject (readonly)

Returns the value of attribute project.



12
13
14
# File 'lib/release_party/celebrations/pivotal_tracker.rb', line 12

def project
  @project
end

#project_idObject (readonly)

Returns the value of attribute project_id.



11
12
13
# File 'lib/release_party/celebrations/pivotal_tracker.rb', line 11

def project_id
  @project_id
end

Instance Method Details

#after_deployObject



38
39
40
41
42
43
44
45
# File 'lib/release_party/celebrations/pivotal_tracker.rb', line 38

def after_deploy
  # Deliver all finished stories if the deliver_finished flag is set
  if environment.deliver_finished? && environment.deliver_finished
    finished_stories.each do |story|
      story.update(:current_state => 'delivered')
    end
  end
end

#before_deployObject



33
34
35
36
# File 'lib/release_party/celebrations/pivotal_tracker.rb', line 33

def before_deploy
  environment.finished_stories = finished_stories
  environment.known_bugs = known_bugs
end