methadone 0.3.2 → 0.3.3

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.
@@ -1,26 +1,26 @@
1
1
  Then /^a README should not be generated$/ do
2
- Then %(the file "tmp/newgem/README.rdoc" should not exist)
2
+ step %(the file "tmp/newgem/README.rdoc" should not exist)
3
3
  end
4
4
 
5
5
  Then /^a README should be generated in RDoc$/ do
6
- Then %(a file named "tmp/newgem/README.rdoc" should exist)
6
+ step %(a file named "tmp/newgem/README.rdoc" should exist)
7
7
  end
8
8
 
9
9
  Then /^the README should contain the project name$/ do
10
- Then %(the file "tmp/newgem/README.rdoc" should match /newgem/)
10
+ step %(the file "tmp/newgem/README.rdoc" should match /newgem/)
11
11
  end
12
12
 
13
13
  Then /^the README should contain my name$/ do
14
- Then %(the file "tmp/newgem/README.rdoc" should match /Author:: YOUR NAME \\\(YOUR EMAIL\\\)/)
14
+ step %(the file "tmp/newgem/README.rdoc" should match /Author:: YOUR NAME \\\(YOUR EMAIL\\\)/)
15
15
  end
16
16
 
17
17
  Then /^the README should contain links to Github and RDoc.info$/ do
18
- Then %(the file "tmp/newgem/README.rdoc" should match /\\\* \\\{Source on Github\\\}\\\[LINK TO GITHUB\\\]/)
19
- Then %(the file "tmp/newgem/README.rdoc" should match /RDoc\\\[LINK TO RDOC.INFO\\\]/)
18
+ step %(the file "tmp/newgem/README.rdoc" should match /\\\* \\\{Source on Github\\\}\\\[LINK TO GITHUB\\\]/)
19
+ step %(the file "tmp/newgem/README.rdoc" should match /RDoc\\\[LINK TO RDOC.INFO\\\]/)
20
20
  end
21
21
 
22
22
  Then /^the README should contain empty sections for common elements of a README$/ do
23
- Then %(the file "tmp/newgem/README.rdoc" should match /^== Install/)
24
- Then %(the file "tmp/newgem/README.rdoc" should match /^== Examples/)
25
- Then %(the file "tmp/newgem/README.rdoc" should match /^== Contributing/)
23
+ step %(the file "tmp/newgem/README.rdoc" should match /^== Install/)
24
+ step %(the file "tmp/newgem/README.rdoc" should match /^== Examples/)
25
+ step %(the file "tmp/newgem/README.rdoc" should match /^== Contributing/)
26
26
  end
@@ -1,25 +1,25 @@
1
1
  When /^I get help for "([^"]*)"$/ do |app_name|
2
2
  @app_name = app_name
3
- When %(I run `#{app_name} --help`)
3
+ step %(I run `#{app_name} --help`)
4
4
  end
5
5
 
6
6
  Then /^the following options should be documented:$/ do |options|
7
7
  options.raw.each do |option|
8
- Then %(the option "#{option[0]}" should be documented)
8
+ step %(the option "#{option[0]}" should be documented)
9
9
  end
10
10
  end
11
11
 
12
12
  Then /^the option "([^"]*)" should be documented$/ do |option|
