Sha256: 67f3617e36f477c7d24e0403453c477c0f9f13d6430e1f123f95e993373b446d

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 KB

Contents

module Toolshed
  module Commands
    class UpdatePivotalTrackerStoryStatus
      STORY_STATUS_DEFAULT = 'finished'

      def execute(args, options = {})
        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

        print "Status (Default: #{Toolshed::PivotalTracker::STORY_STATUS_DEFAULT})? "
        story_status = $stdin.gets.chomp.strip
        if (story_status == '')
          story_status = Toolshed::PivotalTracker::STORY_STATUS_DEFAULT
        end

        begin
          result = pivotal_tracker.update_story_state(story_id, story_status)
          puts "Story Status Updated At: #{result["created_at"]}"
        rescue => e
          puts e.message
          exit
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
toolshed-0.0.4 lib/toolshed/commands/update_pivotal_tracker_story_status.rb
toolshed-0.0.3 lib/toolshed/commands/update_pivotal_tracker_story_status.rb
toolshed-0.0.2 lib/toolshed/commands/update_pivotal_tracker_story_status.rb
toolshed-0.0.1 lib/toolshed/commands/update_pivotal_tracker_story_status.rb