Method: GoodData::Command::Scaffold.project
- Defined in:
- lib/gooddata/commands/scaffold.rb
.project(name) ⇒ Object
Scaffolds new project TODO: Add option for custom output dir
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/gooddata/commands/scaffold.rb', line 19 def project(name) fail ArgumentError, 'No name specified' if name.nil? FileUtils.mkdir(name) FileUtils.cd(name) do FileUtils.mkdir('model') FileUtils.cd('model') do input = File.read(TEMPLATES_PATH + 'project/model/model.rb.erb') erb = ERB.new(input) File.open('model.rb', 'w') do |f| f.write(erb.result_with_hash(: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') erb = ERB.new(input) File.open('Goodfile', 'w') do |f| f.write(erb.result) end end end |