Sha256: 5d0b3fcad6acb80bd0ec99375634781625a3ebee15a08b08724fe4b66d906f68

Contents?: true

Size: 942 Bytes

Versions: 7

Compression:

Stored size: 942 Bytes

Contents

require 'pivotal-github/command'

class StoryMerge < Command

  def parser
    OptionParser.new do |opts|
      opts.banner = "Usage: git story-merge [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 merge --no-ff <story branch>
  def cmd
    lines = ["git checkout #{development_branch}"]
    c = ['git merge --no-ff']
    c << argument_string(unknown_options) unless unknown_options.empty?
    c << story_branch
    lines << c.join(' ')
    lines.join("\n")
  end

  def run!
    system cmd
  end

  private

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pivotal-github-0.6.1 lib/pivotal-github/story_merge.rb
pivotal-github-0.6.0 lib/pivotal-github/story_merge.rb
pivotal-github-0.5.6 lib/pivotal-github/story_merge.rb
pivotal-github-0.5.5 lib/pivotal-github/story_merge.rb
pivotal-github-0.5.4 lib/pivotal-github/story_merge.rb
pivotal-github-0.5.3 lib/pivotal-github/story_merge.rb
pivotal-github-0.5.2 lib/pivotal-github/story_merge.rb