methadone 1.2.1 → 1.2.2
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/.travis.yml +1 -2
- data/CHANGES.md +12 -0
- data/README.rdoc +2 -0
- data/bin/methadone +2 -2
- data/features/bootstrap.feature +1 -1
- data/features/rspec_support.feature +1 -0
- data/lib/methadone/sh.rb +3 -3
- data/lib/methadone/version.rb +1 -1
- data/methadone.gemspec +3 -3
- data/templates/full/Rakefile.erb +30 -0
- data/test/base_test.rb +1 -0
- data/test/command_for_tests.sh +7 -0
- data/test/test_cli_logging.rb +1 -1
- data/test/test_main.rb +1 -1
- data/test/test_sh.rb +13 -9
- metadata +28 -28
- data/test/command_for_tests.rb +0 -5
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v1.2.3 - Oct 21, 2012
|
4
|
+
|
5
|
+
* Generated Rakefile has better formatted code (See [57])
|
6
|
+
* Error output preface now says "stderr is" instead of "error output", which is less confusing (See [53])
|
7
|
+
|
8
|
+
[57]: http://github.com/davetron5000/methadone/issues/57
|
9
|
+
[53]: http://github.com/davetron5000/methadone/issues/53
|
10
|
+
|
11
|
+
## v1.2.2 - Oct 2, 2012
|
12
|
+
|
13
|
+
* Less scary stdout/stderr prefixing from SH, courtesy @yoni
|
14
|
+
|
3
15
|
## v1.2.1 - Jun 10, 2012, 3:41 PM
|
4
16
|
|
5
17
|
* Slightly loosen what passes for a one-line description of the app, courtesy @jredville
|
data/README.rdoc
CHANGED
@@ -4,6 +4,8 @@ Author:: Dave Copeland (mailto:davetron5000 at g mail dot com)
|
|
4
4
|
Copyright:: Copyright (c) 2011 by Dave Copeland
|
5
5
|
License:: Distributes under the Apache License, see LICENSE.txt in the source distro
|
6
6
|
|
7
|
+
{<img src="https://secure.travis-ci.org/davetron5000/methadone.png" alt="Build Status" />}[http://travis-ci.org/davetron5000/methadone]
|
8
|
+
|
7
9
|
A smattering of tools to make your command-line apps easily awesome; kick the bash habit without sacrificing any of the power.
|
8
10
|
|
9
11
|
The goal of this project is to make it as easy as possible to write awesome and powerful command-line applications.
|
data/bin/methadone
CHANGED
@@ -59,8 +59,8 @@ main do |app_name|
|
|
59
59
|
add_to_file "#{gemname}.gemspec", [
|
60
60
|
" #{gem_variable}.add_development_dependency('rdoc')",
|
61
61
|
" #{gem_variable}.add_development_dependency('aruba')",
|
62
|
-
" #{gem_variable}.add_development_dependency('rake','~> 0.9.2')",
|
63
|
-
" #{gem_variable}.add_dependency('methadone', '
|
62
|
+
" #{gem_variable}.add_development_dependency('rake', '~> 0.9.2')",
|
63
|
+
" #{gem_variable}.add_dependency('methadone', '~> #{Methadone::VERSION}')",
|
64
64
|
], :before => /^end\s*$/
|
65
65
|
end
|
66
66
|
|
data/features/bootstrap.feature
CHANGED
@@ -35,7 +35,7 @@ Feature: Bootstrap a new command-line app
|
|
35
35
|
And the file "tmp/newgem/.gitignore" should match /.DS_Store/
|
36
36
|
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('aruba'/
|
37
37
|
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('rdoc'/
|
38
|
-
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('rake','~> 0.9.2'/
|
38
|
+
And the file "tmp/newgem/newgem.gemspec" should match /add_development_dependency\('rake', '~> 0.9.2'/
|
39
39
|
And the file "tmp/newgem/newgem.gemspec" should match /add_dependency\('methadone'/
|
40
40
|
And the file "tmp/newgem/newgem.gemspec" should use the same block variable throughout
|
41
41
|
Given I cd to "tmp/newgem"
|
@@ -6,6 +6,7 @@ Feature: Bootstrap a new command-line app using RSpec instead of Test::Unit
|
|
6
6
|
Background:
|
7
7
|
Given the directory "tmp/newgem" does not exist
|
8
8
|
|
9
|
+
@announce
|
9
10
|
Scenario: Bootstrap a new app from scratch
|
10
11
|
When I successfully run `methadone --rspec tmp/newgem`
|
11
12
|
Then the following directories should exist:
|
data/lib/methadone/sh.rb
CHANGED
@@ -103,13 +103,13 @@ module Methadone
|
|
103
103
|
stdout,stderr,status = execution_strategy.run_command(command)
|
104
104
|
process_status = Methadone::ProcessStatus.new(status,options[:expected])
|
105
105
|
|
106
|
-
sh_logger.warn("
|
106
|
+
sh_logger.warn("stderr output of '#{command}': #{stderr}") unless stderr.strip.length == 0
|
107
107
|
|
108
108
|
if process_status.success?
|
109
|
-
sh_logger.debug("
|
109
|
+
sh_logger.debug("stdout output of '#{command}': #{stdout}") unless stdout.strip.length == 0
|
110
110
|
call_block(block,stdout,stderr,process_status.exitstatus) unless block.nil?
|
111
111
|
else
|
112
|
-
sh_logger.info("
|
112
|
+
sh_logger.info("stdout output of '#{command}': #{stdout}") unless stdout.strip.length == 0
|
113
113
|
sh_logger.warn("Error running '#{command}'")
|
114
114
|
end
|
115
115
|
|
data/lib/methadone/version.rb
CHANGED
data/methadone.gemspec
CHANGED
@@ -29,13 +29,13 @@ gem install open4
|
|
29
29
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
30
30
|
s.require_paths = ["lib"]
|
31
31
|
s.add_dependency("bundler")
|
32
|
-
s.add_development_dependency("rspec-expectations", "~> 2.6")
|
33
32
|
s.add_development_dependency("rake")
|
34
33
|
s.add_development_dependency("rdoc","~> 3.9")
|
35
|
-
s.add_development_dependency("cucumber"
|
34
|
+
s.add_development_dependency("cucumber")
|
36
35
|
s.add_development_dependency("aruba")
|
37
36
|
s.add_development_dependency("simplecov", "~> 0.5")
|
38
|
-
s.add_development_dependency("clean_test"
|
37
|
+
s.add_development_dependency("clean_test")
|
39
38
|
s.add_development_dependency("mocha")
|
40
39
|
s.add_development_dependency("sdoc")
|
40
|
+
s.add_development_dependency("rspec") # needed so that rspec-bootstrapped app test can run
|
41
41
|
end
|
data/templates/full/Rakefile.erb
CHANGED
@@ -1,7 +1,37 @@
|
|
1
|
+
def dump_load_path
|
2
|
+
puts $LOAD_PATH.join("\n")
|
3
|
+
found = nil
|
4
|
+
$LOAD_PATH.each do |path|
|
5
|
+
if File.exists?(File.join(path,"rspec"))
|
6
|
+
puts "Found rspec in #{path}"
|
7
|
+
if File.exists?(File.join(path,"rspec","core"))
|
8
|
+
puts "Found core"
|
9
|
+
if File.exists?(File.join(path,"rspec","core","rake_task"))
|
10
|
+
puts "Found rake_task"
|
11
|
+
found = path
|
12
|
+
else
|
13
|
+
puts "!! no rake_task"
|
14
|
+
end
|
15
|
+
else
|
16
|
+
puts "!!! no core"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if found.nil?
|
21
|
+
puts "Didn't find rspec/core/rake_task anywhere"
|
22
|
+
else
|
23
|
+
puts "Found in #{path}"
|
24
|
+
end
|
25
|
+
end
|
1
26
|
require 'bundler'
|
2
27
|
require 'rake/clean'
|
3
28
|
<% if rspec %>
|
29
|
+
begin
|
4
30
|
require 'rspec/core/rake_task'
|
31
|
+
rescue LoadError
|
32
|
+
dump_load_path
|
33
|
+
raise
|
34
|
+
end
|
5
35
|
<% else %>
|
6
36
|
require 'rake/testtask'
|
7
37
|
<% end %>
|
data/test/base_test.rb
CHANGED
data/test/test_cli_logging.rb
CHANGED
data/test/test_main.rb
CHANGED
data/test/test_sh.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'base_test'
|
2
|
+
require 'methadone'
|
3
3
|
|
4
4
|
class TestSH < Clean::Test::TestCase
|
5
5
|
include Methadone::SH
|
@@ -19,7 +19,11 @@ class TestSH < Clean::Test::TestCase
|
|
19
19
|
def debug(msg); @debugs << msg; end
|
20
20
|
def info(msg); @infos << msg; end
|
21
21
|
def warn(msg); @warns << msg; end
|
22
|
-
def error(msg)
|
22
|
+
def error(msg)
|
23
|
+
# Try to figure out what's going on on Travis
|
24
|
+
STDERR.puts msg if RUBY_PLATFORM == 'java'
|
25
|
+
@errors << msg
|
26
|
+
end
|
23
27
|
def fatal(msg); @fatals << msg; end
|
24
28
|
|
25
29
|
end
|
@@ -188,8 +192,8 @@ class TestSH < Clean::Test::TestCase
|
|
188
192
|
@block_called.should == true
|
189
193
|
@exitstatus_received.should == 1
|
190
194
|
@logger.debugs[0].should == "Executing '#{test_command}foo'"
|
191
|
-
@logger.debugs[1].should == "
|
192
|
-
@logger.warns[0].should == "
|
195
|
+
@logger.debugs[1].should == "stdout output of '#{test_command}foo': #{test_command_stdout}"
|
196
|
+
@logger.warns[0].should == "stderr output of '#{test_command}foo': #{test_command_stderr}"
|
193
197
|
}
|
194
198
|
end
|
195
199
|
end
|
@@ -360,14 +364,14 @@ private
|
|
360
364
|
def assert_successful_command_execution(exit_code,logger,command,stdout)
|
361
365
|
exit_code.should == 0
|
362
366
|
logger.debugs[0].should == "Executing '#{command}'"
|
363
|
-
logger.debugs[1].should == "
|
367
|
+
logger.debugs[1].should == "stdout output of '#{command}': #{stdout}"
|
364
368
|
logger.warns.length.should == 0
|
365
369
|
end
|
366
370
|
|
367
371
|
def assert_logger_output_for_failure(logger,command,stdout,stderr)
|
368
372
|
logger.debugs[0].should == "Executing '#{command}'"
|
369
|
-
logger.infos[0].should == "
|
370
|
-
logger.warns[0].should == "
|
373
|
+
logger.infos[0].should == "stdout output of '#{command}': #{stdout}"
|
374
|
+
logger.warns[0].should == "stderr output of '#{command}': #{stderr}"
|
371
375
|
logger.warns[1].should == "Error running '#{command}'"
|
372
376
|
end
|
373
377
|
|
@@ -378,7 +382,7 @@ private
|
|
378
382
|
|
379
383
|
# Runs the test command which exits with the length of ARGV/args
|
380
384
|
def test_command(args='')
|
381
|
-
File.join(File.dirname(__FILE__),'command_for_tests.
|
385
|
+
File.join(File.expand_path(File.dirname(__FILE__)),'command_for_tests.sh') + ' ' + args
|
382
386
|
end
|
383
387
|
|
384
388
|
def test_command_stdout; "standard output"; 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: 1.2.
|
4
|
+
version: 1.2.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: 2012-
|
12
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rspec-expectations
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '2.6'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '2.6'
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: rake
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,17 +64,17 @@ dependencies:
|
|
80
64
|
requirement: !ruby/object:Gem::Requirement
|
81
65
|
none: false
|
82
66
|
requirements:
|
83
|
-
- -
|
67
|
+
- - ! '>='
|
84
68
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
69
|
+
version: '0'
|
86
70
|
type: :development
|
87
71
|
prerelease: false
|
88
72
|
version_requirements: !ruby/object:Gem::Requirement
|
89
73
|
none: false
|
90
74
|
requirements:
|
91
|
-
- -
|
75
|
+
- - ! '>='
|
92
76
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
77
|
+
version: '0'
|
94
78
|
- !ruby/object:Gem::Dependency
|
95
79
|
name: aruba
|
96
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,17 +112,17 @@ dependencies:
|
|
128
112
|
requirement: !ruby/object:Gem::Requirement
|
129
113
|
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - ! '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
|
-
version: '0
|
117
|
+
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
121
|
none: false
|
138
122
|
requirements:
|
139
|
-
- -
|
123
|
+
- - ! '>='
|
140
124
|
- !ruby/object:Gem::Version
|
141
|
-
version: '0
|
125
|
+
version: '0'
|
142
126
|
- !ruby/object:Gem::Dependency
|
143
127
|
name: mocha
|
144
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -171,6 +155,22 @@ dependencies:
|
|
171
155
|
- - ! '>='
|
172
156
|
- !ruby/object:Gem::Version
|
173
157
|
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: rspec
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
174
|
description: Methadone provides a lot of small but useful features for developing
|
175
175
|
a command-line app, including an opinionated bootstrapping process, some helpful
|
176
176
|
cucumber steps, and some classes to bridge logging and output into a simple, unified,
|
@@ -289,7 +289,7 @@ files:
|
|
289
289
|
- !binary |-
|
290
290
|
dGVzdC9iYXNlX3Rlc3QucmI=
|
291
291
|
- !binary |-
|
292
|
-
|
292
|
+
dGVzdC9jb21tYW5kX2Zvcl90ZXN0cy5zaA==
|
293
293
|
- !binary |-
|
294
294
|
dGVzdC9leGVjdXRpb25fc3RyYXRlZ3kvdGVzdF9iYXNlLnJi
|
295
295
|
- !binary |-
|
@@ -361,7 +361,7 @@ test_files:
|
|
361
361
|
- !binary |-
|
362
362
|
dGVzdC9iYXNlX3Rlc3QucmI=
|
363
363
|
- !binary |-
|
364
|
-
|
364
|
+
dGVzdC9jb21tYW5kX2Zvcl90ZXN0cy5zaA==
|
365
365
|
- !binary |-
|
366
366
|
dGVzdC9leGVjdXRpb25fc3RyYXRlZ3kvdGVzdF9iYXNlLnJi
|
367
367
|
- !binary |-
|