• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Sinatra + Heroku
 

Sinatra + Heroku

on

  • 1,856 views

Getting a sinatra site setup and deployed onto the Heroku hosting platform in under 30 min.

Getting a sinatra site setup and deployed onto the Heroku hosting platform in under 30 min.

Statistics

Views

Total Views
1,856
Views on SlideShare
1,850
Embed Views
6

Actions

Likes
1
Downloads
9
Comments
0

2 Embeds 6

http://www.hanrss.com 3
http://viniciusfaria-eventex.herokuapp.com 3

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Sinatra + Heroku Sinatra + Heroku Presentation Transcript

    • Sinatra + Heroku
      (0..Website.new).count <30.minutes
      By Jeremy Woertink
    • Sinatra? Like Frank?
      Yeah, that guy
      • Light-weight Web Framework
      • Rack application
      • Ruby gem
      • Heroku and Github dudes
    • Example please!
      # intro.rb
      require'rubygems'
      require'sinatra'
      get '/'do
      'LV Ruby Group FTW!'
      end
      # Run this with ruby intro.rb
    • Not Convinced Yet?
    • # gangsta.rb
      ['rubygems','sinatra', 'haml'].each { |_gem| require _gem }
      set :public, 'public'
      configure { SEO_DEFAULTS = { :title => 'Sinatra Fun' } }
      get '/'do
      @languages = ['Ruby', 'Erlang', 'NodeJS', 'brainfuck']
      haml :index
      end
      get '/language/:name'do
      @language = "#{params[:name].capitalize} is Sweet!"
      haml :language
      end
      __END__
      @@layout
      !!! 5
      %html
      %head
      %title= SEO_DEFAULTS[:title]
      %link{:href => '/styles.css', :rel => 'stylesheet'}
      %body
      #content
      = yield
      @@index
      %h2 Language Fun!
      %ul
      - @languages.each do |lang|
      %li
      %a{:href=>"/language/#{lang.downcase}"}=lang
      @@language
      %h2= @language
      %a{:href => '/'} Go Back!
    • Put that in your pipe and smoke it!
    • Awesome! How do I get it?
      $ gem install sinatra
      Run your app with
      $ ruby gangsta.rb
    • Time!
      (Not his oku)
      • Awesome Ruby hosting
      • Easy setup & Deploy
      • Scalable Cloud Platform
      • Lowest account is FREE!!!!
      • Ruby gem
      • interfaced with git
      • Purchased by Salesforce for $212M
      • bullet points rock
    • Getting Started on Heroku
      Visit: http://heroku.com/
      Sign up
      Install gem
      Create App
      Deploy
    • Gem for hosting?
      HELL YEAH GEM FOR HOSTING!
      $ gem install heroku
      (Be sure you have git installed already)
    • LET'S DO THIS!
      Things we need to make these two make love
      • sinatra gem
      • heroku gem
      • bundler gem
      • haml gem (not required)
      • git
      • using rackup
    • WHOA! wait... rackup?
      yes..... rackup...
    • # config.ru
      require'rubygems'
      begin
      require'bundler'
      Bundler.require
      require'./app'
      run Sinatra::Application
      rescueLoadError => err
      warn "Where's bundler? #{err}"
      end
    • # Gemfile
      source "http://rubygems.org"
      gem "bundler"
      gem "sinatra"
      gem "heroku"
      gem "haml"
    • File Checklist
      • SampleApp/app.rb
      • SampleApp/config.ru
      • SampleApp/Gemfile
      • SampleApp/views/layout.haml
      • SampleApp/views/index.haml
      • SampleApp/views/language.haml
      • SampleApp/public/styles.css
    • What's next?
    • $ bundle install
      $ git init
      $ git add .
      $ git commit -avm "first commit"
      $ rackup
      $ heroku create
      $ git push heroku master
      <- App should run on localhost:9292
    • BAM!
      How do you like them apples?!
      Questions?