slop 3.4.1 → 3.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +7 -0
- data/lib/slop.rb +6 -2
- data/slop.gemspec +1 -1
- data/test/slop_test.rb +6 -6
- metadata +2 -2
data/CHANGES.md
CHANGED
data/lib/slop.rb
CHANGED
@@ -4,7 +4,7 @@ require 'slop/commands'
|
|
4
4
|
class Slop
|
5
5
|
include Enumerable
|
6
6
|
|
7
|
-
VERSION = '3.4.
|
7
|
+
VERSION = '3.4.2'
|
8
8
|
|
9
9
|
# The main Error class, all Exception classes inherit from this class.
|
10
10
|
class Error < StandardError; end
|
@@ -91,6 +91,7 @@ class Slop
|
|
91
91
|
#
|
92
92
|
# Returns a new instance of Slop.
|
93
93
|
def optspec(string, config = {})
|
94
|
+
warn "[DEPRECATED] `Slop.optspec` is deprecated and will be removed in version 4"
|
94
95
|
config[:banner], optspec = string.split(/^--+$/, 2) if string[/^--+$/]
|
95
96
|
lines = optspec.split("\n").reject(&:empty?)
|
96
97
|
opts = Slop.new(config)
|
@@ -117,6 +118,9 @@ class Slop
|
|
117
118
|
# The Array of Slop::Option objects tied to this Slop instance.
|
118
119
|
attr_reader :options
|
119
120
|
|
121
|
+
# The Hash of sub-commands for this Slop instance.
|
122
|
+
attr_reader :commands
|
123
|
+
|
120
124
|
# Create a new instance of Slop and optionally build options via a block.
|
121
125
|
#
|
122
126
|
# config - A Hash of configuration options.
|
@@ -139,7 +143,7 @@ class Slop
|
|
139
143
|
|
140
144
|
if config[:help]
|
141
145
|
on('-h', '--help', 'Display this help message.', :tail => true) do
|
142
|
-
|
146
|
+
puts help
|
143
147
|
end
|
144
148
|
end
|
145
149
|
end
|
data/slop.gemspec
CHANGED
data/test/slop_test.rb
CHANGED
@@ -16,11 +16,11 @@ class SlopTest < TestCase
|
|
16
16
|
ARGV.replace old_argv
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
20
|
-
$
|
21
|
-
yield $
|
19
|
+
def temp_stdout
|
20
|
+
$stdout = StringIO.new
|
21
|
+
yield $stdout.string
|
22
22
|
ensure
|
23
|
-
$
|
23
|
+
$stdout = STDOUT
|
24
24
|
end
|
25
25
|
|
26
26
|
test "includes Enumerable" do
|
@@ -330,13 +330,13 @@ class SlopTest < TestCase
|
|
330
330
|
end
|
331
331
|
|
332
332
|
test "printing help with :help => true" do
|
333
|
-
|
333
|
+
temp_stdout do |string|
|
334
334
|
opts = Slop.new(:help => true, :banner => false)
|
335
335
|
opts.parse %w( --help )
|
336
336
|
assert_equal " -h, --help Display this help message.\n", string
|
337
337
|
end
|
338
338
|
|
339
|
-
|
339
|
+
temp_stdout do |string|
|
340
340
|
opts = Slop.new(:help => true)
|
341
341
|
opts.parse %w( --help )
|
342
342
|
assert_equal "Usage: rake_test_loader [options]\n -h, --help Display this help message.\n", string
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|