Sha256: afba9dabe50bdb0b00edd27715368ccc8aed8f0454439ed2a8b4d79b47cbc331

Contents?: true

Size: 967 Bytes

Versions: 20

Compression:

Stored size: 967 Bytes

Contents

require 'pivotal-github/command'

class StoryPull < Command

  def parser
    OptionParser.new do |opts|
      opts.banner = "Usage: git story-pull [options]"
      opts.on("-d", "--development BRANCH",
              "development branch (defaults to master)") do |opt|
        self.options.development = 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
  # For example:
  #   git checkout master
  #   git pull
  #   git checkout <story branch>
  def cmd
    lines = ["git checkout #{development_branch}"]
    c = ['git pull']
    c << argument_string(unknown_options) unless unknown_options.empty?
    lines << c.join(' ')
    lines << ["git checkout #{story_branch}"]
    lines.join("\n")
  end

  def run!
    system cmd
  end

  private
  
    def development_branch
      options.development || 'master'
    end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
pivotal-github-0.7.0 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.14 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.12 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.11 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.10 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.9 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.8 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.7 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.6 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.5 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.4 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.3 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.2 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.1 lib/pivotal-github/story_pull.rb
pivotal-github-0.6.0 lib/pivotal-github/story_pull.rb
pivotal-github-0.5.6 lib/pivotal-github/story_pull.rb
pivotal-github-0.5.5 lib/pivotal-github/story_pull.rb
pivotal-github-0.5.4 lib/pivotal-github/story_pull.rb
pivotal-github-0.5.3 lib/pivotal-github/story_pull.rb
pivotal-github-0.5.2 lib/pivotal-github/story_pull.rb