methadone 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/.travis.yml +3 -1
- data/CHANGES.md +13 -6
- data/bin/methadone +1 -2
- data/features/bootstrap.feature +26 -1
- data/features/step_definitions/version_steps.rb +1 -1
- data/features/version.feature +2 -1
- data/lib/methadone/cucumber.rb +15 -4
- data/lib/methadone/main.rb +8 -0
- data/lib/methadone/version.rb +1 -1
- data/methadone.gemspec +0 -11
- data/test/test_main.rb +1 -1
- metadata +3 -4
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,17 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## v.1.2.3 - Dec 8, 2012
|
4
4
|
|
5
|
-
*
|
6
|
-
*
|
5
|
+
* Can create an app with a dash in its name (See [55])
|
6
|
+
* Help switches, `-h`, and `--help` are documented in help output (See [51])
|
7
|
+
* Improve cucumber step requiring docs and fix bug where said docs had to start with a three-letter words (See [37])
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
[37]: http://github.com/davetron5000/methadone/issues/37
|
10
|
+
[51]: http://github.com/davetron5000/methadone/issues/51
|
11
|
+
[55]: http://github.com/davetron5000/methadone/issues/55
|
10
12
|
|
11
|
-
## v1.2.2 - Oct
|
13
|
+
## v1.2.2 - Oct 21, 2012
|
12
14
|
|
15
|
+
* Generated Rakefile has better formatted code (See [57])
|
16
|
+
* Error output preface now says "stderr is" instead of "error output", which is less confusing (See [53])
|
13
17
|
* Less scary stdout/stderr prefixing from SH, courtesy @yoni
|
14
18
|
|
19
|
+
[57]: http://github.com/davetron5000/methadone/issues/57
|
20
|
+
[53]: http://github.com/davetron5000/methadone/issues/53
|
21
|
+
|
15
22
|
## v1.2.1 - Jun 10, 2012, 3:41 PM
|
16
23
|
|
17
24
|
* Slightly loosen what passes for a one-line description of the app, courtesy @jredville
|
data/bin/methadone
CHANGED
@@ -16,7 +16,7 @@ main do |app_name|
|
|
16
16
|
using_readme = options[:readme]
|
17
17
|
|
18
18
|
gemname = File.basename(app_name)
|
19
|
-
module_name = gemname.split(/_/).map(&:capitalize).join('')
|
19
|
+
module_name = gemname.split(/_/).map(&:capitalize).join('').split(/-/).map(&:capitalize).join("::")
|
20
20
|
|
21
21
|
debug "Creating project for gem #{gemname}"
|
22
22
|
|
@@ -37,7 +37,6 @@ main do |app_name|
|
|
37
37
|
if rspec
|
38
38
|
template_dirs_in(:rspec).each { |dir| mkdir_p dir }
|
39
39
|
copy_file "spec/tc_something_spec.rb", :from => :rspec, :binding => binding
|
40
|
-
|
41
40
|
else
|
42
41
|
template_dirs_in(:test_unit).each { |dir| mkdir_p dir }
|
43
42
|
copy_file "test/tc_something.rb", :from => :test_unit, :binding => binding
|
data/features/bootstrap.feature
CHANGED
@@ -5,6 +5,7 @@ Feature: Bootstrap a new command-line app
|
|
5
5
|
|
6
6
|
Background:
|
7
7
|
Given the directory "tmp/newgem" does not exist
|
8
|
+
And the directory "tmp/new-gem" does not exist
|
8
9
|
|
9
10
|
Scenario: Bootstrap a new app from scratch
|
10
11
|
When I successfully run `methadone tmp/newgem`
|
@@ -45,6 +46,7 @@ Feature: Bootstrap a new command-line app
|
|
45
46
|
And the banner should document that this app takes options
|
46
47
|
And the following options should be documented:
|
47
48
|
|--version|
|
49
|
+
|--help|
|
48
50
|
|--log-level|
|
49
51
|
And the banner should document that this app takes no arguments
|
50
52
|
When I successfully run `rake -T -I../../lib`
|
@@ -70,6 +72,26 @@ Feature: Bootstrap a new command-line app
|
|
70
72
|
6 steps (6 passed)
|
71
73
|
"""
|
72
74
|
|
75
|
+
Scenario: Bootstrap a new app with a dash is OK
|
76
|
+
Given I successfully run `methadone tmp/new-gem`
|
77
|
+
And I cd to "tmp/new-gem"
|
78
|
+
And my app's name is "new-gem"
|
79
|
+
When I successfully run `bin/new-gem --help` with "lib" in the library path
|
80
|
+
Then the banner should be present
|
81
|
+
And the banner should document that this app takes options
|
82
|
+
And the following options should be documented:
|
83
|
+
|--version|
|
84
|
+
|--log-level|
|
85
|
+
And the banner should document that this app takes no arguments
|
86
|
+
When I run `rake -I../../../../lib`
|
87
|
+
Then the exit status should be 0
|
88
|
+
And the output should match /1 tests, 1 assertions, 0 failures, 0 errors/
|
89
|
+
And the output should contain:
|
90
|
+
"""
|
91
|
+
1 scenario (1 passed)
|
92
|
+
6 steps (6 passed)
|
93
|
+
"""
|
94
|
+
|
73
95
|
Scenario: Won't squash an existing dir
|
74
96
|
When I successfully run `methadone tmp/newgem`
|
75
97
|
And I run `methadone tmp/newgem`
|
@@ -93,7 +115,10 @@ Feature: Bootstrap a new command-line app
|
|
93
115
|
When I get help for "methadone"
|
94
116
|
Then the exit status should be 0
|
95
117
|
And the following options should be documented:
|
96
|
-
|
118
|
+
| --force | |
|
119
|
+
| --readme | which is negatable |
|
120
|
+
| -l, --license | which is not negatable |
|
121
|
+
| --log-level | |
|
97
122
|
And the banner should be present
|
98
123
|
And the banner should document that this app takes options
|
99
124
|
And the banner should document that this app's arguments are:
|
@@ -1,4 +1,4 @@
|
|
1
1
|
When /^I successfully run `([^`]*)` with "([^"]*)" in the library path$/ do |command,dir|
|
2
|
-
ENV["RUBYOPT"] = (ENV["RUBYOPT"] || '') + " -I" + File.join(Dir.pwd,ARUBA_DIR,'tmp',
|
2
|
+
ENV["RUBYOPT"] = (ENV["RUBYOPT"] || '') + " -I" + File.join(Dir.pwd,ARUBA_DIR,'tmp',@app_name,dir)
|
3
3
|
step %(I successfully run `#{command}`)
|
4
4
|
end
|
data/features/version.feature
CHANGED
@@ -5,7 +5,8 @@ Feature: The version should show up in the banner by default
|
|
5
5
|
And so users can easily see the version from the app itself
|
6
6
|
|
7
7
|
Scenario Outline: Show the gem version
|
8
|
-
Given
|
8
|
+
Given my app's name is "newgem"
|
9
|
+
And I successfully run `methadone tmp/newgem`
|
9
10
|
When I cd to "tmp/newgem"
|
10
11
|
And I successfully run `bin/newgem <flag>` with "lib" in the library path
|
11
12
|
Then the banner should include the version
|
data/lib/methadone/cucumber.rb
CHANGED
@@ -6,15 +6,21 @@ module Methadone
|
|
6
6
|
#
|
7
7
|
# When I get help for "command_to_run"
|
8
8
|
#
|
9
|
-
# * Make sure that each option shows up in the help and has *some* sort of documentation
|
9
|
+
# * Make sure that each option shows up in the help and has *some* sort of documentation. By default,
|
10
|
+
# the options won't be re2quired to be negatable.
|
10
11
|
#
|
11
12
|
# Then the following options should be documented:
|
12
13
|
# |--force|
|
13
14
|
# |-x |
|
14
15
|
#
|
16
|
+
# Then the following options should be documented:
|
17
|
+
# |--force| which is negatable |
|
18
|
+
# |-x | which is not negatable |
|
19
|
+
#
|
15
20
|
# * Check an individual option for documentation:
|
16
21
|
#
|
17
22
|
# Then the option "--force" should be documented
|
23
|
+
# Then the option "--force" should be documented which is negatable
|
18
24
|
#
|
19
25
|
# * Checks that the help has a proper usage banner
|
20
26
|
#
|
@@ -56,12 +62,17 @@ end
|
|
56
62
|
|
57
63
|
Then /^the following options should be documented:$/ do |options|
|
58
64
|
options.raw.each do |option|
|
59
|
-
step %(the option "#{option[0]}" should be documented)
|
65
|
+
step %(the option "#{option[0]}" should be documented #{option[1]})
|
60
66
|
end
|
61
67
|
end
|
62
68
|
|
63
|
-
Then /^the option "([^"]*)" should be documented$/ do |
|
64
|
-
|
69
|
+
Then /^the option "([^"]*)" should be documented(.*)$/ do |options,qualifiers|
|
70
|
+
options.split(',').map(&:strip).each do |option|
|
71
|
+
if qualifiers.strip == "which is negatable"
|
72
|
+
option = option.gsub(/^--/,"--[no-]")
|
73
|
+
end
|
74
|
+
step %(the output should match /\\s*#{Regexp.escape(option)}[\\s\\W]+\\w[\\s\\w][\\s\\w]+/)
|
75
|
+
end
|
65
76
|
end
|
66
77
|
|
67
78
|
Then /^the banner should be present$/ do
|
data/lib/methadone/main.rb
CHANGED
@@ -404,6 +404,7 @@ module Methadone
|
|
404
404
|
@description = nil
|
405
405
|
@version = nil
|
406
406
|
set_banner
|
407
|
+
document_help
|
407
408
|
end
|
408
409
|
|
409
410
|
def check_args!
|
@@ -497,6 +498,13 @@ module Methadone
|
|
497
498
|
|
498
499
|
private
|
499
500
|
|
501
|
+
def document_help
|
502
|
+
@option_parser.on("-h","--help","Show command line help") do
|
503
|
+
puts @option_parser.to_s
|
504
|
+
exit 0
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
500
508
|
def add_default_value_to_docstring(*args)
|
501
509
|
default_value = nil
|
502
510
|
option_names_from(args).each do |option|
|
data/lib/methadone/version.rb
CHANGED
data/methadone.gemspec
CHANGED
@@ -11,17 +11,6 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.homepage = "http://github.com/davetron5000/methadone"
|
12
12
|
s.summary = %q{Kick the bash habit and start your command-line apps off right}
|
13
13
|
s.description = %q{Methadone provides a lot of small but useful features for developing a command-line app, including an opinionated bootstrapping process, some helpful cucumber steps, and some classes to bridge logging and output into a simple, unified, interface}
|
14
|
-
s.post_install_message = "
|
15
|
-
|
16
|
-
!!!!!!!!!!!!!!!!!!!!!!
|
17
|
-
|
18
|
-
If you are on Ruby 1.8 or REE, you MUST
|
19
|
-
|
20
|
-
gem install open4
|
21
|
-
|
22
|
-
!!!!!!!!!!!!!!!!!!!!!!
|
23
|
-
"
|
24
|
-
|
25
14
|
s.rubyforge_project = "methadone"
|
26
15
|
|
27
16
|
s.files = `git ls-files`.split("\n")
|
data/test/test_main.rb
CHANGED
@@ -359,7 +359,7 @@ class TestMain < BaseTest
|
|
359
359
|
}
|
360
360
|
end
|
361
361
|
|
362
|
-
test_that "without specifying options,
|
362
|
+
test_that "without specifying options, options in brackets doesn't show up in our banner" do
|
363
363
|
Given {
|
364
364
|
main {}
|
365
365
|
}
|
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: 1.2.
|
4
|
+
version: 1.2.3
|
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: 2012-
|
12
|
+
date: 2012-12-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -314,8 +314,7 @@ files:
|
|
314
314
|
dGVzdC90ZXN0X3NoLnJi
|
315
315
|
homepage: http://github.com/davetron5000/methadone
|
316
316
|
licenses: []
|
317
|
-
post_install_message:
|
318
|
-
you MUST\n\ngem install open4\n\n!!!!!!!!!!!!!!!!!!!!!!\n "
|
317
|
+
post_install_message:
|
319
318
|
rdoc_options: []
|
320
319
|
require_paths:
|
321
320
|
- lib
|