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 ⇒ Object
writeonly
Sets the attribute library.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#library=(value) ⇒ Object (writeonly)
Sets the attribute library
7 8 9 |
# File 'lib/ecic/library_generator.rb', line 7 def library=(value) @library = 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 16 |
# File 'lib/ecic/library_generator.rb', line 13 def create_library_directory src_list_file = File.("#{destination_root}/#{@library.path}/sources.rb") template("src/design/lib/sources.rb.tt", src_list_file) unless File.exist?(src_list_file) end |
#update_library_list ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ecic/library_generator.rb', line 18 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) case @library.path.to_s when "src/design/#{@library.name}" cmd = "design_library('#{@library.name}')" when "src/testbench/#{@library.name}" cmd = "testbench_library('#{@library.name}')" else if @library.is_a_testbench? cmd = "testbench_library('#{@library.name}', :path => '#{@library.path}')" else cmd = "design_library('#{@library.name}', :path => '#{@library.path}')" end end append_to_file 'src/config/libraries.rb', "#{cmd}.create\n" end |