Sha256: 711303be01aa617c4e4103df8338354ef779232ddbdc81969ec562e1dbce3110
Contents?: true
Size: 871 Bytes
Versions: 1
Compression:
Stored size: 871 Bytes
Contents
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 = %{<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Hello World</title> </head> <body> <%= yield %> </body> } index_erb = %{<h1>hello world</h1>} 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.1 | lib/sinatra_generator.rb |