require "sinatra_generator/version" require 'fileutils' module SinatraGenerator class Generator MAIN_RB = %{require 'sinatra' get '/' do erb :index end } LAYOUT_ERB = %{ Hello World <%= yield %> } INDEX_ERB = %{

hello world

} def new_app(folder_name) 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