I've got a fork of the rails repo on github, in which I've got a branch, based on the rails-2-3-stable branch. I want to develop some changes based on rails 2.3.10 together with my app. We're using bundler, and the app is versioned with SVN.
What is the cleanest way to use my branch in the github fork of rails and share this across machines ?
One way would be this:
how do I install edge rails?
which would work, but doesn't feel clean enough, as we'd have to update the vendored version manually when the repo changes, and we'd have to check the git repo into svn.
I've tried variations of this in the Gemfile:
gem 'rails', '2.3.10', :git => 'git://github.com/traveliq/rails.git', :branch => 'tiq-fixes'
gem 'rails', '2.3.10', :git => 'git://github.com/traveliq/rails.git', :tag => 'v2.3.10'
gem 'rails', '2.3.10', :git => 'git://github.com/rails/rails.git', :tag => 'v2.3.10'
All of those initially work when running bundle install
, but when starting the app, it can't find rails in the load path:
/home/mt/Development/config/boot.rb:57:in `require': no such file to load -- initializer (LoadError) from /home/mt/Development/config/boot.rb:57:in `load_initializer' from /home/mt/Development/config/boot.rb:117:in `run' from /home/mt/Development/config/boot.rb:11:in `boot!' from /home/mt/Development/config/boot.rb:130 from script/console:2:in `re
My Gemfile.lock entries are like this:
GIT remote: git://github.com/traveliq/rails.git revision: 25139ac92cea5b17791d71359bc3ae2a5d526652 branch: tiq-fixes specs: rails (2.3.10) ... DEPENDENCIES ... rails (= 2.3.10)!
The Gemfile. lock allows you to specify the versions of the dependencies that your application needs in the Gemfile , while remembering all of the exact versions of third-party code that your application used when it last worked correctly. By specifying looser dependencies in your Gemfile (such as nokogiri ~> 1.4.
In Rails, bundler provides a constant environment for Ruby projects by tracking and installing suitable gems that are needed. It manages an application's dependencies through its entire life, across many machines, systematically and repeatably. To use bundler, you need to install it.
bundle exec is a Bundler command to execute a script in the context of the current bundle (the one from your directory's Gemfile). rake db:migrate is the script where db is the namespace and migrate is the task name defined.
balu's answer pointed me to the right course, but here are some more details:
It was necessary to cobble together .gemspec files for most of the gems in the rails repo/2-3-stable branch - my take can be seen or forked at http://github.com/traveliq/rails/commit/46d9042c9125abbbedfc672f8523d81210f4f320
To include that in a Gemfile, use:
git "git://github.com/traveliq/rails.git", :branch => 'tiq-fixes' do
gem 'rails'
gem 'actionmailer'
gem 'actionpack'
gem 'activerecord'
gem 'activeresource'
gem 'activesupport'
end
Note that you can't use 'railties', that only defines the 'rails' gem.
Incidentally, while working on this, it was way easier to point the Gemfile at my local repo, which is done this way (rails being the folder where the repo is cloned, a level down from the Gemfile):
gem 'rails', :path => 'rails/railties'
gem 'actionmailer', :path => 'rails/actionmailer'
gem 'actionpack', :path => 'rails/actionpack'
gem 'activerecord', :path => 'rails/activerecord'
gem 'activesupport', :path => 'rails/activesupport'
After defining the rails/railties .gemspec, you could also leave out some of those gems, and have bundler use the normally available versions from gemcutter etc.
Looks like at version 2.3.10, rails did not have .gemspec files for its components. Instead, each gemspec is specified in the corresponding Rakefile.
Otherwise you would use:
git "git://github.com/traveliq/rails.git", :branch => 'tiq-fixes', :tag => 'v2.3.10' do
gem 'actionpack'
gem 'activesupport'
gem 'activerecord'
gem 'activemodel'
gem 'actionmailer'
gem 'railties'
end
Further reference: http://gembundler.com/git.html
EDIT: That means that bundler requires a gemspec to be in place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With