如何在带有bundler的项目中使用rails中的分支

我在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' 

所有这些最初都在运行bundle install时工作,但在启动应用程序时,它无法在加载路径中找到rails:

 /home/mt/Development/config/boot.rb:57:在`require'中:没有要加载的文件 - 初始化程序(LoadError)
    来自/home/mt/Development/config/boot.rb:57:in,load_initializer'
    来自/home/mt/Development/config/boot.rb:117:在'run'中
    来自/home/mt/Development/config/boot.rb:11:in`boot!'
    来自/home/mt/Development/config/boot.rb:130
    来自脚本/控制台:2:在`re

我的Gemfile.lock条目是这样的:

 GIT
   remote:git://github.com/traveliq/rails.git
  修订:25139ac92cea5b17791d71359bc3ae2a5d526652
  分支:tiq-fixes
  眼镜:
    铁轨(2.3.10)

 ...

相关内容

 ...

 rails(= 2.3.10)!

balu的回答向我指出了正确的方法,但这里有更多细节:

有必要为rails repo / 2-3-stable分支中的大多数gem拼凑.gemspec文件 – 我的看法可以在http://github.com/traveliq/rails/commit/46d9042c9125abbbedfc672f8523d81210f4f320上看到或分叉

要将其包含在Gemfile中,请使用:

 git "git://github.com/traveliq/rails.git", :branch => 'tiq-fixes' do gem 'rails' gem 'actionmailer' gem 'actionpack' gem 'activerecord' gem 'activeresource' gem 'activesupport' end 

请注意,您不能使用’railties’,它只定义’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' 

在定义了rails / railties .gemspec之后,你也可以省略其中的一些gem,并让bundler使用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 

进一步参考: http : //gembundler.com/git.html

编辑:这意味着捆绑商需要gemspec到位。