Sha256: e20a949741bfdc522f976c3c97a8612c5a1d8918784c2911336b68a219cb2d31

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module Toolshed
  module Commands
    class CreatePivotalTrackerNote
      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 "Note? "
        note_text = $stdin.gets.chomp.strip

        begin
          result = pivotal_tracker.add_note(story_id, note_text)
          puts result.inspect
        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/create_pivotal_tracker_note.rb
toolshed-0.0.3 lib/toolshed/commands/create_pivotal_tracker_note.rb
toolshed-0.0.2 lib/toolshed/commands/create_pivotal_tracker_note.rb
toolshed-0.0.1 lib/toolshed/commands/create_pivotal_tracker_note.rb