bundler 1.8.9 → 1.9.0.pre
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +9 -7
- data/CHANGELOG.md +8 -33
- data/Rakefile +51 -8
- data/lib/bundler/cli/gem.rb +20 -1
- data/lib/bundler/cli/install.rb +1 -1
- data/lib/bundler/definition.rb +8 -12
- data/lib/bundler/dep_proxy.rb +2 -2
- data/lib/bundler/installer.rb +12 -18
- data/lib/bundler/resolver.rb +168 -383
- data/lib/bundler/rubygems_ext.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +6 -14
- data/lib/bundler/runtime.rb +3 -0
- data/lib/bundler/shared_helpers.rb +12 -7
- data/lib/bundler/source.rb +0 -5
- data/lib/bundler/source/path.rb +2 -1
- data/lib/bundler/source/path/installer.rb +0 -2
- data/lib/bundler/source/rubygems.rb +9 -11
- data/lib/bundler/templates/newgem/Rakefile.tt +0 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo.rb +5 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/dependency_graph.rb +266 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/errors.rb +69 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/gem_metadata.rb +3 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/modules/specification_provider.rb +90 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/modules/ui.rb +63 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/resolution.rb +412 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/resolver.rb +43 -0
- data/lib/bundler/vendor/Molinillo-0.2.1/lib/molinillo/state.rb +43 -0
- data/lib/bundler/vendor/{thor.rb → thor-0.19.1/lib/thor.rb} +57 -53
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/actions.rb +34 -34
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/actions/create_file.rb +7 -7
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/actions/create_link.rb +2 -2
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/actions/directory.rb +11 -11
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/actions/empty_directory.rb +2 -2
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/actions/file_manipulation.rb +14 -14
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/actions/inject_into_file.rb +24 -24
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/base.rb +71 -71
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/command.rb +8 -8
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/core_ext/hash_with_indifferent_access.rb +2 -2
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/core_ext/io_binary_read.rb +1 -1
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/core_ext/ordered_hash.rb +2 -2
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/error.rb +3 -3
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/group.rb +27 -27
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/invocation.rb +16 -11
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/line_editor/basic.rb +2 -2
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/line_editor/readline.rb +7 -7
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/parser.rb +4 -0
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/parser/argument.rb +7 -7
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/parser/arguments.rb +10 -10
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/parser/option.rb +14 -10
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/parser/options.rb +12 -12
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/rake_compat.rb +14 -14
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/runner.rb +76 -76
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/shell.rb +18 -18
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/shell/basic.rb +31 -30
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/shell/color.rb +10 -10
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/shell/html.rb +28 -28
- data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/util.rb +61 -61
- data/lib/bundler/vendor/thor-0.19.1/lib/thor/version.rb +3 -0
- data/lib/bundler/vendored_molinillo.rb +5 -0
- data/lib/bundler/vendored_thor.rb +3 -6
- data/lib/bundler/version.rb +1 -1
- metadata +44 -35
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/thor/line_editor.rb +0 -17
- data/lib/bundler/vendor/thor/parser.rb +0 -4
- data/lib/bundler/vendor/thor/version.rb +0 -3
@@ -1,4 +1,4 @@
|
|
1
|
-
class Thor
|
1
|
+
class Bundler::Thor
|
2
2
|
class Command < Struct.new(:name, :description, :long_description, :usage, :options)
|
3
3
|
FILE_REGEXP = /^#{Regexp.escape(File.dirname(__FILE__))}/
|
4
4
|
|
@@ -45,12 +45,12 @@ class Thor
|
|
45
45
|
end
|
46
46
|
formatted = "#{klass.namespace.split(':').last} " if subcommand
|
47
47
|
|
48
|
-
formatted ||=
|
48
|
+
formatted ||= ""
|
49
49
|
|
50
50
|
# Add usage with required arguments
|
51
51
|
formatted << if klass && !klass.arguments.empty?
|
52
52
|
usage.to_s.gsub(/^#{name}/) do |match|
|
53
|
-
match <<
|
53
|
+
match << " " << klass.arguments.map { |a| a.usage }.compact.join(" ")
|
54
54
|
end
|
55
55
|
else
|
56
56
|
usage.to_s
|
@@ -70,7 +70,7 @@ class Thor
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def required_options
|
73
|
-
@required_options ||= options.map { |_, o| o.usage if o.required? }.compact.sort.join(
|
73
|
+
@required_options ||= options.map { |_, o| o.usage if o.required? }.compact.sort.join(" ")
|
74
74
|
end
|
75
75
|
|
76
76
|
# Given a target, checks if this class name is a public method.
|
@@ -88,15 +88,15 @@ class Thor
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def sans_backtrace(backtrace, caller) #:nodoc:
|
91
|
-
saned = backtrace.reject { |frame| frame =~ FILE_REGEXP || (frame =~ /\.java:/ && RUBY_PLATFORM =~ /java/) }
|
91
|
+
saned = backtrace.reject { |frame| frame =~ FILE_REGEXP || (frame =~ /\.java:/ && RUBY_PLATFORM =~ /java/) || (frame =~ /^kernel\// && RUBY_ENGINE =~ /rbx/) }
|
92
92
|
saned - caller
|
93
93
|
end
|
94
94
|
|
95
95
|
def handle_argument_error?(instance, error, caller)
|
96
|
-
not_debugging?(instance) && error.message =~ /wrong number of arguments/ && begin
|
96
|
+
not_debugging?(instance) && (error.message =~ /wrong number of arguments/ || error.message =~ /given \d*, expected \d*/) && begin
|
97
97
|
saned = sans_backtrace(error.backtrace, caller)
|
98
98
|
# Ruby 1.9 always include the called method in the backtrace
|
99
|
-
saned.empty? || (saned.size == 1 && RUBY_VERSION >=
|
99
|
+
saned.empty? || (saned.size == 1 && RUBY_VERSION >= "1.9")
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
@@ -118,7 +118,7 @@ class Thor
|
|
118
118
|
# A dynamic command that handles method missing scenarios.
|
119
119
|
class DynamicCommand < Command
|
120
120
|
def initialize(name, options = nil)
|
121
|
-
super(name.to_s,
|
121
|
+
super(name.to_s, "A dynamically-generated command", name.to_s, name.to_s, options)
|
122
122
|
end
|
123
123
|
|
124
124
|
def run(instance, args = [])
|
data/lib/bundler/vendor/{thor → thor-0.19.1/lib/thor}/core_ext/hash_with_indifferent_access.rb
RENAMED
@@ -1,8 +1,8 @@
|
|
1
|
-
class Thor
|
1
|
+
class Bundler::Thor
|
2
2
|
module CoreExt #:nodoc:
|
3
3
|
# A hash with indifferent access and magic predicates.
|
4
4
|
#
|
5
|
-
# hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
|
5
|
+
# hash = Bundler::Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
|
6
6
|
#
|
7
7
|
# hash[:foo] #=> 'bar'
|
8
8
|
# hash['foo'] #=> 'bar'
|
@@ -2,7 +2,7 @@ class IO #:nodoc:
|
|
2
2
|
class << self
|
3
3
|
def binread(file, *args)
|
4
4
|
fail ArgumentError, "wrong number of arguments (#{1 + args.size} for 1..3)" unless args.size < 3
|
5
|
-
File.open(file,
|
5
|
+
File.open(file, "rb") do |f|
|
6
6
|
f.read(*args)
|
7
7
|
end
|
8
8
|
end unless method_defined? :binread
|
@@ -1,9 +1,9 @@
|
|
1
|
-
class Thor
|
2
|
-
# Thor::Error is raised when it's caused by wrong usage of thor classes. Those
|
1
|
+
class Bundler::Thor
|
2
|
+
# Bundler::Thor::Error is raised when it's caused by wrong usage of thor classes. Those
|
3
3
|
# errors have their backtrace suppressed and are nicely shown to the user.
|
4
4
|
#
|
5
5
|
# Errors that are caused by the developer, like declaring a method which
|
6
|
-
# overwrites a thor keyword, it SHOULD NOT raise a Thor::Error. This way, we
|
6
|
+
# overwrites a thor keyword, it SHOULD NOT raise a Bundler::Thor::Error. This way, we
|
7
7
|
# ensure that developer errors are shown with full backtrace.
|
8
8
|
class Error < StandardError
|
9
9
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
require
|
1
|
+
require "thor/base"
|
2
2
|
|
3
|
-
# Thor has a special class called Thor::Group. The main difference to Thor class
|
3
|
+
# Bundler::Thor has a special class called Bundler::Thor::Group. The main difference to Bundler::Thor class
|
4
4
|
# is that it invokes all commands at once. It also include some methods that allows
|
5
|
-
# invocations to be done at the class method, which are not available to Thor
|
5
|
+
# invocations to be done at the class method, which are not available to Bundler::Thor
|
6
6
|
# commands.
|
7
|
-
class Thor::Group # rubocop:disable ClassLength
|
7
|
+
class Bundler::Thor::Group # rubocop:disable ClassLength
|
8
8
|
class << self
|
9
|
-
# The description for this Thor::Group. If none is provided, but a source root
|
9
|
+
# The description for this Bundler::Thor::Group. If none is provided, but a source root
|
10
10
|
# exists, tries to find the USAGE one folder above it, otherwise searches
|
11
11
|
# in the superclass.
|
12
12
|
#
|
13
13
|
# ==== Parameters
|
14
|
-
# description<String>:: The description for this Thor::Group.
|
14
|
+
# description<String>:: The description for this Bundler::Thor::Group.
|
15
15
|
#
|
16
16
|
def desc(description = nil)
|
17
17
|
if description
|
@@ -27,7 +27,7 @@ class Thor::Group # rubocop:disable ClassLength
|
|
27
27
|
# short:: When true, shows only usage.
|
28
28
|
#
|
29
29
|
def help(shell)
|
30
|
-
shell.say
|
30
|
+
shell.say "Usage:"
|
31
31
|
shell.say " #{banner}\n"
|
32
32
|
shell.say
|
33
33
|
class_options_help(shell)
|
@@ -62,7 +62,7 @@ class Thor::Group # rubocop:disable ClassLength
|
|
62
62
|
invocation_blocks[name] = block if block_given?
|
63
63
|
|
64
64
|
class_eval <<-METHOD, __FILE__, __LINE__
|
65
|
-
def _invoke_#{name.to_s.gsub(/\W/,
|
65
|
+
def _invoke_#{name.to_s.gsub(/\W/, "_")}
|
66
66
|
klass, command = self.class.prepare_for_invocation(nil, #{name.inspect})
|
67
67
|
|
68
68
|
if klass
|
@@ -83,7 +83,7 @@ class Thor::Group # rubocop:disable ClassLength
|
|
83
83
|
#
|
84
84
|
# ==== Examples
|
85
85
|
#
|
86
|
-
# class GemGenerator < Thor::Group
|
86
|
+
# class GemGenerator < Bundler::Thor::Group
|
87
87
|
# class_option :test_framework, :type => :string
|
88
88
|
# invoke_from_option :test_framework
|
89
89
|
# end
|
@@ -114,18 +114,18 @@ class Thor::Group # rubocop:disable ClassLength
|
|
114
114
|
names.each do |name|
|
115
115
|
unless class_options.key?(name)
|
116
116
|
fail ArgumentError, "You have to define the option #{name.inspect} " <<
|
117
|
-
|
117
|
+
"before setting invoke_from_option."
|
118
118
|
end
|
119
119
|
|
120
120
|
invocations[name] = true
|
121
121
|
invocation_blocks[name] = block if block_given?
|
122
122
|
|
123
123
|
class_eval <<-METHOD, __FILE__, __LINE__
|
124
|
-
def _invoke_from_option_#{name.to_s.gsub(/\W/,
|
124
|
+
def _invoke_from_option_#{name.to_s.gsub(/\W/, "_")}
|
125
125
|
return unless options[#{name.inspect}]
|
126
126
|
|
127
127
|
value = options[#{name.inspect}]
|
128
|
-
value = #{name.inspect} if value
|
128
|
+
value = #{name.inspect} if TrueClass === value
|
129
129
|
klass, command = self.class.prepare_for_invocation(#{name.inspect}, value)
|
130
130
|
|
131
131
|
if klass
|
@@ -172,11 +172,11 @@ class Thor::Group # rubocop:disable ClassLength
|
|
172
172
|
def get_options_from_invocations(group_options, base_options) #:nodoc: # rubocop:disable MethodLength
|
173
173
|
invocations.each do |name, from_option|
|
174
174
|
value = if from_option
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
175
|
+
option = class_options[name]
|
176
|
+
option.type == :boolean ? name : option.default
|
177
|
+
else
|
178
|
+
name
|
179
|
+
end
|
180
180
|
next unless value
|
181
181
|
|
182
182
|
klass, _ = prepare_for_invocation(name, value)
|
@@ -199,15 +199,15 @@ class Thor::Group # rubocop:disable ClassLength
|
|
199
199
|
def printable_commands(*)
|
200
200
|
item = []
|
201
201
|
item << banner
|
202
|
-
item << (desc ? "# #{desc.gsub(/\s+/m, ' ')}" :
|
202
|
+
item << (desc ? "# #{desc.gsub(/\s+/m, ' ')}" : "")
|
203
203
|
[item]
|
204
204
|
end
|
205
205
|
alias_method :printable_tasks, :printable_commands
|
206
206
|
|
207
207
|
def handle_argument_error(command, error, args, arity) #:nodoc:
|
208
208
|
msg = "#{basename} #{command.name} takes #{arity} argument"
|
209
|
-
msg <<
|
210
|
-
msg <<
|
209
|
+
msg << "s" if arity > 1
|
210
|
+
msg << ", but it should not."
|
211
211
|
fail error, msg
|
212
212
|
end
|
213
213
|
|
@@ -215,12 +215,12 @@ class Thor::Group # rubocop:disable ClassLength
|
|
215
215
|
|
216
216
|
# The method responsible for dispatching given the args.
|
217
217
|
def dispatch(command, given_args, given_opts, config) #:nodoc:
|
218
|
-
if Thor::HELP_MAPPINGS.include?(given_args.first)
|
218
|
+
if Bundler::Thor::HELP_MAPPINGS.include?(given_args.first)
|
219
219
|
help(config[:shell])
|
220
220
|
return
|
221
221
|
end
|
222
222
|
|
223
|
-
args, opts = Thor::Options.split(given_args)
|
223
|
+
args, opts = Bundler::Thor::Options.split(given_args)
|
224
224
|
opts = given_opts || opts
|
225
225
|
|
226
226
|
instance = new(args, opts, config)
|
@@ -234,29 +234,29 @@ class Thor::Group # rubocop:disable ClassLength
|
|
234
234
|
end
|
235
235
|
|
236
236
|
# The banner for this class. You can customize it if you are invoking the
|
237
|
-
# thor class by another ways which is not the Thor::Runner.
|
237
|
+
# thor class by another ways which is not the Bundler::Thor::Runner.
|
238
238
|
def banner
|
239
239
|
"#{basename} #{self_command.formatted_usage(self, false)}"
|
240
240
|
end
|
241
241
|
|
242
242
|
# Represents the whole class as a command.
|
243
243
|
def self_command #:nodoc:
|
244
|
-
Thor::DynamicCommand.new(namespace, class_options)
|
244
|
+
Bundler::Thor::DynamicCommand.new(namespace, class_options)
|
245
245
|
end
|
246
246
|
alias_method :self_task, :self_command
|
247
247
|
|
248
248
|
def baseclass #:nodoc:
|
249
|
-
Thor::Group
|
249
|
+
Bundler::Thor::Group
|
250
250
|
end
|
251
251
|
|
252
252
|
def create_command(meth) #:nodoc:
|
253
|
-
commands[meth.to_s] = Thor::Command.new(meth, nil, nil, nil, nil)
|
253
|
+
commands[meth.to_s] = Bundler::Thor::Command.new(meth, nil, nil, nil, nil)
|
254
254
|
true
|
255
255
|
end
|
256
256
|
alias_method :create_task, :create_command
|
257
257
|
end
|
258
258
|
|
259
|
-
include Thor::Base
|
259
|
+
include Bundler::Thor::Base
|
260
260
|
|
261
261
|
protected
|
262
262
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Thor
|
1
|
+
class Bundler::Thor
|
2
2
|
module Invocation
|
3
3
|
def self.included(base) #:nodoc:
|
4
4
|
base.extend ClassMethods
|
@@ -7,11 +7,11 @@ class Thor
|
|
7
7
|
module ClassMethods
|
8
8
|
# This method is responsible for receiving a name and find the proper
|
9
9
|
# class and command for it. The key is an optional parameter which is
|
10
|
-
# available only in class methods invocations (i.e. in Thor::Group).
|
10
|
+
# available only in class methods invocations (i.e. in Bundler::Thor::Group).
|
11
11
|
def prepare_for_invocation(key, name) #:nodoc:
|
12
12
|
case name
|
13
13
|
when Symbol, String
|
14
|
-
Thor::Util.find_class_and_command_by_namespace(name.to_s, !key)
|
14
|
+
Bundler::Thor::Util.find_class_and_command_by_namespace(name.to_s, !key)
|
15
15
|
else
|
16
16
|
name
|
17
17
|
end
|
@@ -25,8 +25,13 @@ class Thor
|
|
25
25
|
super
|
26
26
|
end
|
27
27
|
|
28
|
+
# Make the current command chain accessible with in a Bundler::Thor-(sub)command
|
29
|
+
def current_command_chain
|
30
|
+
@_invocations.values.flatten.map(&:to_sym)
|
31
|
+
end
|
32
|
+
|
28
33
|
# Receives a name and invokes it. The name can be a string (either "command" or
|
29
|
-
# "namespace:command"), a Thor::Command, a Class or a Thor instance. If the
|
34
|
+
# "namespace:command"), a Bundler::Thor::Command, a Class or a Bundler::Thor instance. If the
|
30
35
|
# command cannot be guessed by name, it can also be supplied as second argument.
|
31
36
|
#
|
32
37
|
# You can also supply the arguments, options and configuration values for
|
@@ -37,7 +42,7 @@ class Thor
|
|
37
42
|
#
|
38
43
|
# ==== Examples
|
39
44
|
#
|
40
|
-
# class A < Thor
|
45
|
+
# class A < Bundler::Thor
|
41
46
|
# def foo
|
42
47
|
# invoke :bar
|
43
48
|
# invoke "b:hello", ["Erik"]
|
@@ -48,7 +53,7 @@ class Thor
|
|
48
53
|
# end
|
49
54
|
# end
|
50
55
|
#
|
51
|
-
# class B < Thor
|
56
|
+
# class B < Bundler::Thor
|
52
57
|
# def hello(name)
|
53
58
|
# puts "hello #{name}"
|
54
59
|
# end
|
@@ -65,7 +70,7 @@ class Thor
|
|
65
70
|
# supplied to B. This allows lazy parse of options. Let's suppose you have
|
66
71
|
# some rspec commands:
|
67
72
|
#
|
68
|
-
# class Rspec < Thor::Group
|
73
|
+
# class Rspec < Bundler::Thor::Group
|
69
74
|
# class_option :mock_framework, :type => :string, :default => :rr
|
70
75
|
#
|
71
76
|
# def invoke_mock_framework
|
@@ -76,7 +81,7 @@ class Thor
|
|
76
81
|
# As you noticed, it invokes the given mock framework, which might have its
|
77
82
|
# own options:
|
78
83
|
#
|
79
|
-
# class Rspec::RR < Thor::Group
|
84
|
+
# class Rspec::RR < Bundler::Thor::Group
|
80
85
|
# class_option :style, :type => :string, :default => :mock
|
81
86
|
# end
|
82
87
|
#
|
@@ -95,7 +100,7 @@ class Thor
|
|
95
100
|
#
|
96
101
|
def invoke(name = nil, *args)
|
97
102
|
if name.nil?
|
98
|
-
warn "[Thor] Calling invoke() without argument is deprecated. Please use invoke_all instead.\n#{caller.join("\n")}"
|
103
|
+
warn "[Bundler::Thor] Calling invoke() without argument is deprecated. Please use invoke_all instead.\n#{caller.join("\n")}"
|
99
104
|
return invoke_all
|
100
105
|
end
|
101
106
|
|
@@ -103,8 +108,8 @@ class Thor
|
|
103
108
|
command, args, opts, config = args
|
104
109
|
|
105
110
|
klass, command = _retrieve_class_and_command(name, command)
|
106
|
-
fail "Missing Thor class for invoke #{name}" unless klass
|
107
|
-
fail "Expected Thor class, got #{klass}" unless klass <= Thor::Base
|
111
|
+
fail "Missing Bundler::Thor class for invoke #{name}" unless klass
|
112
|
+
fail "Expected Bundler::Thor class, got #{klass}" unless klass <= Bundler::Thor::Base
|
108
113
|
|
109
114
|
args, opts, config = _parse_initialization_options(args, opts, config)
|
110
115
|
klass.send(:dispatch, command, args, opts, config) do |instance|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "thor/line_editor/basic"
|
2
|
+
require "thor/line_editor/readline"
|
3
|
+
|
4
|
+
class Bundler::Thor
|
5
|
+
module LineEditor
|
6
|
+
def self.readline(prompt, options = {})
|
7
|
+
best_available.new(prompt, options).readline
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.best_available
|
11
|
+
[
|
12
|
+
Bundler::Thor::LineEditor::Readline,
|
13
|
+
Bundler::Thor::LineEditor::Basic
|
14
|
+
].detect(&:available?)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "readline"
|
3
3
|
rescue LoadError
|
4
4
|
end
|
5
5
|
|
6
|
-
class Thor
|
6
|
+
class Bundler::Thor
|
7
7
|
module LineEditor
|
8
8
|
class Readline < Basic
|
9
9
|
def self.available?
|
@@ -23,7 +23,7 @@ class Thor
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
private
|
27
27
|
|
28
28
|
def add_to_history?
|
29
29
|
options.fetch(:add_to_history, true)
|
@@ -31,9 +31,9 @@ class Thor
|
|
31
31
|
|
32
32
|
def completion_proc
|
33
33
|
if use_path_completion?
|
34
|
-
|
34
|
+
proc { |text| PathCompletion.new(text).matches }
|
35
35
|
elsif completion_options.any?
|
36
|
-
|
36
|
+
proc do |text|
|
37
37
|
completion_options.select { |option| option.start_with?(text) }
|
38
38
|
end
|
39
39
|
end
|
@@ -59,10 +59,10 @@ class Thor
|
|
59
59
|
relative_matches
|
60
60
|
end
|
61
61
|
|
62
|
-
|
62
|
+
private
|
63
63
|
|
64
64
|
def relative_matches
|
65
|
-
absolute_matches.map { |path| path.sub(base_path,
|
65
|
+
absolute_matches.map { |path| path.sub(base_path, "") }
|
66
66
|
end
|
67
67
|
|
68
68
|
def absolute_matches
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Thor
|
1
|
+
class Bundler::Thor
|
2
2
|
class Argument #:nodoc:
|
3
3
|
VALID_TYPES = [:numeric, :hash, :array, :string]
|
4
4
|
|
@@ -6,7 +6,7 @@ class Thor
|
|
6
6
|
alias_method :human_name, :name
|
7
7
|
|
8
8
|
def initialize(name, options = {})
|
9
|
-
class_name = self.class.name.split(
|
9
|
+
class_name = self.class.name.split("::").last
|
10
10
|
|
11
11
|
type = options[:type]
|
12
12
|
|
@@ -45,9 +45,9 @@ class Thor
|
|
45
45
|
|
46
46
|
def validate!
|
47
47
|
if required? && !default.nil?
|
48
|
-
fail ArgumentError,
|
48
|
+
fail ArgumentError, "An argument cannot be required and have default value."
|
49
49
|
elsif @enum && !@enum.is_a?(Array)
|
50
|
-
fail ArgumentError,
|
50
|
+
fail ArgumentError, "An argument cannot have an enum other than an array."
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -62,11 +62,11 @@ class Thor
|
|
62
62
|
when :string, :default
|
63
63
|
human_name.upcase
|
64
64
|
when :numeric
|
65
|
-
|
65
|
+
"N"
|
66
66
|
when :hash
|
67
|
-
|
67
|
+
"key:value"
|
68
68
|
when :array
|
69
|
-
|
69
|
+
"one two three"
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|