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
1.1k
8
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
780
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
510
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.8k
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
130
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
460
PHP初心者セッション2026 〜生成AIでは見えない裏側を知る:今だからLAMPを通して仕組みを学ぶ〜
kashioka
0
810
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
180
継続モナドとリアクティブプログラミング
yukikurage
3
680
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
160
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
3.5k
使用 Meilisearch 建立新聞搜尋工具
johnroyer
0
210
yield再入門 #phpcon
o0h
PRO
0
920
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
400
Featured
See All Featured
Technical Leadership for Architectural Decision Making
baasie
3
460
Embracing the Ebb and Flow
colly
88
5.1k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
430
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.4k
Chasing Engaging Ingredients in Design
codingconduct
0
260
Music & Morning Musume
bryan
47
7.3k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
380
Un-Boring Meetings
codingconduct
0
370
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Faster Mobile Websites
deanohume
310
32k
GitHub's CSS Performance
jonrohan
1033
470k
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