Class: RailsPlusPlus
Class Method Summary
collapse
Methods inherited from MoreUtils
flag_lookup, gem_version, get_args, get_file_str, get_flags, root, this_dir, versions, write_file, wrong_version_error
Class Method Details
.check_directory ⇒ Object
22
23
24
|
# File 'lib/railspp.rb', line 22
def check_directory
File.file?(root + '/bin/rails')
end
|
.error_string ⇒ Object
18
19
20
|
# File 'lib/railspp.rb', line 18
def error_string
'ERROR: Must make railspp commands in the rails root directory'
end
|
.run_command(arguments) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/railspp.rb', line 26
def run_command arguments
is_help = arguments.select { |e| e == '--help' || e == '-h' }.length > 0
command_name = arguments[0]
passable_args = arguments[1..-1]
lookup = is_help ? command_name_help_lookup : command_name_lookup
command_exists = !command_name.nil? && !lookup[command_name.to_sym].nil?
if command_exists
command_class = lookup[command_name.to_sym]
command_class.run(*passable_args)
else
DocumentationHelpCommand.run(descriptions.join("\n"))
end
end
|