Class: Alienor::CoreInitializer

Inherits:
Object
  • Object
show all
Defined in:
lib/alienor/initializer.rb

Overview

~ require ‘FileUtils’ # redundant ?

Class Method Summary collapse

Class Method Details

.construct(src) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/alienor/initializer.rb', line 15

def construct(src)
  puts "initializing... with #{src}"
  
  # rename index.html if necessary
  target_dir = File.join @root, "public"
  if File.exist? index_file = File.join(target_dir, "index.html")
    File.rename index_file, File.join(target_dir, "index_0.html")
    puts "renaming index.html"
  end
  
  # copy all files recursively
  FileUtils.cp_r File.join(src, "."), @root
end

.setup(app_name, root) ⇒ Object



10
11
12
13
# File 'lib/alienor/initializer.rb', line 10

def setup (app_name, root)
  @app_name = app_name
  @root = root
end