Class: Rys::Bundler::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/rys/bundler/command.rb

Instance Method Summary collapse

Instance Method Details

#exec(command, args) ⇒ Object

For now only “rys” command is available



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/rys/bundler/command.rb', line 6

def exec(command, args)
  if args.include?('-h') || args.include?('--help')
    print_help_and_exit
  end

  # To avoid deleting options
  if args.first.to_s.start_with?('-')
    action = ''
  else
    action = args.shift.to_s
  end

  case action
  when 'add'
    Commands::Add.run(args)
  when 'build', ''
    Commands::Build.run(args)
  when 'ibuild'
    Commands::BuildInteractively.run(args)
  when 'help'
    print_help_and_exit
  else
    raise "Unknow action '#{action}'"
  end
end