Sha256: 0a98530a7b4363aa2a9984923ab054811d28f7bdccba442159c13979c0101288

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

module Toolshed
  module Commands
    class GetPivotalTrackerStoryInformation
      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::TicketTracking::PivotalTracker.new({
              project_id: project_id,
              username: Toolshed::TicketTracking::PivotalTracker.username,
              password: Toolshed::TicketTracking::PivotalTracker.password,
          })

          default_story_id = Toolshed::TicketTracking::PivotalTracker::story_id_from_branch_name(Toolshed::Git::Base.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_information(story_id)
          result.instance_variables.each do |name, value|
            puts "#{name}: #{result.instance_variable_get(name).inspect}"
          end
          exit
        rescue => e
          puts e.message
          exit
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toolshed-0.0.8 lib/toolshed/commands/get_pivotal_tracker_story_information.rb
toolshed-0.0.7 lib/toolshed/commands/get_pivotal_tracker_story_information.rb
toolshed-0.0.6 lib/toolshed/commands/get_pivotal_tracker_story_information.rb