Skip to content

Instantly share code, notes, and snippets.

View ashleygwilliams's full-sized avatar

ashley williams ashleygwilliams

  • 01:47 (UTC -05:00)
View GitHub Profile
get '/' do
erb :index
end
source :rubygems
gem "sinatra"
gem "sqlite3"
gem "activerecord"
gem "sinatra-activerecord"
gem "rake"
group :development do
gem "shotgun"
-- ratpack/
+ -- Gemfile
+ -- Rakefile
+ -- config.ru
+ -- app.rb
+ -- lib/
+ -- model.rb
+ -- views/
+ -- index.erb
+ -- public/
# /lib/model.rb
class Model < ActiveRecord::Base
#stuffs!
end
# app.rb
set :database, "sqlite3:///database.db"
# app.rb
configure do
set :root, File.dirname(__FILE__)
set :public_folder, 'public'
end
# config.ru
require File.join(File.dirname(__FILE__), 'app.rb')
run Name::App
# app.rb
module Name #change 'NAME' to your project name
class App < Sinatra::Application
#...all the stuff! (or at least, most of it)
end
end
# app.rb
Dir.glob('./lib/*.rb') do |model|
require model
end
@ashleygwilliams
ashleygwilliams / app-pt1.rb
Last active December 19, 2015 08:19
gists for ratpack github.io site
# app.rb
require 'bundler'
Bundler.require