Class: StoryPullRequest

Inherits:
FinishedCommand show all
Defined in:
lib/pivotal-github/story_pull_request.rb

Instance Attribute Summary

Attributes inherited from Command

#args, #known_options, #options, #unknown_options

Instance Method Summary collapse

Methods inherited from FinishedCommand

#run!

Methods inherited from Command

#initialize, #parse, run!, #story_branch, #story_id, #story_ids

Constructor Details

This class inherits a constructor from Command

Instance Method Details

#cmdObject

Returns a command appropriate for executing at the command line I.e., ‘open www.pivotaltracker.com/story/show/6283185



23
24
25
26
27
28
29
# File 'lib/pivotal-github/story_pull_request.rb', line 23

def cmd
  if skip?
    "open #{uri}"
  else
    "git story-push && open #{uri}"
  end
end

#parserObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pivotal-github/story_pull_request.rb', line 6

def parser
  OptionParser.new do |opts|
    opts.banner = "Usage: git story-pull-request [options]"
    opts.on("-f", "--force", "override unfinished story warning") do |opt|
      self.options.force = opt
    end
    opts.on("-s", "--skip", "skip `git story-push`") do |opt|
      self.options.skip = opt
    end
    opts.on_tail("-h", "--help", "this usage guide") do
      puts opts.to_s; exit 0
    end
  end
end

#uriObject



31
32
33
# File 'lib/pivotal-github/story_pull_request.rb', line 31

def uri
  "#{origin_uri}/pull/new/#{story_branch}"
end