开发者

Ruby on Rails: patching Rack and deploying it

I need to patch Rack with the following patch: http://github.com/rack/rack/commit/dae12e088592ee69545b5f2f81b87f4959859164

What's the best practice for doing this? Should I gem unpack, apply the patch, then repack the gem a开发者_开发技巧nd ship it with capistrano to make sure my version of the gem gets to the destination server?

can I just pop rack into vendor/plugins/ and rely on it being loaded first prior to the system wide gem?

I want to take the path of least resistance and easily be able to deploy this to many environments.


You can install gems from a repository using bundler if you're using that by adding an option to your Gemfile:

gem 'rack', :git => 'git://github.com/my-account/rack.git'

This makes patching and deploying patched gems a lot easier. Fork it to your account, patch it, and use that base instead.

Rack isn't a plugin, it's a gem, so it probably won't work properly if installed in vendor/plugins.


Alternatively, instead of pointing to your git repository, you can have Bundler load from a local filesystem, like a vendor/ subdirectory:

gem 'rack', :path => File.join(File.dirname(__FILE__), '/vendor/gems/rack')

That allows you to debug on the fly without having to git pull / push your changes.


The other answers appear to require Bundler/Rails 3. Since I'm using Rails 2.3.10 and the old-style Rails config.gem system, they didn't work for me.

I was able to find a working solution for this same problem here. The author included the fixed code from Rack 1.2 in a monkey patch for rack 1.1, and then loaded the patch file through an initializer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