Mar*_* T. 13 ruby bundle ruby-on-rails github bundler
我在github上有一个rails repo的分支,其中我有一个分支,基于rails-2-3-stable分支.我想基于rails 2.3.10和我的应用程序开发一些更改.我们正在使用bundler,该应用程序版本为SVN.
在github的rails分支中使用我的分支并在机器之间共享的最简洁方法是什么?
一种方法是:
哪个会工作,但感觉不够干净,因为当repo改变时我们必须手动更新销售版本,我们必须检查git repo到svn.
我在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'
Run Code Online (Sandbox Code Playgroud)
所有这些最初都在运行bundle install时工作,但在启动应用程序时,它无法在加载路径中找到rails:
/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
我的Gemfile.lock条目是这样的:
GIT
remote: git://github.com/traveliq/rails.git
revision: 25139ac92cea5b17791d71359bc3ae2a5d526652
branch: tiq-fixes
specs:
rails (2.3.10)
...
DEPENDENCIES
...
rails (= 2.3.10)!
Mar*_* T. 17
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
Run Code Online (Sandbox Code Playgroud)
Note that you can't use 'railties', that only defines the 'rails' gem.
顺便说一句,在处理这个问题时,更容易将Gemfile指向我的本地仓库,这是以这种方式完成的(rails是克隆repo的文件夹,从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'
Run Code Online (Sandbox Code Playgroud)
在定义了rails/railties .gemspec之后,您也可以省略其中一些宝石,并让捆绑器使用gemcutter等常用版本.
看起来在2.3.10版本中,rails没有为其组件提供.gemspec文件.相反,每个gemspec都在相应的Rakefile中指定.
否则你会使用:
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
Run Code Online (Sandbox Code Playgroud)
进一步参考:http://gembundler.com/git.html
编辑:这意味着捆绑商需要gemspec到位.