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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
의존성 주입과 모듈화
fornewid
0
140
How Swift's Type System Guides AI Agents
koher
0
260
第3木曜LT会 #28
tinykitten
PRO
0
110
Reactive ❤️ Loom: A Forbidden Love Story
franz1981
2
240
AI-DLC Deep Dive
yuukiyo
8
4k
アーキテクチャモダナイゼーションとは何か
nwiizo
17
5.1k
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
800
Running Swift without an OS
kishikawakatsumi
0
840
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
180
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
ファインチューニングせずメインコンペを解く方法
pokutuna
0
310
ハーネスエンジニアリングとは?
kinopeee
10
5k
Featured
See All Featured
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
Prompt Engineering for Job Search
mfonobong
0
270
Leo the Paperboy
mayatellez
7
1.7k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
[SF Ruby Conf 2025] Rails X
palkan
2
960
Google's AI Overviews - The New Search
badams
0
970
Documentation Writing (for coders)
carmenintech
77
5.3k
My Coaching Mixtape
mlcsv
0
99
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