class Wombat::InitRunner

Attributes

path[R]

Public Class Methods

new(opts) click to toggle source
# File lib/wombat/init.rb, line 9
def initialize(opts)
  @path = opts.path.nil? ? Dir.pwd : opts.path
end

Public Instance Methods

start() click to toggle source
# File lib/wombat/init.rb, line 13
def start
  copy_files(path)
end

Private Instance Methods

copy_files(path) click to toggle source
# File lib/wombat/init.rb, line 19
def copy_files(path)
  p = path == Dir.pwd ? '.' : path
  gen_dir = "#{File.expand_path("../..", File.dirname(__FILE__))}/generator_files"
  Dir["#{gen_dir}/*"].each do |source|
    if !File.exist?("#{p}/#{File.basename(source)}")
      banner("create: #{p}/#{File.basename(source)}")
      FileUtils.cp_r source, path
    else
      warn("#{p}/#{File.basename(source)} already exists")
    end
  end
end