Skip to content

Commit

Permalink
Simplify the introduction, remove example modular app, shift bundler …
Browse files Browse the repository at this point in the history
…setup into hello world example

Signed-off-by: Konstantin Haase <konstantin.mailinglists@googlemail.com>
  • Loading branch information
Zachary Scott authored and rkh committed Sep 27, 2010
1 parent d60076e commit d8ab38c
Showing 1 changed file with 16 additions and 47 deletions.
63 changes: 16 additions & 47 deletions book/Introduction.markdown
Expand Up @@ -59,74 +59,43 @@ framework. You need to have Git version control software installed
these steps:

**Rake**

gem install rake

1. cd where/you/keep/your/projects
2. git clone git://github.com/sinatra/sinatra.git
3. cd sinatra
4. rake install

Then add this to your application:

require 'sinatra'

**Bundler**
Alternatively you can use bundler (http://gembundler.com/).

gem install bundler

Let's setup a quick modularized Sinatra application to show us which version
we're running.

If you're using bundler, you'll have to create a gemfile listening sinatra's
dependencies; and other gem dependencies. In your application's root create
your 'Gemfile'.

#~/Gemfile
gem "sinatra", :git => "git://github.com/sinatra/sinatra.git"
source "http://rubygems.org/"
gem "rack"

In this example we will use [rack](http://http://github.com/rack/rack). You
could setup bundler to use the git version, but that is up to you.

Go ahead and create a new file 'config.ru' in your application's root.

#~/config.ru
require 'rubygems'
require 'bundler'
Bundler.setup

require 'sinatra'

# possible environment setup options
set :env, :development
set :port, 4567
disable :run, :reload

require 'my_app.rb'
gem install bundler

run MyApp
To use edge sinatra with bundler, you'll have to create a gemfile listing
sinatra's dependencies; and other dependencies for your application. In your
application's root create your 'Gemfile':

To start your sinatra rack application just `rackup` from your application's
root:
gem 'sinatra', :git => 'git://github.com/sinatra/sinatra.git'
source 'http://rubygems.org/'

rackup config.ru
Here we use the gemcutter source to specify where to get Sinatra's
dependencies; alternatively you can use the git version, but that is up to you.
So now we can install our bundle:

You can check the version you are running by adding this route to your
application (my_app.rb) and loading `http://localhost:9292/about` in your
browser.

get '/about' do
"I'm running on Version " + Sinatra::VERSION
end
bundle install


Hello World Application
-----------------------
Sinatra is installed, how about making your first application?

require 'rubygems'

# If you're using bundler, you will need to add these 2 lines
require 'bundler'
Bundler.setup

require 'sinatra'

get '/' do
Expand Down

0 comments on commit d8ab38c

Please sign in to comment.