thor 0.20.3 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -9
  3. data/lib/thor/actions/create_file.rb +4 -3
  4. data/lib/thor/actions/create_link.rb +3 -2
  5. data/lib/thor/actions/directory.rb +8 -18
  6. data/lib/thor/actions/empty_directory.rb +1 -1
  7. data/lib/thor/actions/file_manipulation.rb +22 -24
  8. data/lib/thor/actions/inject_into_file.rb +34 -13
  9. data/lib/thor/actions.rb +39 -30
  10. data/lib/thor/base.rb +196 -49
  11. data/lib/thor/command.rb +34 -18
  12. data/lib/thor/core_ext/hash_with_indifferent_access.rb +10 -0
  13. data/lib/thor/error.rb +14 -22
  14. data/lib/thor/group.rb +13 -2
  15. data/lib/thor/invocation.rb +2 -1
  16. data/lib/thor/line_editor/basic.rb +1 -1
  17. data/lib/thor/line_editor/readline.rb +6 -6
  18. data/lib/thor/line_editor.rb +2 -2
  19. data/lib/thor/nested_context.rb +29 -0
  20. data/lib/thor/parser/argument.rb +17 -1
  21. data/lib/thor/parser/arguments.rb +35 -15
  22. data/lib/thor/parser/option.rb +45 -13
  23. data/lib/thor/parser/options.rb +79 -11
  24. data/lib/thor/parser.rb +4 -4
  25. data/lib/thor/rake_compat.rb +3 -2
  26. data/lib/thor/runner.rb +43 -32
  27. data/lib/thor/shell/basic.rb +68 -162
  28. data/lib/thor/shell/color.rb +9 -43
  29. data/lib/thor/shell/column_printer.rb +29 -0
  30. data/lib/thor/shell/html.rb +7 -49
  31. data/lib/thor/shell/lcs_diff.rb +49 -0
  32. data/lib/thor/shell/table_printer.rb +118 -0
  33. data/lib/thor/shell/terminal.rb +42 -0
  34. data/lib/thor/shell/wrapped_printer.rb +38 -0
  35. data/lib/thor/shell.rb +5 -5
  36. data/lib/thor/util.rb +25 -8
  37. data/lib/thor/version.rb +1 -1
  38. data/lib/thor.rb +182 -17
  39. data/thor.gemspec +22 -10
  40. metadata +25 -11
  41. data/CHANGELOG.md +0 -204
  42. data/lib/thor/core_ext/io_binary_read.rb +0 -12
  43. data/lib/thor/core_ext/ordered_hash.rb +0 -129
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.3
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -9,22 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-11-10 00:00:00.000000000 Z
12
+ date: 2024-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.0'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '3'
21
24
  type: :development
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
26
29
  - !ruby/object:Gem::Version
27
30
  version: '1.0'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
28
34
  description: Thor is a toolkit for building powerful command-line interfaces.
29
35
  email: ruby-thor@googlegroups.com
30
36
  executables:
@@ -33,7 +39,6 @@ extensions: []
33
39
  extra_rdoc_files: []
34
40
  files:
35
41
  - ".document"
36
- - CHANGELOG.md
37
42
  - CONTRIBUTING.md
38
43
  - LICENSE.md
39
44
  - README.md
@@ -49,14 +54,13 @@ files:
49
54
  - lib/thor/base.rb
50
55
  - lib/thor/command.rb
51
56
  - lib/thor/core_ext/hash_with_indifferent_access.rb
52
- - lib/thor/core_ext/io_binary_read.rb
53
- - lib/thor/core_ext/ordered_hash.rb
54
57
  - lib/thor/error.rb
55
58
  - lib/thor/group.rb
56
59
  - lib/thor/invocation.rb
57
60
  - lib/thor/line_editor.rb
58
61
  - lib/thor/line_editor/basic.rb
59
62
  - lib/thor/line_editor/readline.rb
