Class: RubyPatchesMerger::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_patches_merger/cli.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Cli

Returns a new instance of Cli.



10
11
12
# File 'lib/ruby_patches_merger/cli.rb', line 10

def initialize(args)
  @args = args.map{|arg| arg.split(/[ ,]/)}.flatten
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/ruby_patches_merger/cli.rb', line 3

def args
  @args
end

Class Method Details

.run(args) ⇒ Object



5
6
7
8
# File 'lib/ruby_patches_merger/cli.rb', line 5

def self.run(args)
  cli = new(args)
  cli.run
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
# File 'lib/ruby_patches_merger/cli.rb', line 14

def run
  if args.empty?
    puts "No arguments given - try: ruby_patches_merger revision1 revision2,revision3"
  else
    require 'ruby_patches_merger/revisions'
    RubyPatchesMerger::Revisions.new(args).save_to("patches")
  end
end