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
- #entity_stream_name ⇒ Object
- #generate_component ⇒ Object
-
#initialize(args = [], options = {}, config = {}) ⇒ Component
constructor
A new instance of Component.
- #service_name ⇒ Object
Constructor Details
#initialize(args = [], options = {}, config = {}) ⇒ Component
41 42 43 44 |
# File 'lib/command_line/component_generator/commands/component.rb', line 41 def initialize(args=[], ={}, config={}) super self.destination_root = component_root_dir_name end |
Class Method Details
.source_root ⇒ Object
37 38 39 |
# File 'lib/command_line/component_generator/commands/component.rb', line 37 def self.source_root File.dirname(__FILE__) + '/../../../../source' end |
Instance Method Details
#assign_executable_attribute ⇒ Object
50 51 52 53 54 55 |
# File 'lib/command_line/component_generator/commands/component.rb', line 50 def assign_executable_attribute chmod './install-gems.sh', 0755 chmod './test.sh', 0755 chmod 'script/test-database-connection', 0755 chmod 'script/start', 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
29 30 31 |
# File 'lib/command_line/component_generator/commands/component.rb', line 29 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 |
#entity_stream_name ⇒ Object
25 26 27 |
# File 'lib/command_line/component_generator/commands/component.rb', line 25 def entity_stream_name @entity_stream_name ||= Casing::Camel.(entity_name) end |
#generate_component ⇒ Object
46 47 48 |
# File 'lib/command_line/component_generator/commands/component.rb', line 46 def generate_component directory('./') end |
#service_name ⇒ Object
33 34 35 |
# File 'lib/command_line/component_generator/commands/component.rb', line 33 def service_name @service_name ||= entity_name.gsub('_', '-') end |