Method: Flok::Project.create

Defined in:
lib/flok/project.rb

.create(directory) ⇒ Object

Create a new user-project by coping the templates and compiling the erb files



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/flok/project.rb', line 41

def self.create directory
  #Create new directory for project
  FileUtils.mkdir_p directory
  Dir.chdir directory do
    project_dir = Dir.pwd

    #Go into project_template_dir
    Dir.chdir project_template_dir do
      raw_list.each do |n|
        if File.directory?(n)
          FileUtils.mkdir_p File.join(project_dir, n)
        else
          #Render erb
          erb = ERB.new(File.read(n))
          out = erb.result
          File.write File.join(project_dir, rem_erb(n)), out
        end
      end
    end
  end
end