EdgeRails is a term which means you are running a local copy of a developmental version of Rails (i.e., you’re on the bleeding edge). It is an alternative to the more standard GemRails, which means you are running one of the stable releases (i.e., you installed it with the GEM packaging system).
The advantage to running EdgeRails is that you may get access to new features or bug fixes that are not in the most recent stable release. Also EdgeRails allows you to run on computer without Rails installed. Or you could run EdgeRails in a shared web hosting machine (see RailsWebHosts) that may only have the major releases installed on the system, but not the edge rails.
The disadvantage is that developmental versions are not generally regarded to be stable. So it’s a tradeoff.
In order to use EdgeRails you simply have to embed a (developmental) version of Rails within your application rather than using the version installed on your machine as a library. In that way, a developer working on multiple Rails applications can have some running off of GemRails, and others running off of various versions of EdgeRails, as these latter applications would have their own individual versions of Rails embedded within them.
To embed a version of Rails within your application, the relevant files are copied into the vendor/rails directory.
Simply use this command from your application home directory to unpack the latest edge rails into your application vendor/rails directory:
rake rails:freeze:edge
This embeds the Rails framework into your application by using Subversion (svn) to copy the files from the developmental source code repository (dev.rubyonrails.org) into your vendor/rails directory. Subversion is necessary even if you are not using it to manage the source code of your own project.
If you would like to run a specific revision of EdgeRails, then you can refer to it on the command line. For example, this command would embed version 1234 of Rails into your application:
rake rails:freeze:edge REVISION=1234
Hint: Instead of bleeding edge, you may want to freeze the latest stable code. You should also check it into your Source Control system, so that you can revert back both to your app source as well as the stable rails version it worked with at any future date.
Visit http://dev.rubyonrails.org/browser/branches
to figure out the revision for the stable branch. Then you can use the above freeze_edge REVISION=#### command to freeze the stable branch to your app.
To revert to GemRails, issue the command:
rake rails:unfreeze
That command empties the vendor/rails directory.
A third option is to issue this command:
rake rails:freeze:gems
That command copies GemRails into the vendor/rails directory. This might be useful to you if you do not have Rails installed as a library on your system.
The above method is great for getting the your application up to speed if you’re not using Subversion for version control of your own project. Because if you are (see HowtoUseRailsWithSubversion), you will probably much rather use the power of svn:externals. Using it, you tell Subversion that a certain part of your project can be found on another Subversion server. Upon doing an svn update, Subversion will also automatically bring the Rails components up to their latest revision. Doing this is very easy:
$ svn propedit svn:externals vendor
Hint: If you have created a brand new rails app, you need to do an initial checkin to the SVN repository. Else the above command doesn’t work and ‘svn propedit svn:externals vendor’ returns “svn: ‘vendor’ is not a working copy”.
This launches your text editor (determined by the environment variable ‘SVN_EDITOR’ or alternatively the environment variable ‘EDITOR’).
In this file, put:
rails http://dev.rubyonrails.org/svn/rails/trunk/
Optionally, a specific revision of the Rails source can be linked by supplying the -r argument to the svn:externals property. For example:
rails -r 3422 http://dev.rubyonrails.org/svn/rails/trunk/
After that, first perform a checkin, and after that an update for instance using:
$ svn ci -m "Setting externals property to grab RoR trunk"
$ svn update
If you’re currently using GemRails and want to switch to EdgeRails instead, first you set up svn:externals using above technique. Besides that, you’ll also need to upgrade certain files in your application to be compatible with Edge Rails.
There are several ways to do so. The overall idea is to get to know which files to upgrade!
One way to find out which files is to generate a new temporary Edge Rails application. To do so, create a temporary directory and do this (don’t do this in your app folder):
$ ruby /path/to/project/vendor/rails/railties/bin/rails .Snipped out some irrelevant, ancient info. -Tal Rotbart
note: the rake command above failed for me, however the following command worked just fine… -bryce _Not on Windows
$ rake fresh_rails_without_docs_using_links_
note: the rake command above failed for me on Windows due to the lack of symlinks, however the following command worked just fine… -osblues $ rake fresh_rails_without_docs
This generates a new directory “rails” from the rails components. From this directory, we will copy all sorts of files over their gem counterparts. You will want to copy them over the following, taking into account any changes you made to the files of course.
rails/*
rails/config/boot.rb
rails/config/database.yml
rails/config/environment.rb (be sure to merge anything you added to shared.rb into this file)
rails/config/environments/*.rb
rails/doc/api/* (include subdirs)
rails/log/development.log
rails/public/.htaccess (no real copy needed, but worth a look)
rails/public/dispatch.*
rails/script/*
rails/test/test_helper.rb
rails/test/mocks/
If you are updating from a pre-routing Rails app, follow the instructions here
Question: Is it necessary to overwrite the gem files if you are running edge rails inside your vendor directory? I thought that rails just looked in vender first and ran from there if it found rails there.
Answer: Rails does run from vendor/rails. However, what people here mean is that you need to update the files in your application for compatibility with edge rails. Just like you’d have to update some of your application files when upgrading from 0.13 to 1.0.
For example the dispatch. scripts inside your public/ folder need to be updated to be compatible with edge rails as even between 1.0 and revision 3595 there are incompatibilities. – Tal Rotbart
Rake problem*:
In case anyone is encountering a problem like…
[duane@mail1 socialconference]$ rake -T
(in /home/www/socialconference)
rake aborted!
undefined method `namespace' for main:Object
./Rakefile:10
sudo gem update rake
EdgeRails is a term which means you are running a local copy of a developmental version of Rails (i.e., you’re on the bleeding edge). It is an alternative to the more standard GemRails, which means you are running one of the stable releases (i.e., you installed it with the GEM packaging system).
The advantage to running EdgeRails is that you may get access to new features or bug fixes that are not in the most recent stable release. Also EdgeRails allows you to run on computer without Rails installed. Or you could run EdgeRails in a shared web hosting machine (see RailsWebHosts) that may only have the major releases installed on the system, but not the edge rails.
The disadvantage is that developmental versions are not generally regarded to be stable. So it’s a tradeoff.
In order to use EdgeRails you simply have to embed a (developmental) version of Rails within your application rather than using the version installed on your machine as a library. In that way, a developer working on multiple Rails applications can have some running off of GemRails, and others running off of various versions of EdgeRails, as these latter applications would have their own individual versions of Rails embedded within them.
To embed a version of Rails within your application, the relevant files are copied into the vendor/rails directory.
Simply use this command from your application home directory to unpack the latest edge rails into your application vendor/rails directory:
rake rails:freeze:edge
This embeds the Rails framework into your application by using Subversion (svn) to copy the files from the developmental source code repository (dev.rubyonrails.org) into your vendor/rails directory. Subversion is necessary even if you are not using it to manage the source code of your own project.
If you would like to run a specific revision of EdgeRails, then you can refer to it on the command line. For example, this command would embed version 1234 of Rails into your application:
rake rails:freeze:edge REVISION=1234
Hint: Instead of bleeding edge, you may want to freeze the latest stable code. You should also check it into your Source Control system, so that you can revert back both to your app source as well as the stable rails version it worked with at any future date.
Visit http://dev.rubyonrails.org/browser/branches
to figure out the revision for the stable branch. Then you can use the above freeze_edge REVISION=#### command to freeze the stable branch to your app.
To revert to GemRails, issue the command:
rake rails:unfreeze
That command empties the vendor/rails directory.
A third option is to issue this command:
rake rails:freeze:gems
That command copies GemRails into the vendor/rails directory. This might be useful to you if you do not have Rails installed as a library on your system.
The above method is great for getting the your application up to speed if you’re not using Subversion for version control of your own project. Because if you are (see HowtoUseRailsWithSubversion), you will probably much rather use the power of svn:externals. Using it, you tell Subversion that a certain part of your project can be found on another Subversion server. Upon doing an svn update, Subversion will also automatically bring the Rails components up to their latest revision. Doing this is very easy:
$ svn propedit svn:externals vendor
Hint: If you have created a brand new rails app, you need to do an initial checkin to the SVN repository. Else the above command doesn’t work and ‘svn propedit svn:externals vendor’ returns “svn: ‘vendor’ is not a working copy”.
This launches your text editor (determined by the environment variable ‘SVN_EDITOR’ or alternatively the environment variable ‘EDITOR’).
In this file, put:
rails http://dev.rubyonrails.org/svn/rails/trunk/
Optionally, a specific revision of the Rails source can be linked by supplying the -r argument to the svn:externals property. For example:
rails -r 3422 http://dev.rubyonrails.org/svn/rails/trunk/
After that, first perform a checkin, and after that an update for instance using:
$ svn ci -m "Setting externals property to grab RoR trunk"
$ svn update
If you’re currently using GemRails and want to switch to EdgeRails instead, first you set up svn:externals using above technique. Besides that, you’ll also need to upgrade certain files in your application to be compatible with Edge Rails.
There are several ways to do so. The overall idea is to get to know which files to upgrade!
One way to find out which files is to generate a new temporary Edge Rails application. To do so, create a temporary directory and do this (don’t do this in your app folder):
$ ruby /path/to/project/vendor/rails/railties/bin/rails .Snipped out some irrelevant, ancient info. -Tal Rotbart
note: the rake command above failed for me, however the following command worked just fine… -bryce _Not on Windows
$ rake fresh_rails_without_docs_using_links_
note: the rake command above failed for me on Windows due to the lack of symlinks, however the following command worked just fine… -osblues $ rake fresh_rails_without_docs
This generates a new directory “rails” from the rails components. From this directory, we will copy all sorts of files over their gem counterparts. You will want to copy them over the following, taking into account any changes you made to the files of course.
rails/*
rails/config/boot.rb
rails/config/database.yml
rails/config/environment.rb (be sure to merge anything you added to shared.rb into this file)
rails/config/environments/*.rb
rails/doc/api/* (include subdirs)
rails/log/development.log
rails/public/.htaccess (no real copy needed, but worth a look)
rails/public/dispatch.*
rails/script/*
rails/test/test_helper.rb
rails/test/mocks/
If you are updating from a pre-routing Rails app, follow the instructions here
Question: Is it necessary to overwrite the gem files if you are running edge rails inside your vendor directory? I thought that rails just looked in vender first and ran from there if it found rails there.
Answer: Rails does run from vendor/rails. However, what people here mean is that you need to update the files in your application for compatibility with edge rails. Just like you’d have to update some of your application files when upgrading from 0.13 to 1.0.
For example the dispatch. scripts inside your public/ folder need to be updated to be compatible with edge rails as even between 1.0 and revision 3595 there are incompatibilities. – Tal Rotbart
Rake problem*:
In case anyone is encountering a problem like…
[duane@mail1 socialconference]$ rake -T
(in /home/www/socialconference)
rake aborted!
undefined method `namespace' for main:Object
./Rakefile:10
sudo gem update rake