Class: RailsUpgrade::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-upgrade/cli.rb

Class Method Summary collapse

Class Method Details

.execute(stdout, arguments = []) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rails-upgrade/cli.rb', line 4

def execute(stdout, arguments=[])
  if arguments.empty?
    raise "Give me a command!"
  end
  
  command = arguments.pop.capitalize

  if RailsUpgrade::Upgraders.const_defined?(command)
    klass = RailsUpgrade::Upgraders.const_get(command)
    instance = klass.new
    
    instance.upgrade!(arguments)
  else
    usage
  end
end

.usageObject



21
22
23
# File 'lib/rails-upgrade/cli.rb', line 21

def usage
  puts "fail"
end