Skip to content

Commit

Permalink
Fix plugin loading in a Rails 2.3.x project [closes hashicorpGH-176]
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Oct 5, 2010
1 parent 8d909b8 commit 5b9bc08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.6.5 (unreleased)


- Fix plugin loading in a Rails 2.3.x project. [GH-176]

## 0.6.4 (October 4, 2010)

Expand Down
15 changes: 11 additions & 4 deletions lib/vagrant/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,20 @@ class Plugin
# load path. This file is loaded to kick off the load sequence
# for that plugin.
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
# latest version of the gems.
Gem.source_index.latest_specs.each do |spec|
file = Gem.searcher.matching_files(spec, "vagrant_init.rb").first
next if !file
[index].flatten.each do |source|
source.latest_specs.each do |spec|
file = Gem.searcher.matching_files(spec, "vagrant_init.rb").first
next if !file

@@plugins << new(spec, file)
@@plugins << new(spec, file)
end
end
end

Expand Down

0 comments on commit 5b9bc08

Please sign in to comment.