13
- Then %(the output should match /^\\s*#{option}\\s+\\w\\w\\w+/)
13
+ step %(the output should match /^\\s*#{option}\\s+\\w\\w\\w+/)
14
14
  end
15
15
 
16
16
  Then /^the banner should be present$/ do
17
- Then %(the output should match /Usage: #{@app_name}/)
17
+ step %(the output should match /Usage: #{@app_name}/)
18
18
  end
19
19
 
20
20
  Then /^the banner should document that this app takes options$/ do
21
- Then %(the output should match /\[options\]/)
22
- And %(the output should contain "Options")
21
+ step %(the output should match /\[options\]/)
22
+ step %(the output should contain "Options")
23
23
  end
24
24
 
25
25
  Then /^the banner should document that this app's arguments are:$/ do |table|
@@ -27,16 +27,16 @@ Then /^the banner should document that this app's arguments are:$/ do |table|
27
27
  option = row[0]
28
28
  option = "[#{option}]" if row[1] == 'optional' || row[1] == 'which is optional'
29
29
  }.join(' ')
30
- Then %(the output should contain "#{expected_arguments}")
30
+ step %(the output should contain "#{expected_arguments}")
31
31
  end
32
32
 
33
33
  Then /^the banner should document that this app takes no options$/ do
34
- Then %(the output should not contain "[options]")
35
- And %(the output should not contain "Options")
34
+ step %(the output should not contain "[options]")
35
+ step %(the output should not contain "Options")
36
36
  end
37
37
 
38
38
  Then /^the banner should document that this app takes no arguments$/ do
39
- Then %(the output should match /Usage: #{@app_name}\\s*$/)
39
+ step %(the output should match /Usage: #{@app_name}\\s*$/)
40
40
  end
41
41
 
42
42
  Then /^there should be a one line summary of what the app does$/ do
@@ -249,7 +249,10 @@ module Methadone
249
249
  else
250
250
  opt_names = option_names(*args)
251
251
  @option_parser.on(*args) do |value|
252
- opt_names.each { |name| @options[name] = value }
252
+ opt_names.each do |name|
253
+ @options[name] = value
254
+ @options[name.to_s] = value
255
+ end
253
256
  end
254
257
  end
255
258
  set_banner
@@ -316,11 +319,11 @@ module Methadone
316
319
 
317
320
  def option_names(*opts_on_args,&block)
318
321
  opts_on_args.map { |arg|
319
- if arg =~ /^--\[no-\]([^-\s]*)/
322
+ if arg =~ /^--\[no-\]([^-\s][^\s]*)/
320
323
  $1.to_sym
321
- elsif arg =~ /^--([^-\s]*)/
324
+ elsif arg =~ /^--([^-\s][^\s]*)/
322
325
  $1.to_sym
323
- elsif arg =~ /^-([^-\s]*)/
326
+ elsif arg =~ /^-([^-\s][^\s]*)/
324
327
  $1.to_sym
325
328
  else
326
329
  nil
@@ -1,3 +1,3 @@
1
1
  module Methadone
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
data/methadone.gemspec CHANGED
@@ -18,9 +18,11 @@ Gem::Specification.new do |s|
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["lib"]
21
+ s.add_dependency("bundler")
21
22
  s.add_development_dependency("rspec-expectations", "~> 2.6")
22
23
  s.add_development_dependency("rake")
23
24
  s.add_development_dependency("rdoc","~> 3.9")
25
+ s.add_development_dependency("cucumber","~> 1.1.1")
24
26
  s.add_development_dependency("aruba")
25
27
  s.add_development_dependency("simplecov", "~> 0.5")
26
28
  s.add_development_dependency("test_unit-given", ">= 0.1.1")
data/test/test_main.rb CHANGED
@@ -191,33 +191,45 @@ class TestMain < BaseTest
191
191
  @f = nil
192
192
  @other = nil
193
193
  @some_other = nil
194
+ @with_dashes = nil
194
195
  main do
195
- @switch = options[:switch]
196
- @flag = options[:flag]
197
- @f = options[:f]
198
- @negatable = options[:negatable]
199
- @other = options[:other]
200
- @some_other = options[:some_other]
196
+ @switch = [options[:switch],options['switch']]
197
+ @flag = [options[:flag],options['flag']]
198
+ @f = [options[:f],options['f']]
199
+ @negatable = [options[:negatable],options['negatable']]
200
+ @other = [options[:other],options['other']]
201
+ @some_other = [options[:some_other],options['some_other']]
202
+ @with_dashes = [options[:'flag-with-dashes'],options['flag-with-dashes']]
201
203
  end
202
204
 
203
205
  on("--switch")
204
206
  on("--[no-]negatable")
205
207
  on("--flag FLAG","-f","Some documentation string")
208
+ on("--flag-with-dashes FOO")
206
209
  on("--other") do
207
210
  options[:some_other] = true
208
211
  end
209
212
 
210
- set_argv %w(--switch --flag value --negatable --other)
213
+ set_argv %w(--switch --flag value --negatable --other --flag-with-dashes=BAR)
211
214
  }
212
215
 
213
216
  When run_go_safely
214
217
 
215
218
  Then {
216
- @switch.should be true
217
- @some_other.should be true
218
- @other.should_not be true
219
- @flag.should == 'value'
220
- @f.should == 'value'
219
+ @switch[0].should be true
220
+ @some_other[0].should be true
221
+ @other[0].should_not be true
222
+ @flag[0].should == 'value'
223
+ @f[0].should == 'value'
224
+ @with_dashes[0].should == 'BAR'
225
+
226
+ @switch[1].should be true
227
+ @some_other[1].should be nil # ** this is set manually
228
+ @other[1].should_not be true
229
+ @flag[1].should == 'value'
230
+ @f[1].should == 'value'
231
+ @with_dashes[1].should == 'BAR'
232
+
221
233
  opts.to_s.should match /Some documentation string/
222
234
  }
223
235
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: methadone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-02 00:00:00.000000000Z
12
+ date: 2011-11-04 00:00:00.000000000Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: &70155090787300 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70155090787300
14
25
  - !ruby/object:Gem::Dependency
15
26
  name: rspec-expectations
16
- requirement: &70133473968220 !ruby/object:Gem::Requirement
27
+ requirement: &70155090786800 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ~>
@@ -21,10 +32,10 @@ dependencies:
21
32
  version: '2.6'
22
33
  type: :development
23
34
  prerelease: false
24
- version_requirements: *70133473968220
35
+ version_requirements: *70155090786800
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: rake
27
- requirement: &70133473967800 !ruby/object:Gem::Requirement
38
+ requirement: &70155090786380 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *70133473967800
46
+ version_requirements: *70155090786380
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: rdoc
38
- requirement: &70133473967260 !ruby/object:Gem::Requirement
49
+ requirement: &70155090785840 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
@@ -43,10 +54,21 @@ dependencies:
43
54
  version: '3.9'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *70133473967260
57
+ version_requirements: *70155090785840
58
+ - !ruby/object:Gem::Dependency
59
+ name: cucumber
60
+ requirement: &70155090785340 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ~>
64
+ - !ruby/object:Gem::Version
65
+ version: 1.1.1
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70155090785340
47
69
  - !ruby/object:Gem::Dependency
48
70
  name: aruba
49
- requirement: &70133473966840 !ruby/object:Gem::Requirement
71
+ requirement: &70155090784960 !ruby/object:Gem::Requirement
50
72
  none: false
51
73
  requirements:
52
74
  - - ! '>='
@@ -54,10 +76,10 @@ dependencies:
54
76
  version: '0'
55
77
  type: :development
56
78
  prerelease: false
57
- version_requirements: *70133473966840
79
+ version_requirements: *70155090784960
58
80
  - !ruby/object:Gem::Dependency
59
81
  name: simplecov
60
- requirement: &70133473966300 !ruby/object:Gem::Requirement
82
+ requirement: &70155090784420 !ruby/object:Gem::Requirement
61
83
  none: false
62
84
  requirements:
63
85
  - - ~>
@@ -65,10 +87,10 @@ dependencies:
65
87
  version: '0.5'
66
88
  type: :development
67
89
  prerelease: false
68
- version_requirements: *70133473966300
90
+ version_requirements: *70155090784420
69
91
  - !ruby/object:Gem::Dependency
70
92
  name: test_unit-given
71
- requirement: &70133473965780 !ruby/object:Gem::Requirement
93
+ requirement: &70155090783920 !ruby/object:Gem::Requirement
72
94
  none: false
73
95
  requirements:
74
96
  - - ! '>='
@@ -76,7 +98,7 @@ dependencies:
76
98
  version: 0.1.1
77
99
  type: :development
78
100
  prerelease: false
79
- version_requirements: *70133473965780
101
+ version_requirements: *70155090783920
80
102
  description: Methadone provides a lot of small but useful features for developing
81
103
  a command-line app, including an opinionated bootstrapping process, some helpful
82
104
  cucumber steps, and some classes to bridge logging and output into a simple, unified,