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
CSC307 Lecture 06
javiergs
PRO
0
670
Oxlintはいいぞ
yug1224
5
1.1k
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
5.8k
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
610
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
100
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
350
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
400
2年のAppleウォレットパス開発の振り返り
muno92
PRO
0
190
CSC307 Lecture 03
javiergs
PRO
1
480
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
360
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.1k
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
0
990
Featured
See All Featured
A better future with KSS
kneath
240
18k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
230
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
My Coaching Mixtape
mlcsv
0
41
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
180
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
440
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
210
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.3k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
1
1.3k
Navigating Team Friction
lara
192
16k
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