Module: Reflection::CLI

Defined in:
lib/reflection/cli.rb

Class Method Summary collapse

Class Method Details

.run!(args = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/reflection/cli.rb', line 5

def run!(args = nil)
  config = Reflection::Config.parse(args)
  
  if config.command == :show_version
    puts "Version: #{Reflection.version}"
    exit
  end
  
  if verify_config(config) == false
    Reflection::Support.exit_with_error("Missing arguments. Please read 'reflection --help' to get a feeling of how it works.")
  else
    case config.command
      when :apply
        Reflection::Command::Apply.run!(config)
      when :stash
        Reflection::Command::Stash.run!(config)
      else
        Reflection::Support.exit_with_error("Couldn't identify command. Please run 'reflection --help'.")
    end
  end
end