Method: Conify::Command#create_commands_map
- Defined in:
- lib/conify/command.rb
#create_commands_map ⇒ Object
Create a commands map to respond to ‘conify help` with.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 |
# File 'lib/conify/command.rb', line 196 def create_commands_map # Require all the ruby command files command_file_paths.each do |file| require file # Get basename for the file without the extension basename = get_basename_from_file(file) # Camelcase the basename to be the klass name klass_name = camelize(basename) # return the command klass for this klass_name command_klass = Conify::Command.const_get(klass_name) # For each of the user-defined methods inside this class, create a command for it manually_added_methods(command_klass).each { |method| register_command(basename, method.to_s, command_klass, global: basename == 'global') } end end |