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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Matthew Conway
July 19, 2012
Programming
1.1k
8
Share
Sinatra: My Way
How I'm using Sinatra: structure and useful scripts
Matthew Conway
July 19, 2012
More Decks by Matthew Conway
See All by Matthew Conway
Building Heroku Add-ons
mattonrails
2
760
Other Decks in Programming
See All in Programming
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
830
PHPer、Cloudflare に引っ越す
suguruooki
1
110
[RubyKaigi 2026] Require Hooks
palkan
1
230
Spec Driven Development | AI Summit Vilnius
danielsogl
PRO
1
110
Swift Concurrency Type System
inamiy
1
550
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
200
Kingdom of the Machine
yui_knk
2
920
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
250
From Formal Specification to Property Based Test
ohbarye
0
350
AIを導入する前にやるべきこと
negima
2
250
iOS機能開発のAI環境と起きた変化
ryunakayama
0
190
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
1
440
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.6k
Tell your own story through comics
letsgokoyo
1
900
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
340
Building the Perfect Custom Keyboard
takai
2
740
Faster Mobile Websites
deanohume
310
31k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Discover your Explorer Soul
emna__ayadi
2
1.1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.1k
Automating Front-end Workflow
addyosmani
1370
200k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
240
Optimising Largest Contentful Paint
csswizardry
37
3.7k
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
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