module SelfList
takelage self list
Public Instance Methods
self_list()
click to toggle source
Backend method for config self.
# File lib/takelage/self/list.rb, line 6 def self_list _manipulate_output_(_get_thor_list_) end
Private Instance Methods
_get_thor_list_()
click to toggle source
Get output of thor list command.
# File lib/takelage/self/list.rb, line 13 def _get_thor_list_ # use Thorfile which requires relative takelage.rb thorfile_dir = "#{File.dirname(__FILE__)}/../" # use thor list to get the list of commands and subcommands cmd_thor_list = "bash -c '" \ "cd #{thorfile_dir} && " \ 'thor list' \ "'" # call thor list command `#{cmd_thor_list}` end
_manipulate_output_(thor_list)
click to toggle source
Manipulate output of thor list command.
# File lib/takelage/self/list.rb, line 28 def _manipulate_output_(thor_list) tau_list = thor_list.gsub("takelage\n", '') tau_list.gsub!("------\n", '') tau_list.gsub!('thor ', 'tau ') tau_list.gsub!(/(.*)takelage:c_l_i:(.*)#(.*)/, '\1\2 #\3') tau_list.gsub!(/.*COMMAND.*\n/, '') end