class RubyPatchesMerger::Cli

Attributes

args[R]

Public Class Methods

new(args) click to toggle source
# File lib/ruby_patches_merger/cli.rb, line 10
def initialize(args)
  @args = args.map{|arg| arg.split(/[ ,]/)}.flatten
end
run(args) click to toggle source
# File lib/ruby_patches_merger/cli.rb, line 5
def self.run(args)
  cli = new(args)
  cli.run
end

Public Instance Methods

help(message = nil) click to toggle source
# File lib/ruby_patches_merger/cli.rb, line 14
    def help(message = nil)
      puts message if message
      puts <<HELP
Usage: ruby_patches_merger [download|help]

 - download revisions,list
 - help

HELP
    end
run() click to toggle source
# File lib/ruby_patches_merger/cli.rb, line 25
def run
  case args[0]
  when 'download'
    require 'ruby_patches_merger/revisions'
    RubyPatchesMerger::Revisions.new(args[1..-1]).save_to("patches")
  when nil, 'help', '--help'
    help
  else
    help "Unknown arguments given '#{args*" "}'."
  end
end