summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-04-27 22:04:34 +0000
committerThe Bundler Bot <bot@bundler.io>2017-04-27 22:04:34 +0000
commit8552918f7faefc7f003d8a20979d5223bbd5b8ac (patch)
treea85a301611c426503364bc81ac82cbea749887cb
parenta270b29445e31b6b0dff7201686950c28731a0ab (diff)
parent9c1857a1e8d229236c5d576abc852e41fb406de2 (diff)
downloadbundler-8552918f7faefc7f003d8a20979d5223bbd5b8ac.tar.gz
Auto merge of #5612 - bundler:seg-dont-require-thor-actions, r=indirect
[CLI] Avoid loading Thor::Actions when it is not used
-rw-r--r--lib/bundler/cli.rb1
-rw-r--r--lib/bundler/cli/gem.rb8
-rw-r--r--lib/bundler/vendored_thor.rb7
-rw-r--r--spec/commands/newgem_spec.rb2
-rw-r--r--spec/runtime/setup_spec.rb6
5 files changed, 20 insertions, 4 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb
index d93f81654b..694c89441b 100644
--- a/lib/bundler/cli.rb
+++ b/lib/bundler/cli.rb
@@ -4,7 +4,6 @@ require "bundler/vendored_thor"
module Bundler
class CLI < Thor
- include Thor::Actions
AUTO_INSTALL_CMDS = %w(show binstubs outdated exec open console licenses clean).freeze
def self.start(*)
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb
index 7fa005289e..0e4b7f742b 100644
--- a/lib/bundler/cli/gem.rb
+++ b/lib/bundler/cli/gem.rb
@@ -2,6 +2,11 @@
require "pathname"
module Bundler
+ class CLI
+ Bundler.require_thor_actions
+ include Thor::Actions
+ end
+
class CLI::Gem
TEST_FRAMEWORK_VERSIONS = {
"rspec" => "3.0",
@@ -13,7 +18,10 @@ module Bundler
def initialize(options, gem_name, thor)
@options = options
@gem_name = resolve_name(gem_name)
+
@thor = thor
+ thor.behavior = :invoke
+ thor.destination_root = nil
@name = @gem_name
@target = SharedHelpers.pwd.join(gem_name)
diff --git a/lib/bundler/vendored_thor.rb b/lib/bundler/vendored_thor.rb
index 0d0b45bfba..4a5d0cf6bb 100644
--- a/lib/bundler/vendored_thor.rb
+++ b/lib/bundler/vendored_thor.rb
@@ -1,4 +1,7 @@
# frozen_string_literal: true
-module Bundler; end
+module Bundler
+ def self.require_thor_actions
+ Kernel.send(:require, "bundler/vendor/thor/lib/thor/actions")
+ end
+end
require "bundler/vendor/thor/lib/thor"
-require "bundler/vendor/thor/lib/thor/actions"
diff --git a/spec/commands/newgem_spec.rb b/spec/commands/newgem_spec.rb
index 6ce19124f5..a3c3a36419 100644
--- a/spec/commands/newgem_spec.rb
+++ b/spec/commands/newgem_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe "bundle gem" do
end
after do
- `rm "#{ENV["GIT_CONFIG"]}"` if File.exist?(ENV["GIT_CONFIG"])
+ FileUtils.rm(ENV["GIT_CONFIG"]) if File.exist?(ENV["GIT_CONFIG"])
ENV["GIT_CONFIG"] = @git_config_location
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index 14f973dc97..b19a81e75f 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -1163,6 +1163,12 @@ end
loaded_specs = Gem.loaded_specs.dup
#{exemptions.inspect}.each {|s| loaded_specs.delete(s) }
pp loaded_specs
+
+ # not a default gem, but harmful to have loaded
+ open_uri = $LOADED_FEATURES.grep(/open.uri/)
+ unless open_uri.empty?
+ warn "open_uri: \#{open_uri}"
+ end
RUBY
it "activates no gems with -rbundler/setup" do