slop 3.4.3 → 3.4.4

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 07ec5394f499e02a0abeb5341ed660ef3822dfa3
4
+ data.tar.gz: 4cc1f6f9d754ae2b45c813c96c544669756650bd
5
+ SHA512:
6
+ metadata.gz: 2e11fa1d72ee94114ca1153ba79b0b114bf6720a60cb90d923f976e934c9988b8ea7bab24960b86115c65e31a5dbe6a715564f57efd97b13dd690210370d52ed
7
+ data.tar.gz: f9ee6be396f7ae956ece36166d2c272b464dad70c1525d1a61eb0955181bee64973307694679ba634ec1baf97529b0509ed00d95cb1bdc1a29204d6867174f13
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ 3.4.4 (2013-03-12)
2
+ ------------------
3
+
4
+ * Disable the run callback when the help option is used and `-h`
5
+ or `--help` is passed. #106
6
+ * Ensure default `--help` option exits by default (#107, Autumn Perrault).
7
+
1
8
  3.4.3 (2013-01-14)
2
9
  ------------------
3
10
 
@@ -4,7 +4,7 @@ require 'slop/commands'
4
4
  class Slop
5
5
  include Enumerable
6
6
 
7
- VERSION = '3.4.3'
7
+ VERSION = '3.4.4'
8
8
 
9
9
  # The main Error class, all Exception classes inherit from this class.
10
10
  class Error < StandardError; end
@@ -144,6 +144,7 @@ class Slop
144
144
  if config[:help]
145
145
  on('-h', '--help', 'Display this help message.', :tail => true) do
146
146
  puts help
147
+ exit
147
148
  end
148
149
  end
149
150
  end
@@ -251,7 +252,9 @@ class Slop
251
252
  @callbacks[:no_options].each { |cb| cb.call(self) }
252
253
  end
253
254
 
254
- @runner.call(self, items) if @runner.respond_to?(:call)
255
+ if @runner.respond_to?(:call)
256
+ @runner.call(self, items) unless config[:help] and present?(:help)
257
+ end
255
258
 
256
259
  items
257
260
  end
@@ -1,13 +1,14 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'slop'
3
- s.version = '3.4.3'
4
- s.summary = 'Option gathering made easy'
3
+ s.version = '3.4.4'
4
+ s.summary = 'Simple Lightweight Option Parsing'
5
5
  s.description = 'A simple DSL for gathering options and parsing the command line'
6
6
  s.author = 'Lee Jarvis'
7
7
  s.email = 'lee@jarvis.co'
8
8
  s.homepage = 'http://github.com/injekt/slop'
9
9
  s.files = `git ls-files`.split("\n")
10
10
  s.test_files = `git ls-files -- test/*`.split("\n")
11
+ s.license = 'MIT'
11
12
 
12
13
  s.required_ruby_version = '>= 1.8.7'
13
14
 
@@ -130,6 +130,13 @@ class SlopTest < TestCase
130
130
  assert_equal 'Display this help message.', slop.options.first.description
131
131
  end
132
132
 
133
+ test "default help exits" do
134
+ slop = Slop.new :help => true
135
+ assert_raises SystemExit do
136
+ slop.parse %w/--help/
137
+ end
138
+ end
139
+
133
140
  test ":arguments and :optional_arguments config options" do
134
141
  slop = Slop.new(:arguments => true) { on :foo }
135
142
  assert slop.fetch_option(:foo).expects_argument?
@@ -448,6 +455,21 @@ class SlopTest < TestCase
448
455
  end
449
456
  end
450
457
 
458
+ test "ensure a runner does not execute when a help option is present" do
459
+ items = []
460
+ Slop.parse(%w'--help foo bar') do
461
+ run { |o, a| items.concat a }
462
+ end
463
+ assert_equal %w'--help foo bar', items
464
+ items.clear
465
+ temp_stdout do
466
+ Slop.parse(%w'--help foo bar', :help => true) do
467
+ run { |o, a| items.concat a }
468
+ end
469
+ assert_empty items
470
+ end
471
+ end
472
+
451
473
  test "duplicate options should not exist, new options should replace old ones" do
452
474
  i = nil
453
475
  Slop.parse(%w'-v') do
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slop
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.3
5
- prerelease:
4
+ version: 3.4.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Lee Jarvis
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-14 00:00:00.000000000 Z
11
+ date: 2013-03-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: minitest
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: A simple DSL for gathering options and parsing the command line
@@ -65,32 +60,31 @@ files:
65
60
  - test/option_test.rb
66
61
  - test/slop_test.rb
67
62
  homepage: http://github.com/injekt/slop
68
- licenses: []
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
69
66
  post_install_message:
70
67
  rdoc_options: []
71
68
  require_paths:
72
69
  - lib
73
70
  required_ruby_version: !ruby/object:Gem::Requirement
74
- none: false
75
71
  requirements:
76
- - - ! '>='
72
+ - - '>='
77
73
  - !ruby/object:Gem::Version
78
74
  version: 1.8.7
79
75
  required_rubygems_version: !ruby/object:Gem::Requirement
80
- none: false
81
76
  requirements:
82
- - - ! '>='
77
+ - - '>='
83
78
  - !ruby/object:Gem::Version
84
79
  version: '0'
85
80
  requirements: []
86
81
  rubyforge_project:
87
- rubygems_version: 1.8.23
82
+ rubygems_version: 2.0.0
88
83
  signing_key:
89
- specification_version: 3
90
- summary: Option gathering made easy
84
+ specification_version: 4
85
+ summary: Simple Lightweight Option Parsing
91
86
  test_files:
92
87
  - test/commands_test.rb
93
88
  - test/helper.rb
94
89
  - test/option_test.rb
95
90
  - test/slop_test.rb
96
- has_rdoc: