SlideShare une entreprise Scribd logo
1  sur  8
Télécharger pour lire hors ligne
Building Ruby Applications
       With Sinatra

           January 5, 2012
        East Bay Rails Meetup
Outline
      Sinatra, Bootstrap and RSpec


• Sinatra vs. Rails
• Random Text Generator
• Sinatra Routes
• TDD with RSpec
• Bootstrap
Sinatra vs. Rails

• Lighter, rack-based alternative to Rails.
• Pro & Con: Less structure.
• Does not enforce MVC.
• Supports Rails toolchain: Gemfile, etc.
Random Text Generator
       http://asdftextgenerator.com/




• Serving up asdf and Lorem Ipsum text.
• No back-end, various options available.
• Modular, reusable design.
Sinatra Routes
    Example route pattern with named parameter


get '/hello/:name' do
  # matches "GET /hello/foo" and "GET /hello/bar"
  # params[:name] is 'foo' or 'bar'
  "Hello #{params[:name]}!"
end
TDD with RSpec
       Setup in spec_helper



RSpec.configure do |config|
 config.include Rack::Test::Methods
end
Bootstrap
CSS Framework built with Less by Twitter



 get 'stylesheets/bootstrap.css' do
 end
References


• Sinatra: http://sinatrarb.com/
• Redis: http://redis.io/
  Sinatra-Redis Tutorial:
• http://goo.gl/xktVk
  Bootstrap.js:
• http://twitter.github.com/bootstrap/

Contenu connexe

En vedette (6)

Senior Communicator Briefing.1
Senior Communicator Briefing.1Senior Communicator Briefing.1
Senior Communicator Briefing.1
 
Pres. Villa Maria
Pres. Villa MariaPres. Villa Maria
Pres. Villa Maria
 
Stepanova COLLECTION
Stepanova COLLECTIONStepanova COLLECTION
Stepanova COLLECTION
 
AIESEC HUST 09Fall招新进行时——信息学院
AIESEC HUST 09Fall招新进行时——信息学院AIESEC HUST 09Fall招新进行时——信息学院
AIESEC HUST 09Fall招新进行时——信息学院
 
AIESEC HUST 09Fall 招新——人文学院
AIESEC HUST 09Fall 招新——人文学院AIESEC HUST 09Fall 招新——人文学院
AIESEC HUST 09Fall 招新——人文学院
 
Learning Preferences
Learning PreferencesLearning Preferences
Learning Preferences
 

Similaire à East Bay Rails: January 2012

Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvm
NLJUG
 
Learning to code for startup mvp session 3
Learning to code for startup mvp session 3Learning to code for startup mvp session 3
Learning to code for startup mvp session 3
Henry S
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]
Karel Minarik
 

Similaire à East Bay Rails: January 2012 (20)

Ruby off Rails---rack, sinatra and sequel
Ruby off Rails---rack, sinatra and sequelRuby off Rails---rack, sinatra and sequel
Ruby off Rails---rack, sinatra and sequel
 
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
Strangers In The Night: Ruby, Rack y Sinatra - Herramientas potentes para con...
 
Sinatra
SinatraSinatra
Sinatra
 
Sinatra
SinatraSinatra
Sinatra
 
Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2Ruby on Rails & PostgreSQL - v2
Ruby on Rails & PostgreSQL - v2
 
Rails - getting started
Rails - getting startedRails - getting started
Rails - getting started
 
Ramaze
RamazeRamaze
Ramaze
 
Ruby w/o Rails (Олександр Сімонов)
Ruby w/o Rails (Олександр Сімонов)Ruby w/o Rails (Олександр Сімонов)
Ruby w/o Rails (Олександр Сімонов)
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 
Shootout! template engines on the jvm
Shootout! template engines on the jvmShootout! template engines on the jvm
Shootout! template engines on the jvm
 
Website designing company_in_delhi_phpwebdevelopment
Website designing company_in_delhi_phpwebdevelopmentWebsite designing company_in_delhi_phpwebdevelopment
Website designing company_in_delhi_phpwebdevelopment
 
Shootout! Template engines for the JVM
Shootout! Template engines for the JVMShootout! Template engines for the JVM
Shootout! Template engines for the JVM
 
Sinatra Basics
Sinatra BasicsSinatra Basics
Sinatra Basics
 
Learning to code for startup mvp session 3
Learning to code for startup mvp session 3Learning to code for startup mvp session 3
Learning to code for startup mvp session 3
 
RoR 101: Session 1
RoR 101: Session 1RoR 101: Session 1
RoR 101: Session 1
 
Introduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman OrtegaIntroduction to Rails - presented by Arman Ortega
Introduction to Rails - presented by Arman Ortega
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]
 
Ruby on Rails Vs. ASP.NET MVC
Ruby on Rails Vs. ASP.NET MVCRuby on Rails Vs. ASP.NET MVC
Ruby on Rails Vs. ASP.NET MVC
 
How DSL works on Ruby
How DSL works on RubyHow DSL works on Ruby
How DSL works on Ruby
 
How to build a PostgreSQL-backed website quickly
How to build a PostgreSQL-backed website quicklyHow to build a PostgreSQL-backed website quickly
How to build a PostgreSQL-backed website quickly
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

East Bay Rails: January 2012

  • 1. Building Ruby Applications With Sinatra January 5, 2012 East Bay Rails Meetup
  • 2. Outline Sinatra, Bootstrap and RSpec • Sinatra vs. Rails • Random Text Generator • Sinatra Routes • TDD with RSpec • Bootstrap
  • 3. Sinatra vs. Rails • Lighter, rack-based alternative to Rails. • Pro & Con: Less structure. • Does not enforce MVC. • Supports Rails toolchain: Gemfile, etc.
  • 4. Random Text Generator http://asdftextgenerator.com/ • Serving up asdf and Lorem Ipsum text. • No back-end, various options available. • Modular, reusable design.
  • 5. Sinatra Routes Example route pattern with named parameter get '/hello/:name' do # matches "GET /hello/foo" and "GET /hello/bar" # params[:name] is 'foo' or 'bar' "Hello #{params[:name]}!" end
  • 6. TDD with RSpec Setup in spec_helper RSpec.configure do |config| config.include Rack::Test::Methods end
  • 7. Bootstrap CSS Framework built with Less by Twitter get 'stylesheets/bootstrap.css' do end
  • 8. References • Sinatra: http://sinatrarb.com/ • Redis: http://redis.io/ Sinatra-Redis Tutorial: • http://goo.gl/xktVk Bootstrap.js: • http://twitter.github.com/bootstrap/