Class: CommandLine::ComponentGenerator::Commands::Component
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- CommandLine::ComponentGenerator::Commands::Component
- Includes:
- Thor::Actions
- Defined in:
- lib/command_line/component_generator/commands/component.rb
Class Method Summary collapse
Instance Method Summary collapse
- #assign_executable_attribute ⇒ Object
- #component_constant_name ⇒ Object
- #component_name ⇒ Object
- #component_root_dir_name ⇒ Object
- #entity_constant_name ⇒ Object
- #entity_name ⇒ Object
- #generate_component ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ Component
33 34 35 36 |
# File 'lib/command_line/component_generator/commands/component.rb', line 33 def initialize(args=[], ={}, config={}) super self.destination_root = component_root_dir_name end |
Class Method Details
.source_root ⇒ Object
29 30 31 |
# File 'lib/command_line/component_generator/commands/component.rb', line 29 def self.source_root File.dirname(__FILE__) + '/../../../../source' end |
Instance Method Details
#assign_executable_attribute ⇒ Object
42 43 44 45 |
# File 'lib/command_line/component_generator/commands/component.rb', line 42 def assign_executable_attribute chmod './install-gems.sh', 0755 chmod './test.sh', 0755 end |
#component_constant_name ⇒ Object
17 18 19 |
# File 'lib/command_line/component_generator/commands/component.rb', line 17 def component_constant_name @component_constant_name ||= Casing::Pascal.(component_name) end |
#component_name ⇒ Object
9 10 11 |
# File 'lib/command_line/component_generator/commands/component.rb', line 9 def component_name @component_name ||= name.end_with?('_component') ? name : "#{name}_component" end |
#component_root_dir_name ⇒ Object
13 14 15 |
# File 'lib/command_line/component_generator/commands/component.rb', line 13 def component_root_dir_name @component_dir_name ||= component_name.gsub('_','-') end |
#entity_constant_name ⇒ Object
25 26 27 |
# File 'lib/command_line/component_generator/commands/component.rb', line 25 def entity_constant_name @entity_constant_name ||= Casing::Pascal.(component_name.gsub('_component', '')) end |
#entity_name ⇒ Object
21 22 23 |
# File 'lib/command_line/component_generator/commands/component.rb', line 21 def entity_name @entity_name ||= Casing::Underscore.(entity_constant_name) end |
#generate_component ⇒ Object
38 39 40 |
# File 'lib/command_line/component_generator/commands/component.rb', line 38 def generate_component directory('./') end |