Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
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
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
790
Other Decks in Programming
See All in Programming
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
880
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.6k
エージェントを使い続けるためのメタワーク / Meta-work for keeping using the agent
rkaga
1
550
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
360
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
220
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
3
610
最近”作らせてる” ローカルAIアプリの話
akit37
0
480
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
1k
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.3k
Railsのためのパスキー実践入門 〜マルチテナントSaaSでの意思決定〜
utakaha
3
900
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
dotNET_vulnclicker_intro.pdf
deka_morita
0
150
Featured
See All Featured
Accessibility Awareness
sabderemane
1
250
Building Applications with DynamoDB
mza
96
7.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.3k
Visualization
eitanlees
153
17k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Everyday Curiosity
cassininazir
0
360
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
410
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
How GitHub (no longer) Works
holman
316
150k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Are puppies a ranking factor?
jonoalderson
2
4.1k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
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