Class: Ghundle::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/ghundle/main.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Main

Returns a new instance of Main.



9
10
11
12
# File 'lib/ghundle/main.rb', line 9

def initialize(*args)
  @command = args.shift
  @args    = args
end

Class Method Details

.exec(*args) ⇒ Object



5
6
7
# File 'lib/ghundle/main.rb', line 5

def self.exec(*args)
  new(*args).exec
end

Instance Method Details

#execObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ghundle/main.rb', line 14

def exec
  case @command
  when 'fetch'          then Command::Fetch.call(*@args)
  when 'install'        then Command::Install.call(*@args)
  when 'list-all'       then Command::ListAll.call(*@args)
  when 'list-installed' then Command::ListInstalled.call(*@args)
  when 'run'            then Command::Run.call(*@args)
  when 'uninstall'      then Command::Uninstall.call(*@args)
  else
    raise AppError.new("Unknown command: #{@command}")
  end
end