Sha256: c5b4fc6b15a39e72bbe7403be5b0612d9b0deeadfa4455b0c4440e5ab5095d9f

Contents?: true

Size: 769 Bytes

Versions: 2

Compression:

Stored size: 769 Bytes

Contents

module Ecic

  class LibraryGenerator < Thor::Group
    include Thor::Actions
    desc 'Generate a new RTL library'

    attr_writer :library_name
    
    def self.source_root
      File.dirname(__FILE__) + '/../../templates'
    end

    def create_library_directory
      copy_file 'project/src/design/lib/sources.rb', "src/design/#{@library_name}/sources.rb"
    end

    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', "\nlibrary.create('#{@library_name}')"
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ecic-0.4.0 lib/ecic/library_generator.rb
ecic-0.3.0 lib/ecic/library_generator.rb