patir 0.6.0 → 0.6.1
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/History.txt +3 -0
- data/lib/patir/base.rb +1 -1
- data/lib/patir/command.rb +10 -7
- data/test/test_patir_command.rb +16 -0
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
==0.6.1
|
2
|
+
* RubyCommand failure logs are now clearer no more 'RubyCommand failed:' redundancies.
|
3
|
+
* RubyCommand: Backtrace added to error output if $DEBUG=true
|
1
4
|
==0.6.0
|
2
5
|
* RubyCommand now sets success when the block runs to the end. Block returns values re ignored. To indicate failure raise an exception.
|
3
6
|
|
data/lib/patir/base.rb
CHANGED
data/lib/patir/command.rb
CHANGED
@@ -449,17 +449,20 @@ module Patir
|
|
449
449
|
#
|
450
450
|
#The block receives the instance of RubyCommand so you can set the output and error output.
|
451
451
|
#
|
452
|
-
#
|
452
|
+
#If the block runs to the end the command is considered successful.
|
453
|
+
#
|
454
|
+
#Raising an exception in the block will set the command status to :error.
|
455
|
+
#
|
456
|
+
#The exception message will be appended to the error output of the command
|
453
457
|
#
|
454
458
|
#== Examples
|
455
459
|
#An example (using the excellent HighLine lib) of a CLI prompt as a RubyCommand
|
456
460
|
# RubyCommand.new("prompt") do |cmd|
|
457
461
|
# cmd.output=""
|
458
462
|
# cmd.error=""
|
459
|
-
#
|
460
|
-
#
|
461
|
-
#
|
462
|
-
# :error
|
463
|
+
# unless HighLine.agree("#{step.text}?")
|
464
|
+
# cmd.error="Why not?"
|
465
|
+
# raise "You did not agree"
|
463
466
|
# end
|
464
467
|
# end
|
465
468
|
class RubyCommand
|
@@ -484,8 +487,8 @@ module Patir
|
|
484
487
|
@status=:success
|
485
488
|
end
|
486
489
|
rescue
|
487
|
-
error<<"
|
488
|
-
error<<"#{
|
490
|
+
error<<"\n#{$!.message}"
|
491
|
+
error<<"\n#{$!.backtrace}" if $DEBUG
|
489
492
|
@status=:error
|
490
493
|
ensure
|
491
494
|
@exec_time=Time.now-t1
|
data/test/test_patir_command.rb
CHANGED
@@ -198,6 +198,22 @@ class TestCommandSequence<Test::Unit::TestCase
|
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
201
|
+
class TestRubyCommad<Test::Unit::TestCase
|
202
|
+
include Patir
|
203
|
+
def test_normal_ruby
|
204
|
+
cmd=RubyCommand.new("test"){sleep 1}
|
205
|
+
assert_nothing_raised() { cmd.run}
|
206
|
+
assert(cmd.success?, "Not successful.")
|
207
|
+
assert_equal(:success, cmd.status)
|
208
|
+
end
|
209
|
+
def test_error_ruby
|
210
|
+
cmd=RubyCommand.new("test"){raise "Error"}
|
211
|
+
assert_nothing_raised() { cmd.run}
|
212
|
+
assert(!cmd.success?, "Successful?!")
|
213
|
+
assert_equal(:error, cmd.status)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
201
217
|
class TestCommandSequenceStatus<Test::Unit::TestCase
|
202
218
|
def test_new
|
203
219
|
st=Patir::CommandSequenceStatus.new("sequence")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patir
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vassilis Rizopoulos
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-01 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements: []
|
99
99
|
|
100
100
|
rubyforge_project: patir
|
101
|
-
rubygems_version: 1.
|
101
|
+
rubygems_version: 1.3.0
|
102
102
|
signing_key:
|
103
103
|
specification_version: 2
|
104
104
|
summary: patir (Project Automation Tools in Ruby) provides libraries for use in automation tools
|