methadone 0.0.2 → 0.1.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.
- data/README.rdoc +13 -1
- data/Rakefile +3 -1
- data/bin/methadone +4 -1
- data/features/bootstrap.feature +13 -5
- data/features/step_definitions/bootstrap_steps.rb +4 -0
- data/lib/methadone/cucumber.rb +19 -1
- data/lib/methadone/version.rb +1 -1
- data/templates/full/bin/executable.erb +5 -1
- data/templates/full/features/executable.feature.erb +4 -5
- data/templates/full/features/support/env.rb.erb +1 -0
- metadata +10 -10
data/README.rdoc
CHANGED
@@ -99,7 +99,8 @@ Here's an example from methadone's own tests:
|
|
99
99
|
And the banner should be present
|
100
100
|
And the banner should document that this app takes options
|
101
101
|
And the banner should document that this app's arguments are:
|
102
|
-
|app_name|required|
|
102
|
+
|app_name|which is required|
|
103
|
+
|dir_name|which is optional|
|
103
104
|
|
104
105
|
=== Steps Provided
|
105
106
|
* Run <tt>command_to_run --help</tt> using aruba
|
@@ -124,10 +125,21 @@ Here's an example from methadone's own tests:
|
|
124
125
|
|
125
126
|
Then the banner should document that this app takes options
|
126
127
|
|
128
|
+
* Do the opposite; check that you don't indicate options are accepted
|
129
|
+
|
130
|
+
Then the banner should document that this app takes no options
|
131
|
+
|
127
132
|
* Checks that the app's usage banner documents that its arguments are <tt>args</tt>
|
128
133
|
|
129
134
|
Then the banner should document that this app's arguments are "args"
|
130
135
|
|
136
|
+
* Do the opposite; check that your app doesn't take any arguments
|
137
|
+
|
138
|
+
Then the banner should document that this app takes no arguments
|
139
|
+
|
140
|
+
* Check for a usage description which occurs after the banner and a blank line
|
141
|
+
|
142
|
+
Then there should be a one-line summary of what the app does
|
131
143
|
|
132
144
|
== What might be
|
133
145
|
|
data/Rakefile
CHANGED
@@ -28,7 +28,9 @@ end
|
|
28
28
|
CUKE_RESULTS = 'results.html'
|
29
29
|
CLEAN << CUKE_RESULTS
|
30
30
|
Cucumber::Rake::Task.new(:features) do |t|
|
31
|
-
|
31
|
+
tag_opts = ''
|
32
|
+
tag_opts = " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
33
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
34
|
t.fork = false
|
33
35
|
end
|
34
36
|
|
data/bin/methadone
CHANGED
@@ -36,6 +36,8 @@ def main(basedir,force)
|
|
36
36
|
add_to_file "#{gemname}.gemspec", [
|
37
37
|
" s.add_development_dependency('rdoc')",
|
38
38
|
" s.add_development_dependency('aruba')",
|
39
|
+
" s.add_development_dependency('rake','~> 0.9.2')",
|
40
|
+
" s.add_dependency('methadone')",
|
39
41
|
], :before => /^end\s*$/
|
40
42
|
|
41
43
|
return 0
|
@@ -115,7 +117,8 @@ end
|
|
115
117
|
options = {}
|
116
118
|
option_parser = OptionParser.new do |opts|
|
117
119
|
executable = File.basename(__FILE__)
|
118
|
-
opts.banner = "Usage: #{executable} [options] app_name"
|
120
|
+
opts.banner = "Usage: #{executable} [options] app_name\n\n" +
|
121
|
+
"Kick the bash habit by bootstrapping your Ruby command-line apps\n\nOptions:"
|
119
122
|
|
120
123
|
opts.on("--force","Overwrite files if they exist") do
|
121
124
|
options[:force] = true
|
data/features/bootstrap.feature
CHANGED
@@ -26,11 +26,17 @@ Feature: Bootstrap a new command-line app
|
|
26
26
|
|tmp/newgem/features/support/env.rb |
|
27
27
|
|tmp/newgem/features/step_definitions/newgem_steps.rb |
|
28
28
|
|tmp/newgem/test/tc_something.rb |
|
29
|
-
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('grancher'/
|
30
29
|
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('aruba'/
|
31
30
|
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('rdoc'/
|
31
|
+
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('rake','~> 0.9.2'/
|
32
|
+
And the file "tmp/newgem/newgem.gemspec" should match /add_dependency\('methadone'/
|
32
33
|
Given I cd to "tmp/newgem"
|
33
|
-
|
34
|
+
And my app's name is "newgem"
|
35
|
+
When I successfully run `bin/newgem --help`
|
36
|
+
Then the banner should be present
|
37
|
+
And the banner should document that this app takes no options
|
38
|
+
And the banner should document that this app takes no arguments
|
39
|
+
When I successfully run `rake -T -I../../lib`
|
34
40
|
Then the output should contain:
|
35
41
|
"""
|
36
42
|
rake build # Build newgem-0.0.1.gem into the pkg directory
|
@@ -44,7 +50,7 @@ Feature: Bootstrap a new command-line app
|
|
44
50
|
rake rerdoc # Rebuild RDoc HTML files
|
45
51
|
rake test # Run tests
|
46
52
|
"""
|
47
|
-
When I run `rake`
|
53
|
+
When I run `rake -I../../../../lib`
|
48
54
|
Then the exit status should be 0
|
49
55
|
And the output should contain:
|
50
56
|
"""
|
@@ -53,7 +59,7 @@ Feature: Bootstrap a new command-line app
|
|
53
59
|
And the output should contain:
|
54
60
|
"""
|
55
61
|
1 scenario (1 passed)
|
56
|
-
|
62
|
+
5 steps (5 passed)
|
57
63
|
"""
|
58
64
|
|
59
65
|
Scenario: Won't squash an existing dir
|
@@ -78,6 +84,7 @@ Feature: Bootstrap a new command-line app
|
|
78
84
|
error: app_dir required
|
79
85
|
"""
|
80
86
|
|
87
|
+
@debug
|
81
88
|
Scenario: Help is properly documented
|
82
89
|
When I get help for "methadone"
|
83
90
|
Then the exit status should be 0
|
@@ -86,4 +93,5 @@ Feature: Bootstrap a new command-line app
|
|
86
93
|
And the banner should be present
|
87
94
|
And the banner should document that this app takes options
|
88
95
|
And the banner should document that this app's arguments are:
|
89
|
-
|app_name|required|
|
96
|
+
|app_name|which is required|
|
97
|
+
And there should be a one line summary of what the app does
|
data/lib/methadone/cucumber.rb
CHANGED
@@ -19,12 +19,30 @@ end
|
|
19
19
|
|
20
20
|
Then /^the banner should document that this app takes options$/ do
|
21
21
|
Then %(the output should match /\[options\]/)
|
22
|
+
And %(the output should contain "Options")
|
22
23
|
end
|
23
24
|
|
24
25
|
Then /^the banner should document that this app's arguments are:$/ do |table|
|
25
26
|
expected_arguments = table.raw.map { |row|
|
26
27
|
option = row[0]
|
27
|
-
option = "[#{option}]" if row[1] == 'optional'
|
28
|
+
option = "[#{option}]" if row[1] == 'optional' || row[1] == 'which is optional'
|
28
29
|
}.join(' ')
|
29
30
|
Then %(the output should contain "#{expected_arguments}")
|
30
31
|
end
|
32
|
+
|
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")
|
36
|
+
end
|
37
|
+
|
38
|
+
Then /^the banner should document that this app takes no arguments$/ do
|
39
|
+
Then %(the output should match /Usage: #{@app_name}\\s*$/)
|
40
|
+
end
|
41
|
+
|
42
|
+
Then /^there should be a one line summary of what the app does$/ do
|
43
|
+
output_lines = all_output.split(/\n/)
|
44
|
+
output_lines.should have_at_least(3).items
|
45
|
+
# [0] is our banner, which we've checked for
|
46
|
+
output_lines[1].should match(/^\s*$/)
|
47
|
+
output_lines[2].should match(/^\w\w+\s+\w\w+/)
|
48
|
+
end
|
data/lib/methadone/version.rb
CHANGED
@@ -4,7 +4,11 @@ require 'optparse'
|
|
4
4
|
|
5
5
|
option_parser = OptionParser.new do |opts|
|
6
6
|
executable_name = File.basename(__FILE__)
|
7
|
-
opts.banner = "Usage: #{executable_name}
|
7
|
+
opts.banner = "Usage: #{executable_name}"
|
8
|
+
# When/if you add options:
|
9
|
+
# opts.banner = "Usage: #{executable_name} [options]\n\n" +
|
10
|
+
# "One-line description of your app\n\n" +
|
11
|
+
# "Options:"
|
8
12
|
end
|
9
13
|
|
10
14
|
option_parser.parse!
|
@@ -4,9 +4,8 @@ Feature: My bootstrapped app kinda works
|
|
4
4
|
So I don't have to do it myself
|
5
5
|
|
6
6
|
Scenario: App just runs
|
7
|
-
When I
|
7
|
+
When I get help for "<%= gemname %>"
|
8
8
|
Then the exit status should be 0
|
9
|
-
And the
|
10
|
-
|
11
|
-
|
12
|
-
"""
|
9
|
+
And the banner should be present
|
10
|
+
And the banner should document that this app takes no options
|
11
|
+
And the banner should document that this app takes no arguments
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-09-
|
12
|
+
date: 2011-09-25 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec-expectations
|
16
|
-
requirement: &
|
16
|
+
requirement: &70245763026000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70245763026000
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70245763024980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70245763024980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rdoc
|
38
|
-
requirement: &
|
38
|
+
requirement: &70245763024340 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 3.6.1
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70245763024340
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: aruba
|
49
|
-
requirement: &
|
49
|
+
requirement: &70245763023660 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70245763023660
|
58
58
|
description: Methadone provides a lot of small but useful features for developing
|
59
59
|
a command-line app, including an opinionated bootstrapping process, some helpful
|
60
60
|
cucumber steps, and some classes to bridge logging and output into a simple, unified,
|