summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-04-25 11:06:01 +0200
committerSamuel Giddins <segiddins@segiddins.me>2017-04-25 11:06:01 +0200
commit85f8aa8673056a6a2ad06c714094db5fcafc6e1f (patch)
tree63d360b1bd2cad7c00d021daf382a93d76180c5d
parentadcb353f894c8863fb2e982074e3eb34e9ee8d1e (diff)
downloadbundler-85f8aa8673056a6a2ad06c714094db5fcafc6e1f.tar.gz
[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
3 files changed, 13 insertions, 3 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"