From d90208f9d977cca6254458d402d2e2d975034495 Mon Sep 17 00:00:00 2001 From: Asutosh Palai Date: Wed, 8 Jun 2016 20:29:25 +0530 Subject: Fixes for failing specs for older ruby version --- lib/bundler/plugin.rb | 4 ++-- lib/bundler/plugin/dsl.rb | 3 ++- lib/bundler/source/rubygems.rb | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/bundler') diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index 00b4d9e9..f97de2b2 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -8,8 +8,8 @@ module Bundler autoload :Installer, "bundler/plugin/installer" autoload :SourceList, "bundler/plugin/source_list" - MalformattedPlugin = Class.new(PluginError) - UndefinedCommandError = Class.new(PluginError) + class MalformattedPlugin < PluginError; end + class UndefinedCommandError < PluginError; end PLUGIN_FILE_NAME = "plugins.rb".freeze diff --git a/lib/bundler/plugin/dsl.rb b/lib/bundler/plugin/dsl.rb index 4a3663fd..f65054f0 100644 --- a/lib/bundler/plugin/dsl.rb +++ b/lib/bundler/plugin/dsl.rb @@ -4,6 +4,7 @@ module Bundler # Dsl to parse the Gemfile looking for plugins to install module Plugin class DSL < Bundler::Dsl + class PluginGemfileError < PluginError; end alias_method :_gem, :gem # To use for plugin installation as gem # So that we don't have to override all there methods to dummy ones @@ -21,7 +22,7 @@ module Bundler end def method_missing(name, *args) - super unless Bundler::Dsl.instance_methods.include? name + raise PluginGemfileError, "Undefined local variable or method `#{name}' for Gemfile" unless Bundler::Dsl.method_defined? name end end end diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index a7721de8..d9606e70 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -149,7 +149,7 @@ module Bundler if requires_sudo? Bundler.rubygems.repository_subdirectories.each do |name| src = File.join(install_path, name, "*") - dst = File.join(Bundler.rubygems.gem_dir, name) + dst = File.join(rubygems_dir, name) if name == "extensions" && Dir.glob(src).any? src = File.join(src, "*/*") ext_src = Dir.glob(src).first @@ -249,7 +249,7 @@ module Bundler end def loaded_from(spec) - "#{Bundler.rubygems.gem_dir}/specifications/#{spec.full_name}.gemspec" + "#{rubygems_dir}/specifications/#{spec.full_name}.gemspec" end def cached_gem(spec) -- cgit v1.2.3