如何在捆绑器的项目中使用rails的fork分支 [英] How to use a branch in a fork of rails in a project with bundler

查看:115
本文介绍了如何在捆绑器的项目中使用rails的fork分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在github上有 rails repo 的分支,已经有了一个分支,基于rails-2-3-stable分支。我想与我的应用程序一起开发基于Rails 2.3.10的一些更改。



在rails的github fork中使用我的分支并在多台计算机之间共享这种分支的最简洁方法是什么?



一种方法是:

我该如何安装边栏?



哪些方法可行,但不能感觉很干净,因为我们不得不在repo更改时手动更新商品版本,而且我们必须检查git repo到svn中。



I'已经在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 ,但启动应用程序时,它无法在加载路径中找到轨道:

 
/ 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 '从/home/mt/Development/config/boot.rb:117:in'运行'
从/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条目如下所示:

 
GIT
remote:git://github.com /traveliq/rails.git
修订版:25139ac92cea5b17791d71359bc3ae2a5d526652
分支:tiq-fixes
规格:
rails(2.3.10)

...

相关性

...

rails(= 2.3.10)!


解决方案

balu的答案指出了我的正确方向,但这里有更多详细信息:

有必要在轨道repo / 2-3-stable分支中拼凑大部分宝石的.gemspec文件 - 我可以看到或分叉在 http://github.com/traveliq/rails/commit/46d9042c9125abbbedfc672f8523d81210f4f320



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

  gitgit://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之后,您也可以省略一些那些宝石,并且捆绑器使用gemcutter等的正常版本。


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)!

解决方案

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.

这篇关于如何在捆绑器的项目中使用rails的fork分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