Class: Command
Constant Summary
Constants included from PathCommon
PathCommon::CONFIG_FILE, PathCommon::PROJECT_DIR
Instance Attribute Summary collapse
-
#base_name ⇒ Object
Returns the value of attribute base_name.
-
#classes ⇒ Object
Returns the value of attribute classes.
-
#operations ⇒ Object
Returns the value of attribute operations.
-
#target_dir ⇒ Object
Returns the value of attribute target_dir.
-
#template_dir ⇒ Object
Returns the value of attribute template_dir.
Instance Method Summary collapse
- #get_classes ⇒ Object
- #get_operations ⇒ Object
- #get_target_dir ⇒ Object
- #get_template_dir ⇒ Object
-
#initialize(params) ⇒ Command
constructor
A new instance of Command.
Methods included from PathCommon
#absolute_path, #get_path, #join, #parse_string
Constructor Details
#initialize(params) ⇒ Command
Returns a new instance of Command.
10 11 12 13 14 15 16 |
# File 'lib/command.rb', line 10 def initialize(params) @params = params get_template_dir get_target_dir get_classes get_operations end |
Instance Attribute Details
#base_name ⇒ Object
Returns the value of attribute base_name.
8 9 10 |
# File 'lib/command.rb', line 8 def base_name @base_name end |
#classes ⇒ Object
Returns the value of attribute classes.
8 9 10 |
# File 'lib/command.rb', line 8 def classes @classes end |
#operations ⇒ Object
Returns the value of attribute operations.
8 9 10 |
# File 'lib/command.rb', line 8 def operations @operations end |
#target_dir ⇒ Object
Returns the value of attribute target_dir.
8 9 10 |
# File 'lib/command.rb', line 8 def target_dir @target_dir end |
#template_dir ⇒ Object
Returns the value of attribute template_dir.
8 9 10 |
# File 'lib/command.rb', line 8 def template_dir @template_dir end |
Instance Method Details
#get_classes ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/command.rb', line 26 def get_classes classes = get_param("-c") if classes @classes = parse_string( classes ) else @base_name = @params[1] @classes = nil end end |
#get_operations ⇒ Object
35 36 37 |
# File 'lib/command.rb', line 35 def get_operations @operations = parse_string( operations = get_param("-op") || " " ) end |
#get_target_dir ⇒ Object
23 24 25 |
# File 'lib/command.rb', line 23 def get_target_dir @target_dir = absolute_path(get_param("-d") || ".") end |
#get_template_dir ⇒ Object
17 18 19 20 21 22 |
# File 'lib/command.rb', line 17 def get_template_dir template = get_param("-t") || @params[0] get_templates(template).each do |dir| @template_dir = dir if File.directory?(dir) end end |