methadone 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -2,11 +2,10 @@ notifications:
2
2
  email:
3
3
  on_success: always
4
4
  script: 'bundle exec rake'
5
- rvm:
5
+ rvm:
6
6
  - 1.9.2
7
7
  - 1.9.3
8
8
  - 1.8.7
9
9
  - ree
10
- - ruby-head
11
10
  - rbx
12
11
  - jruby
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', '~>#{Methadone::VERSION}')",
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
 
@@ -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("Error output of '#{command}': #{stderr}") unless stderr.strip.length == 0
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("Output of '#{command}': #{stdout}") unless stdout.strip.length == 0
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("Output of '#{command}': #{stdout}") unless stdout.strip.length == 0
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
 
@@ -1,3 +1,3 @@
1
1
  module Methadone #:nodoc:
2
- VERSION = "1.2.1" #:nodoc:
2
+ VERSION = "1.2.2" #:nodoc:
3
3
  end
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","~> 1.1.1")
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", "~> 0.10")
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
@@ -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
@@ -5,6 +5,7 @@ end
5
5
  require 'test/unit'
6
6
  require 'rspec/expectations'
7
7
  require 'clean_test/test_case'
8
+ require 'ostruct'
8
9
 
9
10
  class BaseTest < Clean::Test::TestCase
10
11
  end
@@ -0,0 +1,7 @@
1
+ #!/bin/sh
2
+
3
+ echo "standard output"
4
+ if [ $# -gt 0 ]; then
5
+ echo "standard error" 1>&2
6
+ fi
7
+ exit $#
@@ -4,7 +4,7 @@ require 'stringio'
4
4
 
5
5
  class TestCLILogging < BaseTest
6
6
  include Methadone
7
-
7
+
8
8
  def setup
9
9
  @blank_format = proc do |severity,datetime,progname,msg|
10
10
  msg + "\n"
data/test/test_main.rb CHANGED
@@ -634,7 +634,7 @@ class TestMain < BaseTest
634
634
  @flag_value = any_string
635
635
  rc_file = File.join(ENV['HOME'],'.my_app.rc')
636
636
  File.open(rc_file,'w') do |file|
637
- file.puts ({
637
+ file.puts({
638
638
  'switch' => true,
639
639
  'flag' => @flag_value,
640
640
  }.to_yaml)
data/test/test_sh.rb CHANGED
@@ -1,5 +1,5 @@
1
- require 'test/unit'
2
- require 'clean_test/test_case'
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); @errors << msg; end
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 == "Output of '#{test_command}foo': #{test_command_stdout}"
192
- @logger.warns[0].should == "Error output of '#{test_command}foo': #{test_command_stderr}"
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 == "Output of '#{command}': #{stdout}"
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 == "Output of '#{command}': #{stdout}"
370
- logger.warns[0].should == "Error output of '#{command}': #{stderr}"
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.rb') + ' ' + args
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.1
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-06-10 00:00:00.000000000 Z
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: 1.1.1
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: 1.1.1
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.10'
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.10'
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
- dGVzdC9jb21tYW5kX2Zvcl90ZXN0cy5yYg==
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
- dGVzdC9jb21tYW5kX2Zvcl90ZXN0cy5yYg==
364
+ dGVzdC9jb21tYW5kX2Zvcl90ZXN0cy5zaA==
365
365
  - !binary |-
366
366
  dGVzdC9leGVjdXRpb25fc3RyYXRlZ3kvdGVzdF9iYXNlLnJi
367
367
  - !binary |-
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- STDOUT.puts "standard output"
4
- STDERR.puts "standard error" if ARGV.length > 0
5
- exit ARGV.length