dotanuki 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+
6
+ branches:
7
+ only:
8
+ - master
data/lib/dotanuki.rb CHANGED
@@ -92,7 +92,8 @@ module Dotanuki
92
92
  # @note this method isn't thread safe
93
93
  # @todo pass an environment too
94
94
  def guard(options={}, &block)
95
- opts = @defaults.merge(options)
95
+ # if guard is called as a module function @defaults is not set
96
+ opts = (@defaults || {}).merge(options)
96
97
  validate_options(opts)
97
98
  # TODO this is not thread safe
98
99
  @guard = ExecResult.new
@@ -156,12 +157,14 @@ module Dotanuki
156
157
  end
157
158
  end
158
159
 
159
- private
160
-
161
160
  # TODO this is not thread safe
162
161
  def clear_guard
163
162
  result = @guard
164
163
  @guard = nil
165
164
  result
166
165
  end
166
+
167
+ # TODO don't expose validate_options & clear_guard
168
+ module_function :execute, :guard, :validate_options, :clear_guard
169
+
167
170
  end
@@ -1,4 +1,4 @@
1
1
  module Dotanuki
2
2
  # gem version
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dotanuki do
4
+ it "should execute module function" do
5
+ Dotanuki.execute("ls /").failed?.should be_false
6
+ end
7
+
8
+ describe "#guard" do
9
+ it "should not raise exception" do
10
+ lambda { Dotanuki.guard do
11
+ Dotanuki.execute("ls /asd")
12
+ end }.should_not raise_error Dotanuki::ExecError
13
+ end
14
+
15
+ it "should raise exception when told to" do
16
+ lambda { Dotanuki.guard(:on_error => :exception) do
17
+ Dotanuki.execute("ls /asd")
18
+ end }.should raise_error Dotanuki::ExecError
19
+ end
20
+ end
21
+
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotanuki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.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-12-20 00:00:00.000000000Z
12
+ date: 2012-02-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: posix-spawn
16
- requirement: &70140140851760 !ruby/object:Gem::Requirement
16
+ requirement: &70167238543040 !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: :runtime
23
23
  prerelease: false
24
- version_requirements: *70140140851760
24
+ version_requirements: *70167238543040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70140140851120 !ruby/object:Gem::Requirement
27
+ requirement: &70167238542300 !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: *70140140851120
35
+ version_requirements: *70167238542300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: guard-rspec
38
- requirement: &70140140850060 !ruby/object:Gem::Requirement
38
+ requirement: &70167238541620 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70140140850060
46
+ version_requirements: *70167238541620
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: simplecov
49
- requirement: &70140140849240 !ruby/object:Gem::Requirement
49
+ requirement: &70167238540880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70140140849240
57
+ version_requirements: *70167238540880
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &70140140847660 !ruby/object:Gem::Requirement
60
+ requirement: &70167238540160 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70140140847660
68
+ version_requirements: *70167238540160
69
69
  description: A command executioner which doesn't blindly stumble on when a command
70
70
  fails'
71
71
  email:
@@ -77,6 +77,7 @@ files:
77
77
  - .autotest
78
78
  - .gitignore
79
79
  - .rspec
80
+ - .travis.yml
80
81
  - Gemfile
81
82
  - Guardfile
82
83
  - LICENSE
@@ -86,6 +87,7 @@ files:
86
87
  - lib/dotanuki.rb
87
88
  - lib/dotanuki/version.rb
88
89
  - spec/dotanuki_spec.rb
90
+ - spec/module_spec.rb
89
91
  - spec/spec_helper.rb
90
92
  homepage: https://github.com/pmenglund/dotanuki
91
93
  licenses: []
@@ -113,5 +115,6 @@ specification_version: 3
113
115
  summary: Command executioner
114
116
  test_files:
115
117
  - spec/dotanuki_spec.rb
118
+ - spec/module_spec.rb
116
119
  - spec/spec_helper.rb
117
120
  has_rdoc: