Class: Ecic::LibraryGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/ecic/library_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#library_name=(value) ⇒ Object (writeonly)

Sets the attribute library_name

Parameters:

  • value

    the value to set the attribute library_name to.



7
8
9
# File 'lib/ecic/library_generator.rb', line 7

def library_name=(value)
  @library_name = value
end

Class Method Details

.source_rootObject



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_directoryObject



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_listObject



17
18
19
20
21
22
# File 'lib/ecic/library_generator.rb', line 17

def update_library_list
  libraries_file = File.expand_path("#{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