Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Sinatra: My Way
Search
Matthew Conway
July 19, 2012
Programming
8
1.1k
Sinatra: My Way
How I'm using Sinatra: structure and useful scripts
Matthew Conway
July 19, 2012
Tweet
Share
More Decks by Matthew Conway
See All by Matthew Conway
Building Heroku Add-ons
mattonrails
2
750
Other Decks in Programming
See All in Programming
Cell-Based Architecture
larchanjo
0
160
CSC307 Lecture 01
javiergs
PRO
0
650
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
310
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
140
ローカルLLMを⽤いてコード補完を⾏う VSCode拡張機能を作ってみた
nearme_tech
PRO
0
230
Python札幌 LT資料
t3tra
7
1.1k
愛される翻訳の秘訣
kishikawakatsumi
3
370
SQL Server 2025 LT
odashinsuke
0
120
Deno Tunnel を使ってみた話
kamekyame
0
310
これならできる!個人開発のすゝめ
tinykitten
PRO
0
140
Patterns of Patterns
denyspoltorak
0
410
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
300
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
870
Technical Leadership for Architectural Decision Making
baasie
0
200
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
89
HDC tutorial
michielstock
1
290
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.8k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Speed Design
sergeychernyshev
33
1.5k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
2
280
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
1
340
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Transcript
SINATRA my way
MATTHEW CONWAY @mattonrails
what is this? why am i here?
we’re going to learn you some standards! sinatra: you’re great.
but
we’re going to learn you some standards! sinatra: you’re great.
but (yeah, don’t tell him i said that)
to avoid confusion, we need to make some rules...
not ‘all the time’ rules, but within an application
ring-a ding-ding
you need... more structure handy scripts
so... we’re doin it your way?
(frank’s a smart guy)
STRUCTURE
classic style modular style not
the simple app
Gemfile Procfile app.rb config.ru script/
# Gemfile source :rubygems gem ‘sinatra’ gem ‘foreman’ gem ‘unicorn’
group :development do gem ‘shotgun’ gem ‘thin’ end
# Procfile web: bundle exec unicorn --port $PORT
# app.rb module Haiku class App < Sinatra::Base get ‘/’
do @haiku = Redis.srandmember(‘haiku’) haml :home end ... end end
# config.ru require ‘./app’ run Haiku::App
as it grows
Gemfile Procfile Rakefile app/ config/ config.ru db/ script/
Com Fl With M ...or collaborate with me ...or something
where do I start?
is bundler installed? do i have the required ruby? o
noes imagemagick! forgot to migrate... nice of you to mention those environment variables I apparently need to set yum install all --the --things brew uninstall patience mysqladmin -u wizard create blawg_development
None
script/bootstrap
“Never send a README to do a setup script’s job.”
@trek Trek Glowacki
script/bootstrap dependency checks bundler database setup does your job
HOW IS SINATRA SERVER FORMED?* * http://cl.ly/ICAy
ruby le_app.rb rackup -p 5000 thin --rackup config.ru start shotgun
-p 5000 bieber_site.rb
None
script/server
look familiar?
script/console
BONUS!
know how to get a console to sinatra on heroku?
maybe that’s a trick question
maybe that’s a trick question (since it depends)
heroku run script/console
now you can!
IN SUMMARY
Furthe Reading
Sinatra: Up and Running Alan Harris Konstantin Haase
YOU develop your own conventions for building sinatra apps share
them with the community
Thanks!
Asap, Omnibus Type Lavenderi , Lost Typ Menlo