lib/gooddata/commands/scaffold.rb in gooddata-0.6.0.pre7 vs lib/gooddata/commands/scaffold.rb in gooddata-0.6.0.pre8

- old
+ new

@@ -1,8 +1,39 @@ module GoodData::Command class Scaffold class << self + def project(name) + require 'erubis' + require 'fileutils' + + templates_path = Pathname(__FILE__) + "../../../templates" + + FileUtils.mkdir(name) + FileUtils.cd(name) do + + FileUtils.mkdir("model") + FileUtils.cd("model") do + input = File.read(templates_path + 'project/model/model.rb.erb') + eruby = Erubis::Eruby.new(input) + File.open("model.rb", 'w') do |f| + f.write(eruby.result(:name => name)) + end + end + + FileUtils.mkdir("data") + FileUtils.cd("data") do + FileUtils.cp(Dir.glob(templates_path + 'project/data/*.csv'), ".") + end + + input = File.read(templates_path + 'project/Goodfile.erb') + eruby = Erubis::Eruby.new(input) + File.open("Goodfile", 'w') do |f| + f.write(eruby.result()) + end + end + end + def brick(name) require 'erubis' require 'fileutils' \ No newline at end of file