Skip to content

A platform for community discussion. Free, open, simple.

FIX: ensure plugin's gems are in the gem path (#12727)

Régis Hanolc43a7bb23bfd
diff --git a/lib/plugin_gem.rb b/lib/plugin_gem.rb
index 1ca1fd9176c..855d1aca2c1 100644
--- a/lib/plugin_gem.rb
+++ b/lib/plugin_gem.rb
@@ -5,21 +5,24 @@ module PluginGem
opts ||= {}
gems_path = File.dirname(path) + "/gems/#{RUBY_VERSION}"
+
spec_path = gems_path + "/specifications"
- spec_file = spec_path + "/#{name}-#{version}"
+
+ spec_file = spec_path + "/#{name}-#{version}"
spec_file += "-#{opts[:platform]}" if opts[:platform]
spec_file += ".gemspec"
+
unless File.exists? spec_file
- command = "gem install #{name} -v #{version} -i #{gems_path} --no-document --ignore-dependencies --no-user-install"
- if opts[:source]
- command << " --source #{opts[:source]}"
- end
+ command = "gem install #{name} -v #{version} -i #{gems_path} --no-document --ignore-dependencies --no-user-install"
+ command += " --source #{opts[:source]}" if opts[:source]
puts command
puts `#{command}`
end
+
if File.exists? spec_file
- spec = Gem::Specification.load spec_file
- spec.activate
+ Gem.path << gems_path
+ Gem::Specification.load(spec_file).activate
+
unless opts[:require] == false
require opts[:require_name] ? opts[:require_name] : name
end