Fix plugin loading in a Rails 2.3.x project [closes GH-176]
This commit is contained in:
parent
8d909b8ee4
commit
5b9bc086ac
|
@ -1,6 +1,6 @@
|
||||||
## 0.6.5 (unreleased)
|
## 0.6.5 (unreleased)
|
||||||
|
|
||||||
|
- Fix plugin loading in a Rails 2.3.x project. [GH-176]
|
||||||
|
|
||||||
## 0.6.4 (October 4, 2010)
|
## 0.6.4 (October 4, 2010)
|
||||||
|
|
||||||
|
|
|
@ -21,15 +21,22 @@ module Vagrant
|
||||||
# load path. This file is loaded to kick off the load sequence
|
# load path. This file is loaded to kick off the load sequence
|
||||||
# for that plugin.
|
# for that plugin.
|
||||||
def self.load!
|
def self.load!
|
||||||
|
# Stupid hack since Rails 2.3.x overrides Gem.source_index with their
|
||||||
|
# own incomplete replacement which causes issues.
|
||||||
|
index = Gem.source_index
|
||||||
|
index = [index.installed_source_index, index.vendor_source_index] if defined?(Rails::VendorGemSourceIndex) && index.is_a?(Rails::VendorGemSourceIndex)
|
||||||
|
|
||||||
# Look for a vagrant_init.rb in all the gems, but only the
|
# Look for a vagrant_init.rb in all the gems, but only the
|
||||||
# latest version of the gems.
|
# latest version of the gems.
|
||||||
Gem.source_index.latest_specs.each do |spec|
|
[index].flatten.each do |source|
|
||||||
|
source.latest_specs.each do |spec|
|
||||||
file = Gem.searcher.matching_files(spec, "vagrant_init.rb").first
|
file = Gem.searcher.matching_files(spec, "vagrant_init.rb").first
|
||||||
next if !file
|
next if !file
|
||||||
|
|
||||||
@@plugins << new(spec, file)
|
@@plugins << new(spec, file)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Returns the array of plugins which are currently loaded by
|
# Returns the array of plugins which are currently loaded by
|
||||||
# Vagrant.
|
# Vagrant.
|
||||||
|
|
Loading…
Reference in New Issue