Class: Toolshed::Commands::GetPivotalTrackerStoryInformation

Inherits:
Object
  • Object
show all
Defined in:
lib/toolshed/commands/get_pivotal_tracker_story_information.rb

Instance Method Summary collapse

Instance Method Details

#execute(args, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/toolshed/commands/get_pivotal_tracker_story_information.rb', line 4

def execute(args, options = {})
  begin
    print "Project ID (Default: #{Toolshed::Client.default_pivotal_tracker_project_id})? "
    project_id = $stdin.gets.chomp.strip
    if (project_id == '')
      project_id = Toolshed::Client.default_pivotal_tracker_project_id
    end

    pivotal_tracker = Toolshed::PivotalTracker.new({ project_id: project_id})
    github = Toolshed::Github.new

    default_story_id = Toolshed::PivotalTracker::story_id_from_branch_name(github.branch_name)
    print "Story ID (Default: #{default_story_id})? "
    story_id = $stdin.gets.chomp.strip
    if (story_id == '')
      story_id = default_story_id
    end

    result = pivotal_tracker.(story_id)
    puts "Name: #{result.name}"
    puts "Url: #{result.url}"
    puts "Description: #{result.description}"
    exit
  rescue => e
    puts e.message
    exit
  end
end