bundler 1.2.5 → 1.3.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.
- data/.gitignore +10 -7
- data/.travis.yml +12 -3
- data/CHANGELOG.md +26 -19
- data/CONTRIBUTE.md +97 -0
- data/README.md +4 -2
- data/Rakefile +17 -59
- data/bundler.gemspec +2 -1
- data/lib/bundler.rb +23 -20
- data/lib/bundler/cli.rb +68 -22
- data/lib/bundler/definition.rb +3 -2
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +14 -16
- data/lib/bundler/environment.rb +0 -5
- data/lib/bundler/fetcher.rb +23 -78
- data/lib/bundler/friendly_errors.rb +4 -5
- data/lib/bundler/gem_helper.rb +14 -16
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +1 -7
- data/lib/bundler/lazy_specification.rb +6 -3
- data/lib/bundler/lockfile_parser.rb +25 -13
- data/lib/bundler/resolver.rb +0 -1
- data/lib/bundler/rubygems_integration.rb +83 -17
- data/lib/bundler/settings.rb +4 -2
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +3 -886
- data/lib/bundler/source/git.rb +267 -0
- data/lib/bundler/source/git/git_proxy.rb +142 -0
- data/lib/bundler/source/path.rb +209 -0
- data/lib/bundler/source/path/installer.rb +33 -0
- data/lib/bundler/source/rubygems.rb +261 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +3 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +9 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +20 -5
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/thor.rb +74 -5
- data/lib/bundler/vendor/thor/actions.rb +5 -5
- data/lib/bundler/vendor/thor/actions/directory.rb +1 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +7 -1
- data/lib/bundler/vendor/thor/base.rb +44 -11
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +5 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +14 -7
- data/lib/bundler/vendor/thor/parser/arguments.rb +7 -1
- data/lib/bundler/vendor/thor/parser/option.rb +8 -8
- data/lib/bundler/vendor/thor/parser/options.rb +62 -24
- data/lib/bundler/vendor/thor/runner.rb +1 -1
- data/lib/bundler/vendor/thor/shell/basic.rb +2 -2
- data/lib/bundler/vendor/thor/task.rb +2 -2
- data/lib/bundler/vendor/thor/version.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +3 -15
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-exec.ronn +1 -1
- data/man/bundle-update.ronn +1 -1
- data/man/bundle.ronn +4 -1
- data/spec/bundler/bundler_spec.rb +2 -28
- data/spec/bundler/cli_rspec.rb +9 -0
- data/spec/bundler/definition_spec.rb +1 -1
- data/spec/bundler/dsl_spec.rb +15 -8
- data/spec/bundler/gem_helper_spec.rb +38 -21
- data/spec/bundler/psyched_yaml_spec.rb +1 -0
- data/spec/bundler/source_spec.rb +3 -3
- data/spec/cache/gems_spec.rb +24 -24
- data/spec/cache/git_spec.rb +21 -23
- data/spec/cache/path_spec.rb +11 -11
- data/spec/cache/platform_spec.rb +6 -6
- data/spec/install/deploy_spec.rb +38 -38
- data/spec/install/gems/c_ext_spec.rb +2 -2
- data/spec/install/gems/dependency_api_spec.rb +23 -116
- data/spec/install/gems/env_spec.rb +1 -1
- data/spec/install/gems/flex_spec.rb +7 -8
- data/spec/install/gems/groups_spec.rb +10 -10
- data/spec/install/gems/packed_spec.rb +4 -4
- data/spec/install/gems/platform_spec.rb +3 -3
- data/spec/install/gems/post_install_spec.rb +9 -9
- data/spec/install/gems/resolving_spec.rb +2 -2
- data/spec/install/gems/simple_case_spec.rb +50 -53
- data/spec/install/gems/standalone_spec.rb +19 -19
- data/spec/install/gems/sudo_spec.rb +31 -16
- data/spec/install/gems/win32_spec.rb +1 -1
- data/spec/install/gemspec_spec.rb +6 -6
- data/spec/install/git_spec.rb +34 -34
- data/spec/install/invalid_spec.rb +3 -3
- data/spec/install/path_spec.rb +71 -8
- data/spec/install/upgrade_spec.rb +2 -2
- data/spec/integration/inject.rb +78 -0
- data/spec/lock/git_spec.rb +2 -2
- data/spec/lock/lockfile_spec.rb +14 -14
- data/spec/other/check_spec.rb +29 -29
- data/spec/other/clean_spec.rb +47 -48
- data/spec/other/config_spec.rb +20 -20
- data/spec/other/console_spec.rb +5 -5
- data/spec/other/exec_spec.rb +48 -28
- data/spec/other/ext_spec.rb +3 -3
- data/spec/other/help_spec.rb +6 -6
- data/spec/other/init_spec.rb +8 -8
- data/spec/other/newgem_spec.rb +95 -15
- data/spec/other/open_spec.rb +10 -5
- data/spec/other/outdated_spec.rb +8 -8
- data/spec/other/platform_spec.rb +45 -45
- data/spec/other/show_spec.rb +10 -10
- data/spec/quality_spec.rb +2 -2
- data/spec/realworld/dependency_api_spec.rb +61 -0
- data/spec/realworld/edgecases_spec.rb +8 -8
- data/spec/runtime/executable_spec.rb +13 -13
- data/spec/runtime/load_spec.rb +12 -12
- data/spec/runtime/platform_spec.rb +1 -1
- data/spec/runtime/require_spec.rb +24 -24
- data/spec/runtime/setup_spec.rb +113 -56
- data/spec/runtime/with_clean_env_spec.rb +11 -13
- data/spec/spec_helper.rb +6 -0
- data/spec/support/artifice/endpoint.rb +28 -13
- data/spec/support/artifice/endpoint_extra.rb +4 -0
- data/spec/support/builders.rb +1 -1
- data/spec/support/helpers.rb +2 -7
- data/spec/support/indexes.rb +3 -3
- data/spec/support/matchers.rb +6 -6
- data/spec/update/gems_spec.rb +19 -8
- data/spec/update/git_spec.rb +10 -10
- data/spec/update/source_spec.rb +1 -1
- metadata +86 -55
- data/.rspec +0 -2
@@ -114,12 +114,12 @@ class Thor
|
|
114
114
|
# the script started).
|
115
115
|
#
|
116
116
|
def relative_to_original_destination_root(path, remove_dot=true)
|
117
|
-
|
118
|
-
|
119
|
-
|
117
|
+
path = path.dup
|
118
|
+
if path.gsub!(@destination_stack[0], '.')
|
119
|
+
remove_dot ? (path[2..-1] || '') : path
|
120
|
+
else
|
121
|
+
path
|
120
122
|
end
|
121
|
-
|
122
|
-
path
|
123
123
|
end
|
124
124
|
|
125
125
|
# Holds source paths in instance so they can be manipulated.
|
@@ -38,6 +38,7 @@ class Thor
|
|
38
38
|
# destination<String>:: the relative path to the destination root.
|
39
39
|
# config<Hash>:: give :verbose => false to not log the status.
|
40
40
|
# If :recursive => false, does not look for paths recursively.
|
41
|
+
# If :mode => :preserve, preserve the file mode from the source.
|
41
42
|
#
|
42
43
|
# ==== Examples
|
43
44
|
#
|
@@ -10,7 +10,9 @@ class Thor
|
|
10
10
|
# ==== Parameters
|
11
11
|
# source<String>:: the relative path to the source root.
|
12
12
|
# destination<String>:: the relative path to the destination root.
|
13
|
-
# config<Hash>:: give :verbose => false to not log the status
|
13
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
14
|
+
# :mode => :preserve, to preserve the file mode from the source.
|
15
|
+
|
14
16
|
#
|
15
17
|
# ==== Examples
|
16
18
|
#
|
@@ -28,6 +30,10 @@ class Thor
|
|
28
30
|
content = block.call(content) if block
|
29
31
|
content
|
30
32
|
end
|
33
|
+
if config[:mode] == :preserve
|
34
|
+
mode = File.stat(source).mode
|
35
|
+
chmod(destination, mode, config)
|
36
|
+
end
|
31
37
|
end
|
32
38
|
|
33
39
|
# Links the file from the relative source to the relative destination. If
|
@@ -10,6 +10,7 @@ require 'thor/util'
|
|
10
10
|
class Thor
|
11
11
|
autoload :Actions, 'thor/actions'
|
12
12
|
autoload :RakeCompat, 'thor/rake_compat'
|
13
|
+
autoload :Group, 'thor/group'
|
13
14
|
|
14
15
|
# Shortcuts for help.
|
15
16
|
HELP_MAPPINGS = %w(-h -? --help -D)
|
@@ -58,7 +59,8 @@ class Thor
|
|
58
59
|
# Let Thor::Options parse the options first, so it can remove
|
59
60
|
# declared options from the array. This will leave us with
|
60
61
|
# a list of arguments that weren't declared.
|
61
|
-
|
62
|
+
stop_on_unknown = self.class.stop_on_unknown_option? config[:current_task]
|
63
|
+
opts = Thor::Options.new(parse_options, hash_options, stop_on_unknown)
|
62
64
|
self.options = opts.parse(array_options)
|
63
65
|
|
64
66
|
# If unknown options are disallowed, make sure that none of the
|
@@ -70,11 +72,12 @@ class Thor
|
|
70
72
|
# arguments declared using #argument (this is primarily used
|
71
73
|
# by Thor::Group). Tis will leave us with the remaining
|
72
74
|
# positional arguments.
|
73
|
-
|
74
|
-
|
75
|
-
args = thor_args.remaining
|
75
|
+
to_parse = args
|
76
|
+
to_parse += opts.remaining unless self.class.strict_args_position?(config)
|
76
77
|
|
77
|
-
|
78
|
+
thor_args = Thor::Arguments.new(self.class.arguments)
|
79
|
+
thor_args.parse(to_parse).each { |k,v| __send__("#{k}=", v) }
|
80
|
+
@args = thor_args.remaining
|
78
81
|
end
|
79
82
|
|
80
83
|
class << self
|
@@ -141,6 +144,28 @@ class Thor
|
|
141
144
|
!!check_unknown_options
|
142
145
|
end
|
143
146
|
|
147
|
+
# If true, option parsing is suspended as soon as an unknown option or a
|
148
|
+
# regular argument is encountered. All remaining arguments are passed to
|
149
|
+
# the task as regular arguments.
|
150
|
+
def stop_on_unknown_option?(task_name) #:nodoc:
|
151
|
+
false
|
152
|
+
end
|
153
|
+
|
154
|
+
# If you want only strict string args (useful when cascading thor classes),
|
155
|
+
# call strict_args_position! This is disabled by default to allow dynamic
|
156
|
+
# invocations.
|
157
|
+
def strict_args_position!
|
158
|
+
@strict_args_position = true
|
159
|
+
end
|
160
|
+
|
161
|
+
def strict_args_position #:nodoc:
|
162
|
+
@strict_args_position ||= from_superclass(:strict_args_position, false)
|
163
|
+
end
|
164
|
+
|
165
|
+
def strict_args_position?(config) #:nodoc:
|
166
|
+
!!strict_args_position
|
167
|
+
end
|
168
|
+
|
144
169
|
# Adds an argument to the class and creates an attr_accessor for it.
|
145
170
|
#
|
146
171
|
# Arguments are different from options in several aspects. The first one
|
@@ -196,8 +221,9 @@ class Thor
|
|
196
221
|
"the non-required argument #{argument.human_name.inspect}."
|
197
222
|
end if required
|
198
223
|
|
199
|
-
|
200
|
-
|
224
|
+
options[:required] = required
|
225
|
+
|
226
|
+
arguments << Thor::Argument.new(name, options)
|
201
227
|
end
|
202
228
|
|
203
229
|
# Returns this class arguments, looking up in the ancestors chain.
|
@@ -491,6 +517,7 @@ class Thor
|
|
491
517
|
|
492
518
|
list << item
|
493
519
|
list << [ "", "# Default: #{option.default}" ] if option.show_default?
|
520
|
+
list << [ "", "# Possible values: #{option.enum.join(', ')}" ] if option.enum
|
494
521
|
end
|
495
522
|
end
|
496
523
|
|
@@ -510,10 +537,9 @@ class Thor
|
|
510
537
|
# ==== Parameters
|
511
538
|
# name<Symbol>:: The name of the argument.
|
512
539
|
# options<Hash>:: Described in both class_option and method_option.
|
540
|
+
# scope<Hash>:: Options hash that is being built up
|
513
541
|
def build_option(name, options, scope) #:nodoc:
|
514
|
-
scope[name] = Thor::Option.new(name, options
|
515
|
-
options[:type], options[:default], options[:banner],
|
516
|
-
options[:lazy_default], options[:group], options[:aliases], options[:hide])
|
542
|
+
scope[name] = Thor::Option.new(name, options)
|
517
543
|
end
|
518
544
|
|
519
545
|
# Receives a hash of options, parse them and add to the scope. This is a
|
@@ -576,7 +602,14 @@ class Thor
|
|
576
602
|
default
|
577
603
|
else
|
578
604
|
value = superclass.send(method)
|
579
|
-
|
605
|
+
|
606
|
+
if value
|
607
|
+
if value.is_a?(TrueClass) || value.is_a?(Symbol)
|
608
|
+
value
|
609
|
+
else
|
610
|
+
value.dup
|
611
|
+
end
|
612
|
+
end
|
580
613
|
end
|
581
614
|
end
|
582
615
|
|
@@ -2,21 +2,24 @@ class Thor
|
|
2
2
|
class Argument #:nodoc:
|
3
3
|
VALID_TYPES = [ :numeric, :hash, :array, :string ]
|
4
4
|
|
5
|
-
attr_reader :name, :description, :required, :type, :default, :banner
|
5
|
+
attr_reader :name, :description, :enum, :required, :type, :default, :banner
|
6
6
|
alias :human_name :name
|
7
7
|
|
8
|
-
def initialize(name,
|
8
|
+
def initialize(name, options={})
|
9
9
|
class_name = self.class.name.split("::").last
|
10
10
|
|
11
|
+
type = options[:type]
|
12
|
+
|
11
13
|
raise ArgumentError, "#{class_name} name can't be nil." if name.nil?
|
12
14
|
raise ArgumentError, "Type :#{type} is not valid for #{class_name.downcase}s." if type && !valid_type?(type)
|
13
15
|
|
14
16
|
@name = name.to_s
|
15
|
-
@description =
|
16
|
-
@required = required
|
17
|
+
@description = options[:desc]
|
18
|
+
@required = options.key?(:required) ? options[:required] : true
|
17
19
|
@type = (type || :string).to_sym
|
18
|
-
@default = default
|
19
|
-
@banner = banner || default_banner
|
20
|
+
@default = options[:default]
|
21
|
+
@banner = options[:banner] || default_banner
|
22
|
+
@enum = options[:enum]
|
20
23
|
|
21
24
|
validate! # Trigger specific validations
|
22
25
|
end
|
@@ -41,7 +44,11 @@ class Thor
|
|
41
44
|
protected
|
42
45
|
|
43
46
|
def validate!
|
44
|
-
|
47
|
+
if required? && !default.nil?
|
48
|
+
raise ArgumentError, "An argument cannot be required and have default value."
|
49
|
+
elsif @enum && !@enum.is_a?(Array)
|
50
|
+
raise ArgumentError, "An argument cannot have an enum other than an array."
|
51
|
+
end
|
45
52
|
end
|
46
53
|
|
47
54
|
def valid_type?(type)
|
@@ -144,7 +144,13 @@ class Thor
|
|
144
144
|
if no_or_skip?(name)
|
145
145
|
nil
|
146
146
|
else
|
147
|
-
shift
|
147
|
+
value = shift
|
148
|
+
if @switches.is_a?(Hash) && switch = @switches[name]
|
149
|
+
if switch.enum && !switch.enum.include?(value)
|
150
|
+
raise MalformattedArgumentError, "Expected '#{name}' to be one of #{switch.enum.join(', ')}; got #{value}"
|
151
|
+
end
|
152
|
+
end
|
153
|
+
value
|
148
154
|
end
|
149
155
|
end
|
150
156
|
|
@@ -4,12 +4,13 @@ class Thor
|
|
4
4
|
|
5
5
|
VALID_TYPES = [:boolean, :numeric, :hash, :array, :string]
|
6
6
|
|
7
|
-
def initialize(name,
|
8
|
-
|
9
|
-
|
10
|
-
@
|
11
|
-
@
|
12
|
-
@
|
7
|
+
def initialize(name, options={})
|
8
|
+
options[:required] = false unless options.key?(:required)
|
9
|
+
super
|
10
|
+
@lazy_default = options[:lazy_default]
|
11
|
+
@group = options[:group].to_s.capitalize if options[:group]
|
12
|
+
@aliases = Array(options[:aliases])
|
13
|
+
@hide = options[:hide]
|
13
14
|
end
|
14
15
|
|
15
16
|
# This parse quick options given as method_options. It makes several
|
@@ -64,8 +65,7 @@ class Thor
|
|
64
65
|
when Hash, Array, String
|
65
66
|
value.class.name.downcase.to_sym
|
66
67
|
end
|
67
|
-
|
68
|
-
self.new(name.to_s, nil, required, type, default, nil, nil, nil, aliases)
|
68
|
+
self.new(name.to_s, :required => required, :type => type, :default => default, :aliases => aliases)
|
69
69
|
end
|
70
70
|
|
71
71
|
def switch_name
|
@@ -5,6 +5,7 @@ class Thor
|
|
5
5
|
EQ_RE = /^(--\w+(?:-\w+)*|-[a-z])=(.*)$/i
|
6
6
|
SHORT_SQ_RE = /^-([a-z]{2,})$/i # Allow either -x -v or -xv style for single char args
|
7
7
|
SHORT_NUM = /^(-[a-z])#{NUMERIC}$/i
|
8
|
+
OPTS_END = '--'.freeze
|
8
9
|
|
9
10
|
# Receives a hash and makes it switches.
|
10
11
|
def self.to_switches(options)
|
@@ -25,7 +26,11 @@ class Thor
|
|
25
26
|
end
|
26
27
|
|
27
28
|
# Takes a hash of Thor::Option and a hash with defaults.
|
28
|
-
|
29
|
+
#
|
30
|
+
# If +stop_on_unknown+ is true, #parse will stop as soon as it encounters
|
31
|
+
# an unknown option or a regular argument.
|
32
|
+
def initialize(hash_options={}, defaults={}, stop_on_unknown=false)
|
33
|
+
@stop_on_unknown = stop_on_unknown
|
29
34
|
options = hash_options.values
|
30
35
|
super(options)
|
31
36
|
|
@@ -50,33 +55,55 @@ class Thor
|
|
50
55
|
@extra
|
51
56
|
end
|
52
57
|
|
58
|
+
def peek
|
59
|
+
return super unless @parsing_options
|
60
|
+
|
61
|
+
result = super
|
62
|
+
if result == OPTS_END
|
63
|
+
shift
|
64
|
+
@parsing_options = false
|
65
|
+
super
|
66
|
+
else
|
67
|
+
result
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
53
71
|
def parse(args)
|
54
72
|
@pile = args.dup
|
73
|
+
@parsing_options = true
|
55
74
|
|
56
75
|
while peek
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
76
|
+
if parsing_options?
|
77
|
+
match, is_switch = current_is_switch?
|
78
|
+
shifted = shift
|
79
|
+
|
80
|
+
if is_switch
|
81
|
+
case shifted
|
82
|
+
when SHORT_SQ_RE
|
83
|
+
unshift($1.split('').map { |f| "-#{f}" })
|
84
|
+
next
|
85
|
+
when EQ_RE, SHORT_NUM
|
86
|
+
unshift($2)
|
87
|
+
switch = $1
|
88
|
+
when LONG_RE, SHORT_RE
|
89
|
+
switch = $1
|
90
|
+
end
|
91
|
+
|
92
|
+
switch = normalize_switch(switch)
|
93
|
+
option = switch_option(switch)
|
94
|
+
@assigns[option.human_name] = parse_peek(switch, option)
|
95
|
+
elsif @stop_on_unknown
|
96
|
+
@extra << shifted
|
97
|
+
@extra << shift while peek
|
98
|
+
break
|
99
|
+
elsif match
|
100
|
+
@extra << shifted
|
101
|
+
@extra << shift while peek && peek !~ /^-/
|
102
|
+
else
|
103
|
+
@extra << shifted
|
70
104
|
end
|
71
|
-
|
72
|
-
switch = normalize_switch(switch)
|
73
|
-
option = switch_option(switch)
|
74
|
-
@assigns[option.human_name] = parse_peek(switch, option)
|
75
|
-
elsif match
|
76
|
-
@extra << shifted
|
77
|
-
@extra << shift while peek && peek !~ /^-/
|
78
105
|
else
|
79
|
-
@extra <<
|
106
|
+
@extra << shift
|
80
107
|
end
|
81
108
|
end
|
82
109
|
|
@@ -95,8 +122,10 @@ class Thor
|
|
95
122
|
|
96
123
|
protected
|
97
124
|
|
98
|
-
#
|
125
|
+
# Check if the current value in peek is a registered switch.
|
99
126
|
#
|
127
|
+
# Two booleans are returned. The first is true if the current value
|
128
|
+
# starts with a hyphen; the second is true if it is a registered switch.
|
100
129
|
def current_is_switch?
|
101
130
|
case peek
|
102
131
|
when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM
|
@@ -117,6 +146,10 @@ class Thor
|
|
117
146
|
end
|
118
147
|
end
|
119
148
|
|
149
|
+
def current_is_value?
|
150
|
+
peek && (!parsing_options? || super)
|
151
|
+
end
|
152
|
+
|
120
153
|
def switch?(arg)
|
121
154
|
switch_option(normalize_switch(arg))
|
122
155
|
end
|
@@ -135,6 +168,11 @@ class Thor
|
|
135
168
|
(@shorts[arg] || arg).tr('_', '-')
|
136
169
|
end
|
137
170
|
|
171
|
+
def parsing_options?
|
172
|
+
peek
|
173
|
+
@parsing_options
|
174
|
+
end
|
175
|
+
|
138
176
|
# Parse boolean values which can be given as --foo=true, --foo or --no-foo.
|
139
177
|
#
|
140
178
|
def parse_boolean(switch)
|
@@ -156,7 +194,7 @@ class Thor
|
|
156
194
|
# Parse the value at the peek analyzing if it requires an input or not.
|
157
195
|
#
|
158
196
|
def parse_peek(switch, option)
|
159
|
-
if current_is_switch_formatted? || last?
|
197
|
+
if parsing_options? && (current_is_switch_formatted? || last?)
|
160
198
|
if option.boolean?
|
161
199
|
# No problem for boolean types
|
162
200
|
elsif no_or_skip?(switch)
|
@@ -25,7 +25,7 @@ class Thor::Runner < Thor #:nodoc:
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# If a task is not found on Thor::Runner, method missing is invoked and
|
28
|
-
# Thor::Runner is then
|
28
|
+
# Thor::Runner is then responsible for finding the task in all classes.
|
29
29
|
#
|
30
30
|
def method_missing(meth, *args)
|
31
31
|
meth = meth.to_s
|
@@ -58,7 +58,7 @@ class Thor
|
|
58
58
|
# ==== Example
|
59
59
|
# say("I know you knew that.")
|
60
60
|
#
|
61
|
-
def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)
|
61
|
+
def say(message="", color=nil, force_new_line=(message.to_s !~ /( |\t)\Z/))
|
62
62
|
message = message.to_s
|
63
63
|
|
64
64
|
message = set_color(message, *color) if color
|
@@ -370,7 +370,7 @@ HELP
|
|
370
370
|
|
371
371
|
def ask_simply(statement, color=nil)
|
372
372
|
say("#{statement} ", color)
|
373
|
-
stdin.gets.strip
|
373
|
+
stdin.gets.tap{|text| text.strip! if text}
|
374
374
|
end
|
375
375
|
|
376
376
|
def ask_filtered(statement, answer_set, *args)
|
@@ -24,9 +24,9 @@ class Thor
|
|
24
24
|
instance.class.handle_no_task_error(name)
|
25
25
|
elsif public_method?(instance)
|
26
26
|
arity = instance.method(name).arity
|
27
|
-
instance.
|
27
|
+
instance.__send__(name, *args)
|
28
28
|
elsif local_method?(instance, :method_missing)
|
29
|
-
instance.
|
29
|
+
instance.__send__(:method_missing, name.to_sym, *args)
|
30
30
|
else
|
31
31
|
instance.class.handle_no_task_error(name)
|
32
32
|
end
|
@@ -1,15 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
vendor = File.expand_path('../vendor', __FILE__)
|
6
|
-
$:.unshift(vendor) unless $:.include?(vendor)
|
7
|
-
require 'net/http/persistent'
|
8
|
-
|
9
|
-
USE_PERSISTENT = true
|
10
|
-
|
11
|
-
rescue LoadError, NameError => e
|
12
|
-
require 'net/http'
|
13
|
-
USE_PERSISTENT = false
|
14
|
-
|
15
|
-
end
|
1
|
+
vendor = File.expand_path('../vendor', __FILE__)
|
2
|
+
$:.unshift(vendor) unless $:.include?(vendor)
|
3
|
+
require 'net/http/persistent'
|