dotanuki 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -4,3 +4,4 @@
4
4
  Gemfile.lock
5
5
  pkg
6
6
  doc
7
+ coverage
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard 'rspec', :version => 2 do
2
+ watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
3
+ watch(%r{^(spec/.+_spec\.rb)}) { |m| "#{m}" }
4
+
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
@@ -1,14 +1,12 @@
1
- Dotanuki
2
- ========
1
+ h1. Dotanuki "!https://secure.travis-ci.org/pmenglund/dotanuki.png?branch=master!":http://travis-ci.org/pmenglund/dotanuki
3
2
 
4
- Simple but effective executioner of commands, which will deal correctly with
5
- failed commands.
3
+ Simple but effective executioner of commands, which will deal correctly with failed commands.
6
4
 
7
- Examples
8
- ========
9
- In the following example, if the `mkdir` fails, none of the other commands will
10
- be executed.
5
+ h1. Examples
11
6
 
7
+ In the following example, if the <code>mkdir</code> fails, none of the other commands will be executed.
8
+
9
+ <pre>
12
10
  class Example
13
11
  include Dotanuki
14
12
 
@@ -25,11 +23,14 @@ be executed.
25
23
  end
26
24
  end
27
25
  end
26
+ </pre>
28
27
 
29
- It can also be used with a `guard` block, which will raise an `ExecError` if a command fails.
28
+ It can also be used with a <code>guard</code> block, which will raise an <code>ExecError</code> if a command fails.
30
29
 
31
- class Example
30
+ <pre>
31
+ class Example
32
32
  include Dotanuki
33
+
33
34
  def test
34
35
  guard do
35
36
  execute "mkdir /tmp/foo"
@@ -37,4 +38,5 @@ It can also be used with a `guard` block, which will raise an `ExecError` if a c
37
38
  execute "cp /etc/passwd /tmp/foo"
38
39
  end
39
40
  end
40
- end
41
+ end
42
+ </pre>
data/Rakefile CHANGED
@@ -1,12 +1,10 @@
1
1
  require 'bundler'
2
2
  require 'rspec/core/rake_task'
3
- require 'metric_fu'
4
3
 
5
4
  Bundler::GemHelper.install_tasks
6
5
 
7
- RSpec::Core::RakeTask.new(:spec) do |t|
8
- t.rspec_opts = "--color"
9
- end
6
+ task :default => [:spec]
7
+ RSpec::Core::RakeTask.new(:spec)
10
8
 
11
9
  desc "run autotest"
12
10
  task :autotest do
data/dotanuki.gemspec CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |s|
22
22
  s.add_dependency "posix-spawn"
23
23
 
24
24
  s.add_development_dependency "rspec"
25
- s.add_development_dependency "metric_fu"
25
+ s.add_development_dependency "guard-rspec"
26
+ s.add_development_dependency "simplecov"
27
+ s.add_development_dependency "rake"
26
28
 
27
29
  end
@@ -1,4 +1,4 @@
1
1
  module Dotanuki
2
2
  # gem version
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
@@ -21,20 +21,20 @@ describe Dotanuki do
21
21
  it "should stop when one item fails" do
22
22
  guard(:on_error => :silent) do
23
23
  execute("id")
24
- execute("ls /asd")
24
+ execute(COMMAND_FAILED)
25
25
  execute("uname -n")
26
26
  end.failed_index.should == 1
27
27
  end
28
28
 
29
29
  it "should raise an exception by default on error" do
30
30
  lambda { guard do
31
- execute("ls /asd")
31
+ execute(COMMAND_FAILED)
32
32
  end }.should raise_error
33
33
  end
34
34
 
35
- it "should not raise an exception by default on error" do
35
+ it "should not raise an exception on error when silent" do
36
36
  lambda { guard(:on_error => :silent) do
37
- execute("ls /asd")
37
+ execute(COMMAND_FAILED)
38
38
  end }.should_not raise_error
39
39
  end
40
40
  end
@@ -51,14 +51,6 @@ describe Dotanuki do
51
51
  r = execute([EXISTING_COMMAND, COMMAND_NOT_FOUND])
52
52
  r.failed_index.should == 1
53
53
  end
54
-
55
- it "should return nil when not found" do
56
- execute([EXISTING_COMMAND, COMMAND_NOT_FOUND]).status.should be_nil
57
- end
58
-
59
- it "should return nil when not found" do
60
- execute([COMMAND_NOT_FOUND, EXISTING_COMMAND]).status.should be_nil
61
- end
62
54
  end
63
55
 
64
56
  describe "failing command" do
@@ -87,7 +79,7 @@ describe Dotanuki do
87
79
 
88
80
  it "should capture stderr" do
