【发布时间】:2014-12-19 19:06:26
【问题描述】:
我想对 Vagrant 插件进行猴子补丁。
由于我不是 Ruby 人,但想测试一些行为,我需要一些帮助。
我需要重写那里的方法chef_provisioner?:
https://github.com/fgrehm/vagrant-cachier/blob/master/lib/vagrant-cachier/cap/linux/chef_file_cache_path.rb
这就是我到目前为止在我的 Vagrantfile 顶部得到的:
module VagrantPlugins
module Cachier
module Cap
module Linux
module ChefFileCachePath
def self.chef_provisioner?(machine)
# patch applies here
end
end
end
end
end
end
Vagrant 无法识别补丁。少了什么东西?这种方式可以吗?
【问题讨论】:
-
理论上是可能的。您只需要确保在修补之前首先评估您覆盖的任何内容(例如,需要该文件)。否则原件可能无法加载或覆盖您的补丁。