class Ecic::LibraryGenerator

Attributes

library[W]

Public Class Methods

source_root() click to toggle source
# File lib/ecic/library_generator.rb, line 9
def self.source_root
  File.dirname(__FILE__) + '/../../templates/project'
end

Public Instance Methods

create_library_directory() click to toggle source
# File lib/ecic/library_generator.rb, line 13
def create_library_directory
  src_list_file = File.expand_path("#{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() click to toggle source
# File lib/ecic/library_generator.rb, line 18
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)
  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