如何对 Bundler 中管理的 gem 进行猴子修补?
具体来说,我想用以下命令将delayed_job指向另一个表:
set_table_name“my_table”
我刚刚从供应商gems切换到Bundler。我曾经只是更改供应商 gem 中的代码,这可能很愚蠢。无论如何,我可能需要为此做一条猴子路径,我只是不确定如何做。
Specifically, I want to point delayed_job at a different table with:
set_table_name "my_table"
I just switched to Bundler from vendoring gems. I used to just change the code in the vendored gem, which was probably stupid. I probably need to do a monkey path for this anyway, I'm just no sure how.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是您可以使用的一般模式。它不会按原样工作,因为重点只是演示模式,并且因为我不知道
Delayed::Job
的类结构。The following is the general pattern you can use. It's not going to work as-is, because the point is only to demonstrate the pattern, and because I don't know
Delayed::Job
's class structure.我要做的就是在 github 上分叉该项目,然后为表名实现一个配置选项,然后将拉取请求发送回原作者。与此同时,我会将捆绑器指向我自己的 git(或公司拥有的)存储库。
What I would do, is fork the project on github, and then implement a config option for the table name, and then send a pull request back to the original author. In the meantime, I would point bundler at my own git (or company owned) repo.