Class: RoCommands::Base

Inherits:
Thor
  • Object
show all
Includes:
Bash
Defined in:
lib/ro_commands/base.rb

Class Method Summary collapse

Methods included from Bash

#_bash, #bash, #bash_lines, #bash_per, #bashc, err, #handle_path, out, status

Class Method Details

.describe(action, item, shortcut_item) ⇒ Object



56
57
58
# File 'lib/ro_commands/base.rb', line 56

def describe(action, item, shortcut_item)
  "#{action} #{item}"
end

.method_added(method) ⇒ Object



39
40
41
42
43
44
# File 'lib/ro_commands/base.rb', line 39

def method_added(method)
  super
  unless method.match(%r{drb_})
    meths << method
  end
end

.methsObject



46
47
48
49
50
# File 'lib/ro_commands/base.rb', line 46

def meths
  @meths.flatten! if @meths.respond_to?(:flatten!)
  @meths.uniq! if @meths.respond_to?(:uniq!)
  @meths ||= []
end

.start(given_args = ARGV, config = {}) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/ro_commands/base.rb', line 28

def start(given_args=ARGV, config={})
  given_args.flatten!
  opt = given_args.extract_options!
  if opt and opt[:pwd]
    Out.out("Current working path is #{opt[:pwd]}")
    Dir.chdir opt[:pwd]
  end
  given_args = given_args - [{pwd: opt[:pwd]}]
  super
end

.usage(meth_name) ⇒ Object



52
53
54
# File 'lib/ro_commands/base.rb', line 52

def usage(meth_name)
  "#{name.split("::")[-1].uncamelize} #{meth_name}"
end