Class: Ecic::LibraryGenerator
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Ecic::LibraryGenerator
- Includes:
- Thor::Actions
- Defined in:
- lib/ecic/library_generator.rb
Instance Attribute Summary collapse
-
#library_name ⇒ Object
writeonly
Sets the attribute library_name.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#library_name=(value) ⇒ Object (writeonly)
Sets the attribute library_name
7 8 9 |
# File 'lib/ecic/library_generator.rb', line 7 def library_name=(value) @library_name = value end |
Class Method Details
.source_root ⇒ Object
9 10 11 |
# File 'lib/ecic/library_generator.rb', line 9 def self.source_root File.dirname(__FILE__) + '/../../templates/project' end |
Instance Method Details
#create_library_directory ⇒ Object
13 14 15 |
# File 'lib/ecic/library_generator.rb', line 13 def create_library_directory template("src/design/lib/sources.rb.tt", "src/design/#{@library_name}/sources.rb") end |
#update_library_list ⇒ Object
17 18 19 20 21 22 |
# File 'lib/ecic/library_generator.rb', line 17 def update_library_list libraries_file = File.("#{destination_root}/src/config/libraries.rb") empty_directory 'src/config' unless File.exist?(File.dirname(libraries_file)) create_file libraries_file unless File.exist?(libraries_file) append_to_file 'src/config/libraries.rb', "library.create('#{@library_name}')\n" end |