exec 0.0.1 → 0.0.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/Rakefile CHANGED
@@ -1,19 +1,23 @@
1
1
  $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
2
  require 'exec/version'
3
3
  require 'exec'
4
-
4
+
5
+ desc 'build .gem file'
5
6
  task :build do
6
7
  Exec.system_v "gem build exec.gemspec"
7
8
  end
8
9
 
10
+ desc 'push .gem file'
9
11
  task :release => :build do
10
12
  Exec.system_v "gem push exec-#{Exec::VERSION}.gem"
11
13
  end
12
14
 
15
+ desc 'build and install .gem file'
13
16
  task :install => :build do
14
17
  Exec.system_v "gem install exec-#{Exec::VERSION}.gem"
15
18
  end
16
19
 
20
+ desc 'tag current commit as Exec::VERSION and push tag'
17
21
  task :tag do
18
22
  v = Exec::VERSION.gsub(/\./, '_')
19
23
  Exec.system_v "git tag REL_#{v}"
@@ -1,9 +1,9 @@
1
1
  module Exec
2
- class NonZeroExitCodeException < Exception
2
+ class NonZeroExitCodeException < StandardError
3
3
  def initialize
4
4
  end
5
5
  end
6
- class CommandNotFoundException < Exception
6
+ class CommandNotFoundException < StandardError
7
7
  def initialize
8
8
  end
9
9
  end
@@ -19,11 +19,7 @@ module Exec
19
19
  end
20
20
  def system_v(*args)
21
21
  $stderr.puts(*args)
22
- case _system(*args)
23
- when true ; true
24
- when nil ; raise CommandNotFoundException
25
- else $?.exitstatus
26
- end
22
+ system(*args)
27
23
  end
28
24
  def system!(*args)
29
25
  case _system(*args)
@@ -34,11 +30,7 @@ module Exec
34
30
  end
35
31
  def system_v!(*args)
36
32
  $stderr.puts(*args)
37
- case _system(*args)
38
- when true ; true
39
- when nil ; raise CommandNotFoundException
40
- else ; raise NonZeroExitCodeException
41
- end
33
+ system!(*args)
42
34
  end
43
35
  end
44
36
  end
@@ -1,4 +1,4 @@
1
1
  module Exec
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
4
4
 
@@ -60,6 +60,9 @@ describe Exec do
60
60
  context "with unknown command" do
61
61
  specify { expect { Exec.system!("asdfasdf") }.should raise_error ::Exec::CommandNotFoundException }
62
62
  end
63
+ context "with rescue expression should catch the error" do
64
+ specify { expect { Exec.system!("asdfasdf") rescue nil }.should_not raise_error }
65
+ end
63
66
  end
64
67
  end
65
68
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.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: 2011-12-19 00:00:00.000000000Z
12
+ date: 2011-12-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Exec#system Exec#system_v Exec#system! Exec#system_v!
15
15
  email: executils@mog.se