如何在 ruby on Rails 上应用补丁?
我想应用此线程中提到的 action_mailer 补丁,但我以前从未应用过补丁,我不确定这些补丁是如何工作的: https://rails.lighthouseapp.com/projects/8994/tickets/2263
我的操作邮件程序 gem 在这里: /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/gems/actionmailer-2.3.2
我假设我需要转到该目录并运行 patch 命令。 ..像这样的东西?
cd /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/gems/
wget https://rails.lighthouseapp.com/attachments/108548/0001-Fix-implicit-multipart-mailer-views-when-RAILS_ROOT.patch
patch < 0001-Fix-implicit-multipart-mailer-views-when-RAILS_ROOT.patch
我不太清楚的一件事是补丁文件引用了“actionmailer”目录,但我的目录被称为“actionmailer-2.3.2”
I'd like to apply the action_mailer patch mentioned in this thread but I have never applied a patch before and I'm not sure how these work:
https://rails.lighthouseapp.com/projects/8994/tickets/2263
My action mailer gem is here: /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/gems/actionmailer-2.3.2
I assume I need to go to that directory and run the patch command...something like this?
cd /opt/ruby-enterprise-1.8.6-20090421/lib/ruby/gems/1.8/gems/
wget https://rails.lighthouseapp.com/attachments/108548/0001-Fix-implicit-multipart-mailer-views-when-RAILS_ROOT.patch
patch < 0001-Fix-implicit-multipart-mailer-views-when-RAILS_ROOT.patch
One thing I'm not really clear on also is that the patch file refers to the "actionmailer" directory but mine is called "actionmailer-2.3.2"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您通常不想修补 gem 源本身。 您可能希望将 gems 冻结到
${RAILS_ROOT}/vendor/rails
中,然后在本地应用补丁。从 ${RAILS_ROOT} 目录中,将所有的 Rails gem 转储到供应商/rails 中
应用补丁
You typically don't want to patch the gem source itself. You probably will want to freeze the gems into
${RAILS_ROOT}/vendor/rails
, and then apply the patch locally.From your ${RAILS_ROOT} dir, dump all of your rails gems into vendor/rails
Apply the patch
迈克尔森的上述答案有效。 但是要修补所有 Rails 应用程序的实际 gem(请参阅我对他的答案的评论),这很有效:
我发现如果出现任何问题,您也可以使用 -R 反转补丁。 我很惊讶这个过程没有在某个地方得到更好的记录。 希望这会出现在像我这样刚接触补丁的人的谷歌搜索中。
Micholson's answer above works. But to patch the actual gem for all rails apps (see my comment on his answer) this worked:
I found out you can also reverse a patch with -R if anything goes wrong. I'm surprised this process wasn't better documented somewhere. Hopefully this will turn up in Google searches for people new to patching like me.
这是一个用于修补 gem 的 shell 语句:
使用
gist< 的另一个示例/代码> 宝石:
Here is a shell one-liner for patching a gem:
Another example using
gist
gem: