Sha256: 0d6f6cce05ecbf85b04abc778c159f116081cbd5983b5b6c8a786a95b750fada

Contents?: true

Size: 1.14 KB

Versions: 9

Compression:

Stored size: 1.14 KB

Contents

require 'pivotal-github/command'
require 'pivotal-github/finished_command'

class StoryPullRequest < FinishedCommand

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

  # Returns a command appropriate for executing at the command line
  # I.e., 'open https://www.pivotaltracker.com/story/show/62831853'
  def cmd
    "git pull-request"
  end

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

  private

    # Returns the raw remote location for the repository.
    # E.g., http://github.com/mhartl/pivotal-github or
    # git@github.com:mhartl/pivotal-github
    def remote_location
      `git config --get remote.origin.url`.strip.chomp('.git')
    end

    # Returns the remote URI for the repository.
    # Both https://... and git@... remote formats are supported.
    def origin_uri
      remote_location.sub(/^git@(.+?):(.+)$/, 'https://\1/\2')
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pivotal-github-1.0.6 lib/pivotal-github/story_pull_request.rb
pivotal-github-1.0.5 lib/pivotal-github/story_pull_request.rb
pivotal-github-1.0.4 lib/pivotal-github/story_pull_request.rb
pivotal-github-1.0.3 lib/pivotal-github/story_pull_request.rb
pivotal-github-1.0.2 lib/pivotal-github/story_pull_request.rb
pivotal-github-1.0.1 lib/pivotal-github/story_pull_request.rb
pivotal-github-1.0.0 lib/pivotal-github/story_pull_request.rb
pivotal-github-0.9.1 lib/pivotal-github/story_pull_request.rb
pivotal-github-0.9.0 lib/pivotal-github/story_pull_request.rb