Setting up a Rails 5 app from edge

Update: Many people reported issues with installing the proper version of Rack, so I’ve updated step 3 to account for that.

I just returned from RailsConf 2015 and wanted to checkout some of the new features of Rails 5 that @dhh highlighted in his keynote. Here’s how I got up and running on edge rails in a few quick steps.

1. Create the project directory

cd ~/Projects/Test
mkdir rails-5-edge-test
cd rails-5-edge-test

2. Setup your environment

Rails 5 requires Ruby >= 2.2.2. I’m using RVM in this case, but you can use whatever Ruby environment manager that works for you.

rvm use 2.2.2@rails-5-edge-test --create

3. Install edge Rails so we can generate a new project

touch Gemfile
cat > Gemfile <<END_CONF
source "https://rubygems.org"
ruby '2.2.2'
gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'rack', :git => 'git://github.com/rack/rack.git'
gem 'arel', :git => 'git://github.com/rails/arel.git'
END_CONF
bundle

Note that we included both Arel and Rack from source as well. At the time of writing, ActiveRecord requires Arel >= 7.0.0.alpha which isn’t available on RubyGems.org yet, and ActionPack requires Rack >= 2.0 which also isn’t released yet, so these two lines are required to resolve that dependency.

4. Generate the rails app

bundle exec rails new . --dev --force

The --force flag will allow Rails to overwrite our Gemfile, and the --dev flag tells Rails to point to the edge version of Rails that we just bundled.

5. Profit!

bin/rails server

 

6 thoughts on “0

  1. I am having the same problems. Rails version 5.0.0.beta3
    Ruby version 2.3.0-p0 (x86_64-linux)
    RubyGems version 2.5.1
    Rack version 2.0.0.alpha
    Middleware Rack::Sendfile, ActionDispatch::Static, ActionDispatch::LoadInterlock, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, Rack::Head, Rack::ConditionalGet, Rack::ETag, ActionView::Digestor::PerRequestDigestCacheExpiry
    Application root /home/jendiamond/Desktop/note_api
    Environment development
    Database adapter sqlite3
    Database schema version 0

    When I run: $ bundle install railties/exe/rails
    ERROR: “bundle install” was called with arguments [“railties/exe/rails”]
    Usage: “bundle install [OPTIONS]”

    I am on Linux Ubuntu 14.04 LTE

    1. Line 8 in step 3 calls `bundle` which invokes the `install` subcommand, which I’m guessing you may have overlooked if you were following along. Looks like you got it resolved though. How’d the rest of your exploration go?

    1. I ran into the same issue (September 20, 2015) but adding rack to the Gemfile is not resolving the dependency. The current release on the rack master branch is 2.0.0.alpha so it should satisfy it…

Comments are closed.

Love is a snowmobile racing across the tundra and then suddenly it flips over, pinning you underneath. At night, the ice weasels come.

— Matt Groening