Class: WeBee::Command

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Command

Returns a new instance of Command.



12
13
14
# File 'lib/webee/command.rb', line 12

def initialize(args)
  @argv = args
end

Class Method Details

.execute(cmd) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/webee/command.rb', line 26

def self.execute(cmd)
  require "#{File.dirname(__FILE__)}/commands/#{cmd}.rb"
  klass = WeBee::Commands.const_get cmd.capitalize
  obj = klass.new(ARGV)
  obj.parse_options
  obj.run
end

.list_allObject



4
5
6
7
8
9
10
# File 'lib/webee/command.rb', line 4

def self.list_all
  cmds = []
  Dir[File.dirname(__FILE__) + '/commands/*.rb'].each do |cmd|
    cmds << File.basename(cmd, '.rb')
  end
  cmds
end


19
20
21
22
23
24
# File 'lib/webee/command.rb', line 19

def self.print_help(cmd)
  require "#{File.dirname(__FILE__)}/commands/#{cmd}.rb"
  klass = WeBee::Commands.const_get cmd.capitalize
  obj = klass.new(ARGV)
  obj.help
end

Instance Method Details

#helpObject



16
17
# File 'lib/webee/command.rb', line 16

def help
end