63
+ - lib/thor/nested_context.rb
60
64
  - lib/thor/parser.rb
61
65
  - lib/thor/parser/argument.rb
62
66
  - lib/thor/parser/arguments.rb
@@ -67,14 +71,25 @@ files:
67
71
  - lib/thor/shell.rb
68
72
  - lib/thor/shell/basic.rb
69
73
  - lib/thor/shell/color.rb
74
+ - lib/thor/shell/column_printer.rb
70
75
  - lib/thor/shell/html.rb
76
+ - lib/thor/shell/lcs_diff.rb
77
+ - lib/thor/shell/table_printer.rb
78
+ - lib/thor/shell/terminal.rb
79
+ - lib/thor/shell/wrapped_printer.rb
71
80
  - lib/thor/util.rb
72
81
  - lib/thor/version.rb
73
82
  - thor.gemspec
74
83
  homepage: http://whatisthor.com/
75
84
  licenses:
76
85
  - MIT
77
- metadata: {}
86
+ metadata:
87
+ bug_tracker_uri: https://github.com/rails/thor/issues
88
+ changelog_uri: https://github.com/rails/thor/releases/tag/v1.3.2
89
+ documentation_uri: http://whatisthor.com/
90
+ source_code_uri: https://github.com/rails/thor/tree/v1.3.2
91
+ wiki_uri: https://github.com/rails/thor/wiki
92
+ rubygems_mfa_required: 'true'
78
93
  post_install_message:
79
94
  rdoc_options: []
80
95
  require_paths:
@@ -83,15 +98,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
98
  requirements:
84
99
  - - ">="
85
100
  - !ruby/object:Gem::Version
86
- version: 1.8.7
101
+ version: 2.6.0
87
102
  required_rubygems_version: !ruby/object:Gem::Requirement
88
103
  requirements:
89
104
  - - ">="
90
105
  - !ruby/object:Gem::Version
91
106
  version: 1.3.5
92
107
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 2.7.6
108
+ rubygems_version: 3.5.11
95
109
  signing_key:
96
110
  specification_version: 4
97
111
  summary: Thor is a toolkit for building powerful command-line interfaces.
data/CHANGELOG.md DELETED
@@ -1,204 +0,0 @@
1
- # 0.20.3
2
- * Support old versions of `did_you_mean`.
3
-
4
- # 0.20.2
5
- * Fix `did_you_mean` support.
6
-
7
- # 0.20.1
8
- * Support new versions fo ERB.
9
- * Fix `check_unknown_options!` to not check the content that was not parsed, i.e. after a `--` or after the first unknown with `stop_on_unknown_option!`
10
- * Add `did_you_mean` support.
11
-
12
- ## 0.20.0
13
- * Add `check_default_type!` to check if the default value of an option matches the defined type.
14
- It removes the warning on usage and gives the command authors the possibility to check for programming errors.
15
-
16
- * Add `disable_required_check!` to disable check for required options in some commands.
17
- It is a substitute of `disable_class_options` that was not working as intended.
18
-
19
- * Add `inject_into_module`.
20
-
21
- ## 0.19.4, release 2016-11-28
22
- * Rename `Thor::Base#thor_reserved_word?` to `#is_thor_reserved_word?`
23
-
24
- ## 0.19.3, release 2016-11-27
25
- * Output a warning instead of raising an exception when a default option value doesn't match its specified type
26
-
27
- ## 0.19.2, release 2016-11-26
28
- * Fix bug with handling of colors passed to `ask` (and methods like `yes?` and `no?` which it underpins)
29
- * Allow numeric arguments to be negative
30
- * Ensure that default option values are of the specified type (e.g. you can't specify `"foo"` as the default for a numeric option), but make symbols and strings interchangeable
31
- * Add `Thor::Shell::Basic#indent` method for intending output
32
- * Fix `remove_command` for an inherited command (see #451)
33
- * Allow hash arguments to only have each key provided once (see #455)
34
- * Allow commands to disable class options, for instance for "help" commands (see #363)
35
- * Do not generate a negative option (`--no-no-foo`) for already negative boolean options (`--no-foo`)
36
- * Improve compatibility of `Thor::CoreExt::HashWithIndifferentAccess` with Ruby standard library `Hash`
37
- * Allow specifying a custom binding for template evaluation (e.g. `#key?` and `#fetch`)
38
- * Fix support for subcommand-specific "help"s
39
- * Use a string buffer when handling ERB for Ruby 2.3 compatibility
40
- * Update dependencies
41
-
42
- ## 0.19.1, release 2014-03-24
43
- * Fix `say` non-String break regression
44
-
45
- ## 0.19.0, release 2014-03-22
46
- * Add support for a default to #ask
47
- * Avoid @namespace not initialized warning
48
- * Avoid private attribute? warning
49
- * Fix initializing with unknown options
50
- * Loosen required_rubygems_version for compatibility with Ubuntu 10.04
51
- * Shell#ask: support a noecho option for stdin
52
- * Shell#ask: change API to be :echo => false
53
- * Display a message without a stack trace for ambiguous commands
54
- * Make say and say_status thread safe
55
- * Dependency for console io version check
56
- * Alias --help to help on subcommands
57
- * Use mime-types 1.x for Ruby 1.8.7 compatibility for Ruby 1.8 only
58
- * Accept .tt files as templates
59
- * Check if numeric value is in enum
60
- * Use Readline for user input
61
- * Fix dispatching of subcommands (concerning :help and *args)
62
- * Fix warnings when running specs with `$VERBOSE = true`
63
- * Make subcommand help more consistent
64
- * Make the current command chain accessible in command
65
-
66
- ## 0.18.1, release 2013-03-30
67
- * Revert regressions found in 0.18.0
68
-
69
- ## 0.18.0, release 2013-03-26
70
- * Remove rake2thor
71
- * Only display colors if output medium supports colors
72
- * Pass parent_options to subcommands
73
- * Fix non-dash-prefixed aliases
74
- * Make error messages more helpful
75
- * Rename "task" to "command"
76
- * Add the method to allow for custom package name
77
-
78
- ## 0.17.0, release 2013-01-24
79
- * Add better support for tasks that accept arbitrary additional arguments (e.g. things like `bundle exec`)
80
- * Add #stop_on_unknown_option!
81
- * Only strip from stdin.gets if it wasn't ended with EOF
82
- * Allow "send" as a task name
83
- * Allow passing options as arguments after "--"
84
- * Autoload Thor::Group
85
-
86
- ## 0.16.0, release 2012-08-14
87
- * Add enum to string arguments
88
-
89
- ## 0.15.4, release 2012-06-29
90
- * Fix regression when destination root contains reserved regexp characters
91
-
92
- ## 0.15.3, release 2012-06-18
93
- * Support strict_args_position! for backwards compatibility
94
- * Escape Dir glob characters in paths
95
-
96
- ## 0.15.2, released 2012-05-07
97
- * Added print_in_columns
98
- * Exposed terminal_width as a public API
99
-
100
- ## 0.15.1, release 2012-05-06
101
- * Fix Ruby 1.8 truncation bug with unicode chars
102
- * Fix shell delegate methods to pass their block
103
- * Don't output trailing spaces when printing the last column in a table
104
-
105
- ## 0.15, released 2012-04-29
106
- * Alias method_options to options
107
- * Refactor say to allow multiple colors
108
- * Exposed error as a public API
109
- * Exposed file_collision as a public API
110
- * Exposed print_wrapped as a public API
111
- * Exposed set_color as a public API
112
- * Fix number-formatting bugs in print_table
113
- * Fix "indent" typo in print_table
114
- * Fix Errno::EPIPE when piping tasks to `head`
115
- * More friendly error messages
116
-
117
- ## 0.14, released 2010-07-25
118
- * Added CreateLink class and #link_file method
119
- * Made Thor::Actions#run use system as default method for system calls
120
- * Allow use of private methods from superclass as tasks
121
- * Added mute(&block) method which allows to run block without any output
122
- * Removed config[:pretend]
123
- * Enabled underscores for command line switches
124
- * Added Thor::Base.basename which is used by both Thor.banner and Thor::Group.banner
125
- * Deprecated invoke() without arguments
126
- * Added :only and :except to check_unknown_options
127
-
128
- ## 0.13, released 2010-02-03
129
- * Added :lazy_default which is only triggered if a switch is given
130
- * Added Thor::Shell::HTML
131
- * Added subcommands
132
- * Decoupled Thor::Group and Thor, so it's easier to vendor
133
- * Added check_unknown_options! in case you want error messages to be raised in valid switches
134
- * run(command) should return the results of command
135
-
136
- ## 0.12, released 2010-01-02
137
- * Methods generated by attr_* are automatically not marked as tasks
138
- * inject_into_file does not add the same content twice, unless :force is set
139
- * Removed rr in favor to rspec mock framework
140
- * Improved output for thor -T
141
- * [#7] Do not force white color on status
142
- * [#8] Yield a block with the filename on directory
143
-
144
- ## 0.11, released 2009-07-01
145
- * Added a rake compatibility layer. It allows you to use spec and rdoc tasks on
146
- Thor classes.
147
- * BACKWARDS INCOMPATIBLE: aliases are not generated automatically anymore
148
- since it may cause wrong behavior in the invocation system.
149
- * thor help now show information about any class/task. All those calls are
150
- possible:
151
-
152
- thor help describe
153
- thor help describe:amazing
154
- Or even with default namespaces:
155
-
156
- thor help :spec
157
- * Thor::Runner now invokes the default task if none is supplied:
158
-
159
- thor describe # invokes the default task, usually help
160
- * Thor::Runner now works with mappings:
161
-
162
- thor describe -h
163
- * Added some documentation and code refactoring.
164
-
165
- ## 0.9.8, released 2008-10-20
166
- * Fixed some tiny issues that were introduced lately.
167
-
168
- ## 0.9.7, released 2008-10-13
169
- * Setting global method options on the initialize method works as expected:
170
- All other tasks will accept these global options in addition to their own.
171
- * Added 'group' notion to Thor task sets (class Thor); by default all tasks
172
- are in the 'standard' group. Running 'thor -T' will only show the standard
173
- tasks - adding --all will show all tasks. You can also filter on a specific
174
- group using the --group option: thor -T --group advanced
175
-
176
- ## 0.9.6, released 2008-09-13
177
- * Generic improvements
178
-
179
- ## 0.9.5, released 2008-08-27
180
- * Improve Windows compatibility
181
- * Update (incorrect) README and task.thor sample file
182
- * Options hash is now frozen (once returned)
183
- * Allow magic predicates on options object. For instance: `options.force?`
184
- * Add support for :numeric type
185
- * BACKWARDS INCOMPATIBLE: Refactor Thor::Options. You cannot access shorthand forms in options hash anymore (for instance, options[:f])
186
- * Allow specifying optional args with default values: method_options(:user => "mislav")
187
- * Don't write options for nil or false values. This allows, for example, turning color off when running specs.
188
- * Exit with the status of the spec command to help CI stuff out some.
189
-
190
- ## 0.9.4, released 2008-08-13
191
- * Try to add Windows compatibility.
192
- * BACKWARDS INCOMPATIBLE: options hash is now accessed as a property in your class and is not passed as last argument anymore
193
- * Allow options at the beginning of the argument list as well as the end.
194
- * Make options available with symbol keys in addition to string keys.
195
- * Allow true to be passed to Thor#method_options to denote a boolean option.
196
- * If loading a thor file fails, don't give up, just print a warning and keep going.
197
- * Make sure that we re-raise errors if they happened further down the pipe than we care about.
198
- * Only delete the old file on updating when the installation of the new one is a success
199
- * Make it Ruby 1.8.5 compatible.
200
- * Don't raise an error if a boolean switch is defined multiple times.
201
- * Thor::Options now doesn't parse through things that look like options but aren't.
202
- * Add URI detection to install task, and make sure we don't append ".thor" to URIs
203
- * Add rake2thor to the gem binfiles.
204
- * Make sure local Thorfiles override system-wide ones.
@@ -1,12 +0,0 @@
1
- class IO #:nodoc:
2
- class << self
3
- unless method_defined? :binread
4
- def binread(file, *args)
5
- raise ArgumentError, "wrong number of arguments (#{1 + args.size} for 1..3)" unless args.size < 3
6
- File.open(file, "rb") do |f|
7
- f.read(*args)
8
- end
9
- end
10
- end
11
- end
12
- end
@@ -1,129 +0,0 @@
1
- class Thor
2
- module CoreExt
3
- class OrderedHash < ::Hash
4
- if RUBY_VERSION < "1.9"
5
- def initialize(*args, &block)
6
- super
7
- @keys = []
8
- end
9
-
10
- def initialize_copy(other)
11
- super
12
- # make a deep copy of keys
13
- @keys = other.keys
14
- end
15
-
16
- def []=(key, value)
17
- @keys << key unless key?(key)
18
- super
19
- end
20
-
21
- def delete(key)
22
- if key? key
23
- index = @keys.index(key)
24
- @keys.delete_at index
25
- end
26
- super
27
- end
28
-
29
- def delete_if
30
- super
31
- sync_keys!
32
- self
33
- end
34
-
35
- alias_method :reject!, :delete_if
36
-
37
- def reject(&block)
38
- dup.reject!(&block)
39
- end
40
-
41
- def keys
42
- @keys.dup
43
- end
44
-
45
- def values
46
- @keys.map { |key| self[key] }
47
- end
48
-
49
- def to_hash
50
- self
51
- end
52
-
53
- def to_a
54
- @keys.map { |key| [key, self[key]] }
55
- end
56
-
57
- def each_key
58
- return to_enum(:each_key) unless block_given?
59
- @keys.each { |key| yield(key) }
60
- self
61
- end
62
-
63
- def each_value
64
- return to_enum(:each_value) unless block_given?
65
- @keys.each { |key| yield(self[key]) }
66
- self
67
- end
68
-
69
- def each
70
- return to_enum(:each) unless block_given?
71
- @keys.each { |key| yield([key, self[key]]) }
72
- self
73
- end
74
-
75
- def each_pair
76
- return to_enum(:each_pair) unless block_given?
77
- @keys.each { |key| yield(key, self[key]) }
78
- self
79
- end
80
-
81
- alias_method :select, :find_all
82
-
83
- def clear
84
- super
85
- @keys.clear
86
- self
87
- end
88
-
89
- def shift
90
- k = @keys.first
91
- v = delete(k)
92
- [k, v]
93
- end
94
-
95
- def merge!(other_hash)
96
- if block_given?
97
- other_hash.each { |k, v| self[k] = key?(k) ? yield(k, self[k], v) : v }
98
- else
99
- other_hash.each { |k, v| self[k] = v }
100
- end
101
- self
102
- end
103
-
104
- alias_method :update, :merge!
105
-
106
- def merge(other_hash, &block)
107
- dup.merge!(other_hash, &block)
108
- end
109
-
110
- # When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not.
111
- def replace(other)
112
- super
113
- @keys = other.keys
114
- self
115
- end
116
-
117
- def inspect
118
- "#<#{self.class} #{super}>"
119
- end
120
-
121
- private
122
-
123
- def sync_keys!
124
- @keys.delete_if { |k| !key?(k) }
125
- end
126
- end
127
- end
128
- end
129
- end