Sinatra + Heroku<br />(0..Website.new).count <30.minutes<br />By Jeremy Woertink<br />
Sinatra? Like Frank?<br />Yeah, that guy<br /><ul><li>Light-weight Web Framework
Rack application
Ruby gem
Heroku and Github dudes</li></li></ul><li>Example please!<br /># intro.rb<br />require'rubygems'<br />require'sinatra'<br ...
Not Convinced Yet?<br />
# gangsta.rb <br />['rubygems','sinatra', 'haml'].each { |_gem| require _gem }<br />set :public, 'public'<br />configure {...
Put that in your pipe and smoke it!<br />
Awesome! How do I get it?<br />$ gem install sinatra<br />Run your app with<br />$ ruby gangsta.rb<br />
 Time!<br />(Not his oku)<br /><ul><li>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</li></li></ul><li>Getting Started on Heroku<br />Visit: http://heroku.com/<br />Sign up<br />Install ge...
Gem for hosting?<br />HELL YEAH GEM FOR HOSTING!<br />$ gem install heroku<br />(Be sure you have git installed already)<b...
Upcoming SlideShare
Loading in...5
×

Sinatra + Heroku

1,545

Published on

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

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,545
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Sinatra + Heroku"

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

    Clipping is a handy way to collect important slides you want to go back to later.

×