summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsutosh Palai <asupalai@gmail.com>2016-06-08 20:29:25 +0530
committerAsutosh Palai <asupalai@gmail.com>2016-06-08 20:57:53 +0530
commitd90208f9d977cca6254458d402d2e2d975034495 (patch)
treea56372ad2db2f34e93ff26c024093521c2683c36
parentcf284c001657a428cc37b4721aed68df795dcfed (diff)
downloadbundler-d90208f9d977cca6254458d402d2e2d975034495.tar.gz
Fixes for failing specs for older ruby version
-rw-r--r--lib/bundler/plugin.rb4
-rw-r--r--lib/bundler/plugin/dsl.rb3
-rw-r--r--lib/bundler/source/rubygems.rb4
-rw-r--r--spec/bundler/plugin/dsl_spec.rb4
4 files changed, 9 insertions, 6 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index 00b4d9e941..f97de2b20d 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 4a3663fd1b..f65054f014 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 a7721de870..d9606e7087 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)
diff --git a/spec/bundler/plugin/dsl_spec.rb b/spec/bundler/plugin/dsl_spec.rb
index 82c298794b..876564f22b 100644
--- a/spec/bundler/plugin/dsl_spec.rb
+++ b/spec/bundler/plugin/dsl_spec.rb
@@ -2,6 +2,8 @@
require "spec_helper"
describe Bundler::Plugin::DSL do
+ DSL = Bundler::Plugin::DSL
+
subject(:dsl) { Bundler::Plugin::DSL.new }
before do
@@ -14,7 +16,7 @@ describe Bundler::Plugin::DSL do
end
it "raises error for other methods" do
- expect { dsl.no_method }.to raise_error(Bundler::GemfileError)
+ expect { dsl.no_method }.to raise_error(DSL::PluginGemfileError)
end
end
end