Your first Sinatra app




 Create a basic Sinatra web,
      in just 2 minutes
           ..or less
Thursday, February 3, 2011




Mario Zaizar
@ Twitter, Github, Facebook, **
Thursday, February 3, 2011
06:18pm
(finished at)




Mario Zaizar
@ Twitter, Github, Facebook, *.*
ok,
o_O
      Sinatra?
Sinatra is.

Is a Ruby web frameworkIt's written in Ruby. dah
       It's based in URLs, get, put, delete..
      Sinatra is a very simple, yet powerful,
   Domain Specific Language (DSL) +RESTful



http://www.sinatrarb.com/
Advantages

Its, simple, only have what you need.Better performance than Rails.
  You can use gems. There is life beyond Rails.Templates, Views, supports
       *all of them. good for? API implmentations, quick demos, minimal
                              applications, widgets..
Disadvantages


No Rails mystical magic, forgot it.Everything from scratch,
  only your needs.Isn't the best MVC frameworkNot so
                  popular, than others
Lets go!


Installing the core, yeah, we'll need
        rocks, stars, and mud
 Create a folder, install ruby, group
  all the gems in a single gemset.
Define which ruby, your gemset name,
and enable them by default.



* rvm is your only friend.

$ mkdir ~/rubyc/ && cd ~/rubyc;
$ touch .rvmrc && open .rvmrc;

Paste:
rvm 1.9.1@rubyc --create


Reload your bash, let rvm bring the magic!
Manage your gems with Gemfile and
Bundler
Install bundler, use a Gemfile to declare all your required gems,
repositories, version locking stuff, etc.

$ gem install bundler;
$ touch Gemfile && open Gemfile;

Paste :
source :rubygems
gem 'sinatra'

Use bundler to install and maintain them.
$ bundle install;
Step 1 / 19
Create your App.
$ touch rubyc.rb && gedit rubyc.rb

Paste:
require 'sinatra'
get '/' do
    "It works!"
end
get '/hi:name' do
    "Hello #{params[:name]}!"
end
Step 2 to 18
Make coffee.
Test your App!                 Step 19 / 19


Start the server.
$ ruby rubyc.rb

Open it
$ open http://localhost:4567




                                   Click me!
That's easy :P
Links?


 ruby lang
 sinatra framework
 sinatra and bundler best way
Thanks!
    d(n_n)b




 ^C
 == Sinatra has ended his set (crowd applauds)
        Download me http://bit.ly/dXJn1H

Your first sinatra app

  • 1.
    Your first Sinatraapp Create a basic Sinatra web, in just 2 minutes ..or less
  • 2.
    Thursday, February 3,2011 Mario Zaizar @ Twitter, Github, Facebook, **
  • 3.
    Thursday, February 3,2011 06:18pm (finished at) Mario Zaizar @ Twitter, Github, Facebook, *.*
  • 4.
    ok, o_O Sinatra?
  • 7.
    Sinatra is. Is aRuby web frameworkIt's written in Ruby. dah It's based in URLs, get, put, delete.. Sinatra is a very simple, yet powerful, Domain Specific Language (DSL) +RESTful http://www.sinatrarb.com/
  • 8.
    Advantages Its, simple, onlyhave what you need.Better performance than Rails. You can use gems. There is life beyond Rails.Templates, Views, supports *all of them. good for? API implmentations, quick demos, minimal applications, widgets..
  • 9.
    Disadvantages No Rails mysticalmagic, forgot it.Everything from scratch, only your needs.Isn't the best MVC frameworkNot so popular, than others
  • 10.
    Lets go! Installing thecore, yeah, we'll need rocks, stars, and mud Create a folder, install ruby, group all the gems in a single gemset.
  • 11.
    Define which ruby,your gemset name, and enable them by default. * rvm is your only friend. $ mkdir ~/rubyc/ && cd ~/rubyc; $ touch .rvmrc && open .rvmrc; Paste: rvm 1.9.1@rubyc --create Reload your bash, let rvm bring the magic!
  • 12.
    Manage your gemswith Gemfile and Bundler Install bundler, use a Gemfile to declare all your required gems, repositories, version locking stuff, etc. $ gem install bundler; $ touch Gemfile && open Gemfile; Paste : source :rubygems gem 'sinatra' Use bundler to install and maintain them. $ bundle install;
  • 13.
    Step 1 /19 Create your App. $ touch rubyc.rb && gedit rubyc.rb Paste: require 'sinatra' get '/' do "It works!" end get '/hi:name' do "Hello #{params[:name]}!" end
  • 14.
    Step 2 to18 Make coffee.
  • 15.
    Test your App! Step 19 / 19 Start the server. $ ruby rubyc.rb Open it $ open http://localhost:4567 Click me!
  • 16.
  • 17.
    Links? ruby lang sinatra framework sinatra and bundler best way
  • 18.
    Thanks! d(n_n)b ^C == Sinatra has ended his set (crowd applauds) Download me http://bit.ly/dXJn1H