Class: LucaDeal::Setup

Inherits:
Object
  • Object
show all
Defined in:
lib/luca_deal/setup.rb

Class Method Summary collapse

Class Method Details

.create_project(dir) ⇒ Object

create project skeleton under specified directory



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/luca_deal/setup.rb', line 9

def self.create_project(dir)
  Dir.mkdir(dir) unless Dir.exist?(dir)
  Dir.chdir(dir) do
    FileUtils.cp("#{__dir__}/templates/config.yml", 'config.yml') unless File.exist?('config.yml')
    Dir.mkdir('data') unless Dir.exist?('data')
    Dir.chdir('data') do
      %w[contracts customers invoices no_invoices].each do |subdir|
        Dir.mkdir(subdir) unless Dir.exist?(subdir)
      end
    end
  end
end