Sha256: 3dc219196bd8b25f913d93edc6f8ee51b09355497959236da0777d284c044b50
Contents?: true
Size: 870 Bytes
Versions: 1
Compression:
Stored size: 870 Bytes
Contents
require "sinatra_generator/version" require 'fileutils' module SinatraGenerator class Generator MAIN_RB = %{require 'sinatra' get '/' do erb :index end } LAYOUT_ERB = %{<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Hello World</title> </head> <body> <%= yield %> </body> } INDEX_ERB = %{<h1>hello world</h1> } 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sinatra_generator-0.0.2 | lib/sinatra_generator.rb |