Posts tagged edge
Setting up a Rails 5 app from edge
6Update: 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
1 2 3 | 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.
1 | rvm use 2.2.2@rails-5-edge-test --create |
3. Install edge Rails so we can generate a new project
1 2 3 4 5 6 7 8 9 | 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
1 | 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!
1 | bin/rails server |