Module: Kharites::SetupMixin

Included in:
Base
Defined in:
lib/kharites/mixins/generate.rb

Instance Method Summary collapse

Instance Method Details

#generateObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/kharites/mixins/generate.rb', line 3

def generate
  Dir.mkdir(@base_dir) unless File.exists?(@base_dir)

  Dir[File.join(File.dirname(__FILE__), "..", "templates", "article", "*")].each do |template|
    begin
      FileUtils.cp_r(template, @base_dir)
    rescue Errno::EEXIST
    end
  end

  FileUtils.cd(@base_dir) {|dir| FileUtils.mv("article.yml", "#{dir}.yml") unless "#{dir}.yml" == "article.yml"}

  puts "Done"
end