89
81
  r = execute(COMMAND_FAILED)
90
- r.stderr[0].should == "ls: #{NON_EXISTING_PATH}: No such file or directory"
82
+ r.stderr[0].should match /ls: .*#{NON_EXISTING_PATH}: No such file or directory/
91
83
  end
92
84
 
93
85
  end
@@ -112,11 +104,11 @@ describe Dotanuki do
112
104
 
113
105
  describe "with exception option should throw an exception" do
114
106
  it "on missing command" do
115
- lambda { execute(COMMAND_NOT_FOUND, {:on_error => :exception}) }.should raise_error Dotanuki::ExecError, "#{NON_EXISTING_PATH}: command not found"
107
+ lambda { execute(COMMAND_NOT_FOUND, {:on_error => :exception}) }.should raise_error Dotanuki::ExecError
116
108
  end
117
109
 
118
110
  it "exception failing" do
119
- lambda { execute(COMMAND_FAILED, {:on_error => :exception}) }.should raise_error Dotanuki::ExecError, "ls: #{NON_EXISTING_PATH}: No such file or directory"
111
+ lambda { execute(COMMAND_FAILED, {:on_error => :exception}) }.should raise_error Dotanuki::ExecError
120
112
  end
121
113
  end
122
114
 
@@ -129,7 +121,7 @@ describe Dotanuki do
129
121
  end
130
122
 
131
123
  it "should supply correct info on a failing command" do
132
- r = execute("ls /asd")
124
+ r = execute(COMMAND_FAILED)
133
125
  r.failed?.should be_true
134
126
  r.fail_message.should_not be_empty
135
127
  end
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,8 @@
1
+ require 'rspec'
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter "/spec/"
5
+ end
6
+
1
7
  $:.unshift('./lib')
2
8
  require 'dotanuki'
3
- require 'rspec'
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.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-06 00:00:00.000000000 -07:00
13
- default_executable:
12
+ date: 2011-12-20 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: posix-spawn
17
- requirement: &2152082320 !ruby/object:Gem::Requirement
16
+ requirement: &70140140851760 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,10 @@ dependencies:
22
21
  version: '0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2152082320
24
+ version_requirements: *70140140851760
26
25
  - !ruby/object:Gem::Dependency
27
26
  name: rspec
28
- requirement: &2151846680 !ruby/object:Gem::Requirement
27
+ requirement: &70140140851120 !ruby/object:Gem::Requirement
29
28
  none: false
30
29
  requirements:
31
30
  - - ! '>='
@@ -33,10 +32,10 @@ dependencies:
33
32
  version: '0'
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: *2151846680
35
+ version_requirements: *70140140851120
37
36
  - !ruby/object:Gem::Dependency
38
- name: metric_fu
39
- requirement: &2151810360 !ruby/object:Gem::Requirement
37
+ name: guard-rspec
38
+ requirement: &70140140850060 !ruby/object:Gem::Requirement
40
39
  none: false
41
40
  requirements:
42
41
  - - ! '>='
@@ -44,7 +43,29 @@ dependencies:
44
43
  version: '0'
45
44
  type: :development
46
45
  prerelease: false
47
- version_requirements: *2151810360
46
+ version_requirements: *70140140850060
47
+ - !ruby/object:Gem::Dependency
48
+ name: simplecov
49
+ requirement: &70140140849240 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70140140849240
58
+ - !ruby/object:Gem::Dependency
59
+ name: rake
60
+ requirement: &70140140847660 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70140140847660
48
69
  description: A command executioner which doesn't blindly stumble on when a command
49
70
  fails'
50
71
  email:
@@ -57,15 +78,15 @@ files:
57
78
  - .gitignore
58
79
  - .rspec
59
80
  - Gemfile
81
+ - Guardfile
60
82
  - LICENSE
61
- - README.md
83
+ - README.textile
62
84
  - Rakefile
63
85
  - dotanuki.gemspec
64
86
  - lib/dotanuki.rb
65
87
  - lib/dotanuki/version.rb
66
88
  - spec/dotanuki_spec.rb
67
89
  - spec/spec_helper.rb
68
- has_rdoc: true
69
90
  homepage: https://github.com/pmenglund/dotanuki
70
91
  licenses: []
71
92
  post_install_message:
@@ -86,10 +107,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
107
  version: '0'
87
108
  requirements: []
88
109
  rubyforge_project: dotanuki
89
- rubygems_version: 1.6.2
110
+ rubygems_version: 1.8.10
90
111
  signing_key:
91
112
  specification_version: 3
92
113
  summary: Command executioner
93
114
  test_files:
94
115
  - spec/dotanuki_spec.rb
95
116
  - spec/spec_helper.rb
117
+ has_rdoc: