commander 4.2.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.rubocop.yml +10 -0
- data/.rubocop_todo.yml +212 -0
- data/.travis.yml +0 -2
- data/Gemfile +1 -1
- data/History.rdoc +6 -0
- data/README.md +9 -4
- data/Rakefile +7 -4
- data/bin/commander +12 -12
- data/commander.gemspec +17 -18
- data/lib/commander/blank.rb +2 -2
- data/lib/commander/command.rb +63 -65
- data/lib/commander/configure.rb +1 -2
- data/lib/commander/core_ext.rb +1 -1
- data/lib/commander/core_ext/array.rb +2 -3
- data/lib/commander/core_ext/object.rb +1 -3
- data/lib/commander/delegates.rb +15 -4
- data/lib/commander/help_formatters.rb +2 -1
- data/lib/commander/help_formatters/base.rb +14 -7
- data/lib/commander/help_formatters/terminal.rb +5 -5
- data/lib/commander/help_formatters/terminal_compact.rb +2 -2
- data/lib/commander/methods.rb +0 -1
- data/lib/commander/runner.rb +1 -1
- data/lib/commander/user_interaction.rb +87 -91
- data/lib/commander/version.rb +1 -1
- data/spec/command_spec.rb +57 -58
- data/spec/configure_spec.rb +4 -4
- data/spec/core_ext/array_spec.rb +5 -7
- data/spec/core_ext/object_spec.rb +6 -8
- data/spec/help_formatters/terminal_spec.rb +19 -20
- data/spec/runner_spec.rb +179 -181
- data/spec/spec_helper.rb +12 -12
- data/spec/ui_spec.rb +10 -11
- metadata +23 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a71b1e0b6cd4cc5c9155cd54879132e0e8d76446
|
4
|
+
data.tar.gz: 7cebb2917cfd393a23a1aac0fd4763142709ed01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0de8b294364f785f0ce045d801fc2bf7c6f64ab3cd505cef40169533461377314098044ad8a88f3b297625cb92fc970f7a8f8c06b056ac75266f32fc40c9155b
|
7
|
+
data.tar.gz: 6d90f6f512e2856f9aa3779e6bcf54a8d4118c3f9083b544fbe1a4488248dbc548977ace3684cee16bcd2529a7e8e06053f66b3c2f290029f7cf874da9251652
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,212 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2015-02-07 17:05:05 -0800 using RuboCop version 0.29.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 5
|
9
|
+
Lint/AmbiguousOperator:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 1
|
13
|
+
# Configuration parameters: AllowSafeAssignment.
|
14
|
+
Lint/AssignmentInCondition:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
# Offense count: 2
|
18
|
+
Lint/Eval:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
# Offense count: 2
|
22
|
+
Lint/HandleExceptions:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
# Offense count: 1
|
26
|
+
Lint/RescueException:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# Offense count: 2
|
30
|
+
Lint/ShadowingOuterLocalVariable:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
# Offense count: 1
|
34
|
+
# Cop supports --auto-correct.
|
35
|
+
Lint/UnusedBlockArgument:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
# Offense count: 5
|
39
|
+
Metrics/AbcSize:
|
40
|
+
Max: 29
|
41
|
+
|
42
|
+
# Offense count: 1
|
43
|
+
# Configuration parameters: CountComments.
|
44
|
+
Metrics/ClassLength:
|
45
|
+
Max: 221
|
46
|
+
|
47
|
+
# Offense count: 4
|
48
|
+
Metrics/CyclomaticComplexity:
|
49
|
+
Max: 13
|
50
|
+
|
51
|
+
# Offense count: 2
|
52
|
+
# Configuration parameters: AllowURI, URISchemes.
|
53
|
+
Metrics/LineLength:
|
54
|
+
Max: 242
|
55
|
+
|
56
|
+
# Offense count: 7
|
57
|
+
# Configuration parameters: CountComments.
|
58
|
+
Metrics/MethodLength:
|
59
|
+
Max: 33
|
60
|
+
|
61
|
+
# Offense count: 4
|
62
|
+
Metrics/PerceivedComplexity:
|
63
|
+
Max: 14
|
64
|
+
|
65
|
+
# Offense count: 1
|
66
|
+
Style/AccessorMethodName:
|
67
|
+
Enabled: false
|
68
|
+
|
69
|
+
# Offense count: 5
|
70
|
+
# Cop supports --auto-correct.
|
71
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
72
|
+
Style/AndOr:
|
73
|
+
Enabled: false
|
74
|
+
|
75
|
+
# Offense count: 1
|
76
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
77
|
+
Style/ClassAndModuleChildren:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
# Offense count: 18
|
81
|
+
Style/Documentation:
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
# Offense count: 2
|
85
|
+
Style/EachWithObject:
|
86
|
+
Enabled: false
|
87
|
+
|
88
|
+
# Offense count: 1
|
89
|
+
# Cop supports --auto-correct.
|
90
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
91
|
+
Style/EmptyLinesAroundClassBody:
|
92
|
+
Enabled: false
|
93
|
+
|
94
|
+
# Offense count: 1
|
95
|
+
# Cop supports --auto-correct.
|
96
|
+
Style/EmptyLinesAroundMethodBody:
|
97
|
+
Enabled: false
|
98
|
+
|
99
|
+
# Offense count: 5
|
100
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
101
|
+
Style/FormatString:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
# Offense count: 12
|
105
|
+
# Configuration parameters: AllowedVariables.
|
106
|
+
Style/GlobalVars:
|
107
|
+
Enabled: false
|
108
|
+
|
109
|
+
# Offense count: 2
|
110
|
+
# Configuration parameters: MinBodyLength.
|
111
|
+
Style/GuardClause:
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
# Offense count: 7
|
115
|
+
# Cop supports --auto-correct.
|
116
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
117
|
+
Style/HashSyntax:
|
118
|
+
Enabled: false
|
119
|
+
|
120
|
+
# Offense count: 1
|
121
|
+
# Configuration parameters: MaxLineLength.
|
122
|
+
Style/IfUnlessModifier:
|
123
|
+
Enabled: false
|
124
|
+
|
125
|
+
# Offense count: 2
|
126
|
+
# Cop supports --auto-correct.
|
127
|
+
Style/Lambda:
|
128
|
+
Enabled: false
|
129
|
+
|
130
|
+
# Offense count: 17
|
131
|
+
# Cop supports --auto-correct.
|
132
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
133
|
+
Style/MethodDefParentheses:
|
134
|
+
Enabled: false
|
135
|
+
|
136
|
+
# Offense count: 1
|
137
|
+
Style/MultilineBlockChain:
|
138
|
+
Enabled: false
|
139
|
+
|
140
|
+
# Offense count: 1
|
141
|
+
# Cop supports --auto-correct.
|
142
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
143
|
+
Style/MultilineOperationIndentation:
|
144
|
+
Enabled: false
|
145
|
+
|
146
|
+
# Offense count: 1
|
147
|
+
Style/MultilineTernaryOperator:
|
148
|
+
Enabled: false
|
149
|
+
|
150
|
+
# Offense count: 1
|
151
|
+
# Cop supports --auto-correct.
|
152
|
+
Style/Not:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
# Offense count: 1
|
156
|
+
# Cop supports --auto-correct.
|
157
|
+
# Configuration parameters: PreferredDelimiters.
|
158
|
+
Style/PercentLiteralDelimiters:
|
159
|
+
Enabled: false
|
160
|
+
|
161
|
+
# Offense count: 3
|
162
|
+
# Cop supports --auto-correct.
|
163
|
+
# Configuration parameters: AllowMultipleReturnValues.
|
164
|
+
Style/RedundantReturn:
|
165
|
+
Enabled: false
|
166
|
+
|
167
|
+
# Offense count: 5
|
168
|
+
Style/RescueModifier:
|
169
|
+
Enabled: false
|
170
|
+
|
171
|
+
# Offense count: 3
|
172
|
+
# Cop supports --auto-correct.
|
173
|
+
# Configuration parameters: AllowAsExpressionSeparator.
|
174
|
+
Style/Semicolon:
|
175
|
+
Enabled: false
|
176
|
+
|
177
|
+
# Offense count: 2
|
178
|
+
# Cop supports --auto-correct.
|
179
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
180
|
+
Style/SignalException:
|
181
|
+
Enabled: false
|
182
|
+
|
183
|
+
# Offense count: 1
|
184
|
+
# Cop supports --auto-correct.
|
185
|
+
Style/SpecialGlobalVars:
|
186
|
+
Enabled: false
|
187
|
+
|
188
|
+
# Offense count: 1
|
189
|
+
# Cop supports --auto-correct.
|
190
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
191
|
+
Style/TrailingComma:
|
192
|
+
Enabled: false
|
193
|
+
|
194
|
+
# Offense count: 74
|
195
|
+
# Cop supports --auto-correct.
|
196
|
+
Style/TrailingWhitespace:
|
197
|
+
Enabled: false
|
198
|
+
|
199
|
+
# Offense count: 2
|
200
|
+
# Cop supports --auto-correct.
|
201
|
+
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, Whitelist.
|
202
|
+
Style/TrivialAccessors:
|
203
|
+
Enabled: false
|
204
|
+
|
205
|
+
# Offense count: 1
|
206
|
+
Style/UnlessElse:
|
207
|
+
Enabled: false
|
208
|
+
|
209
|
+
# Offense count: 1
|
210
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
211
|
+
Style/VariableName:
|
212
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/History.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
=== 4.3.0 / 2015-02-07
|
2
|
+
|
3
|
+
* Drops support for Ruby 1.8. Please use 4.2.1 if you still need Ruby 1.8 compatibility.
|
4
|
+
* Fixed a bug with `always_trace` (#91) (@KrauseFx)
|
5
|
+
* Renamed `commands` to `defined_commands` for better compatibility with Pry
|
6
|
+
|
1
7
|
=== 4.2.1 / 2014-09-28
|
2
8
|
|
3
9
|
* Improve `choose` compatibility with HighLine's version (#79)
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[<img src="https://secure.travis-ci.org/ggilder/commander.png?branch=master" alt="Build Status" />](http://travis-ci.org/ggilder/commander)
|
2
|
-
[](http://inch-ci.org/github/tj/commander)
|
3
3
|
|
4
4
|
# Commander
|
5
5
|
|
@@ -75,6 +75,7 @@ end
|
|
75
75
|
```
|
76
76
|
|
77
77
|
Example output:
|
78
|
+
|
78
79
|
```
|
79
80
|
$ foobar bar
|
80
81
|
# => (bar)
|
@@ -84,6 +85,9 @@ $ foobar bar --suffix '}' --prefix '{'
|
|
84
85
|
```
|
85
86
|
|
86
87
|
### Modular style
|
88
|
+
|
89
|
+
**NOTE:** Make sure to use `require 'commander'` rather than `require 'commander/import'`, otherwise Commander methods will still be imported into the global namespace.
|
90
|
+
|
87
91
|
```ruby
|
88
92
|
require 'rubygems'
|
89
93
|
require 'commander'
|
@@ -112,6 +116,7 @@ MyApplication.new.run if $0 == __FILE__
|
|
112
116
|
```
|
113
117
|
|
114
118
|
### Block style
|
119
|
+
|
115
120
|
```ruby
|
116
121
|
require 'rubygems'
|
117
122
|
require 'commander'
|
@@ -234,7 +239,7 @@ end
|
|
234
239
|
## Growl Notifications
|
235
240
|
|
236
241
|
Commander provides methods for displaying Growl notifications. To use these
|
237
|
-
methods you need to install http://github.com/
|
242
|
+
methods you need to install http://github.com/tj/growl which utilizes
|
238
243
|
the [growlnotify](http://growl.info/extras.php#growlnotify) executable. Note that
|
239
244
|
growl is auto-imported by Commander when available, no need to require.
|
240
245
|
|
@@ -425,7 +430,7 @@ global_option '--config FILE'
|
|
425
430
|
|
426
431
|
## ASCII Tables
|
427
432
|
|
428
|
-
For feature rich ASCII tables for your terminal app check out
|
433
|
+
For feature rich ASCII tables for your terminal app check out the terminal-table gem at http://github.com/tj/terminal-table
|
429
434
|
|
430
435
|
+----------+-------+----+--------+-----------------------+
|
431
436
|
| Terminal | Table | Is | Wicked | Awesome |
|
@@ -444,7 +449,7 @@ OR
|
|
444
449
|
## Contrib
|
445
450
|
|
446
451
|
Feel free to fork and request a pull, or submit a ticket
|
447
|
-
http://github.com/
|
452
|
+
http://github.com/tj/commander/issues
|
448
453
|
|
449
454
|
## License
|
450
455
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
3
4
|
|
4
|
-
desc
|
5
|
+
desc 'Run specs'
|
5
6
|
RSpec::Core::RakeTask.new do |t|
|
6
7
|
t.verbose = false
|
7
8
|
t.rspec_opts = '--color --order random'
|
8
9
|
end
|
9
10
|
|
10
|
-
|
11
|
+
RuboCop::RakeTask.new
|
12
|
+
|
13
|
+
task default: [:spec, :rubocop]
|
data/bin/commander
CHANGED
@@ -10,10 +10,10 @@ program :description, 'Commander utility program.'
|
|
10
10
|
command :init do |c|
|
11
11
|
c.syntax = 'commander init <file>'
|
12
12
|
c.summary = 'Initialize a commander template'
|
13
|
-
c.description = 'Initialize an empty <file> with a commander template,
|
13
|
+
c.description = 'Initialize an empty <file> with a commander template,
|
14
14
|
allowing very quick creation of commander executables.'
|
15
15
|
c.example 'Create a new file with a commander template.', 'commander init bin/my_executable'
|
16
|
-
c.action do |args,
|
16
|
+
c.action do |args, _options|
|
17
17
|
file = args.shift || abort('file argument required.')
|
18
18
|
name = ask 'Machine name of program: '
|
19
19
|
description = ask 'Describe your program: '
|
@@ -22,13 +22,13 @@ command :init do |c|
|
|
22
22
|
File.open(file, 'w') do |f|
|
23
23
|
f.write <<-"...".gsub!(/^ {10}/, '')
|
24
24
|
#!/usr/bin/env ruby
|
25
|
-
|
25
|
+
|
26
26
|
require 'rubygems'
|
27
27
|
require 'commander/import'
|
28
|
-
|
28
|
+
|
29
29
|
program :version, '0.0.1'
|
30
30
|
program :description, '#{description}'
|
31
|
-
|
31
|
+
|
32
32
|
...
|
33
33
|
commands.each do |command|
|
34
34
|
f.write <<-"...".gsub!(/^ {12}/, '')
|
@@ -45,11 +45,11 @@ command :init do |c|
|
|
45
45
|
|
46
46
|
...
|
47
47
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
end
|
49
|
+
File.chmod 0755, file
|
50
|
+
say "Initialized template in #{file}"
|
51
|
+
rescue Exception => e
|
52
|
+
abort e
|
53
|
+
end
|
54
54
|
end
|
55
|
-
end
|
55
|
+
end
|
data/commander.gemspec
CHANGED
@@ -1,27 +1,26 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require
|
2
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'commander/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'commander'
|
7
7
|
s.version = Commander::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.license =
|
11
|
-
s.homepage =
|
12
|
-
s.summary =
|
13
|
-
s.description =
|
14
|
-
|
15
|
-
s.rubyforge_project = "commander"
|
8
|
+
s.authors = ['TJ Holowaychuk', 'Gabriel Gilder']
|
9
|
+
s.email = ['gabriel@gabrielgilder.com']
|
10
|
+
s.license = 'MIT'
|
11
|
+
s.homepage = 'https://github.com/tj/commander'
|
12
|
+
s.summary = 'The complete solution for Ruby command-line executables'
|
13
|
+
s.description = 'The complete solution for Ruby command-line executables. Commander bridges the gap between other terminal related libraries you know and love (OptionParser, HighLine), while providing many new features, and an elegant API.'
|
16
14
|
|
17
15
|
s.files = `git ls-files`.split("\n")
|
18
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
-
s.require_paths = [
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
|
+
s.require_paths = ['lib']
|
19
|
+
|
20
|
+
s.add_runtime_dependency('highline', '~> 1.6.11')
|
21
21
|
|
22
|
-
s.
|
23
|
-
|
24
|
-
s.add_development_dependency(
|
25
|
-
s.add_development_dependency(
|
26
|
-
s.add_development_dependency("simplecov")
|
22
|
+
s.add_development_dependency('rspec', '~> 2.14')
|
23
|
+
s.add_development_dependency('rake')
|
24
|
+
s.add_development_dependency('simplecov')
|
25
|
+
s.add_development_dependency('rubocop', '~> 0.29.0')
|
27
26
|
end
|