Class: Diamante::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/diamante/project.rb

Class Method Summary collapse

Class Method Details

.new(dirpath) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/diamante/project.rb', line 6

def self.new(dirpath)
  puts "==> Creating new project"

  FileUtils.mkdir_p(dirpath)
  puts "--> Create dir  : #{dirpath}"

  source_file = File.join(__dir__, 'files', 'config.yaml')
  if File.exist?(source_file)
    FileUtils.cp(source_file, dirpath)
    puts "--> Create file : #{dirpath}/config.yaml"
  else
    puts "[Project.new] No file!! #{source_file}"
  end
  puts "... INFO: Customize the value of <fg/files> param!"
rescue StandardError => e
  puts "[Project.new] #{e.message}"
end