Class: Ecic::ProjectGenerator

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



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

def self.source_root
  File.dirname(__FILE__) + '/../../templates/project'
end

Instance Method Details

#create_base_filesObject



11
12
13
14
15
16
17
18
# File 'lib/ecic/project_generator.rb', line 11

def create_base_files
  copy_file 'gitignore', '.gitignore'
  copy_file 'config/project.rb', 'src/config/project.rb'
  copy_file 'config/libraries.rb', 'src/config/libraries.rb'
  copy_file 'config/ecic.rb', 'src/config/ecic.rb'
  @ruby_version = '2.4.4'
  template("Gemfile.tt","Gemfile")
end

#create_output_directoriesObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/ecic/project_generator.rb', line 20

def create_output_directories
  empty_directory 'src/design'
  create_file 'src/design/.gitkeep' if Dir.empty?("#{destination_root}/src/design")
  empty_directory 'src/testbench'
  create_file 'src/testbench/.gitkeep' if Dir.empty?("#{destination_root}/src/testbench")
  empty_directory 'src/verification'
  create_file 'src/verification/.gitkeep' if Dir.empty?("#{destination_root}/src/verification")
  empty_directory 'src/external_packages'
  create_file 'src/external_packages/.gitkeep' if Dir.empty?("#{destination_root}/src/external_packages")
end

#git_initObject



31
32
33
# File 'lib/ecic/project_generator.rb', line 31

def git_init
  run 'git init ' + destination_root
end