require "sinatra_generator/version" require 'fileutils' module SinatraGenerator class Generator def new_app(folder_name) main_rb = %{require 'sinatra' get '/' do 'hello world' end } layout_erb = %{ Hello World <%= yield %> } index_erb = %{

hello world

} FileUtils.mkdir folder_name FileUtils.chdir folder_name do File.write 'main.rb', main_rb FileUtils.mkdir 'views' FileUtils.mkdir 'public' FileUtils.chdir 'public' do FileUtils.mkdir 'stylesheets' FileUtils.mkdir 'javascripts' end FileUtils.chdir 'views' do File.write 'layout.erb', layout_erb File.write 'index.erb', index_erb end end end end end