angry_shell 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ pkg/*
2
2
  *.gem
3
3
  .bundle
4
4
  .*.sw?
5
+ Gemfile.lock
@@ -1,10 +1,10 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # $:.push File.expand_path("../lib", __FILE__)
3
- # require "angry_shell/version"
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "angry_shell/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "angry_shell"
7
- s.version = '0.0.1' #AngryShell::VERSION
7
+ s.version = AngryShell::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
9
  s.authors = ["Lachie Cox"]
10
10
  s.email = ["lachie.cox@plus2.com.au"]
@@ -18,6 +18,9 @@ eg 'popen4 - normal, stream io' do
18
18
  Assert(out == "Hello\n")
19
19
  end
20
20
 
21
+
22
+
23
+
21
24
  eg 'popen4 - error' do
22
25
  begin
23
26
  AngryShell::Shell.new.popen4(:cmd => 'casplortleecho Hello') do |cid,ipc|
@@ -30,6 +33,12 @@ eg 'popen4 - error' do
30
33
  Assert(raised)
31
34
  end
32
35
 
36
+
37
+ eg 'cmd is a proc' do
38
+ Assert( AngryShell::Shell.new(lambda { puts "hello world" }).to_s == "hello world" )
39
+ end
40
+
41
+
33
42
  eg 'run' do
34
43
  AngryShell::Shell.new("echo Whats happening").run
35
44
  Assert( :didnt_raise )
@@ -40,7 +40,12 @@ module AngryShell
40
40
  @block = block
41
41
  @options = if Hash === args.last then args.pop else {} end
42
42
 
43
- unless args.empty?
43
+ case args.size
44
+ when 0
45
+ # no op
46
+ when 1
47
+ @options[:cmd] = args.first
48
+ else
44
49
  @options[:cmd] = args
45
50
  end
46
51
 
@@ -321,13 +326,19 @@ module AngryShell
321
326
 
322
327
  begin
323
328
  cmd = args[:cmd]
324
- if cmd.kind_of?(Array)
329
+
330
+ case cmd
331
+ when Proc
332
+ exit cmd.call.to_i
333
+ when Array
325
334
  exec(*cmd)
326
335
  else
327
336
  exec(cmd)
328
337
  end
329
338
 
330
339
  raise 'forty-two'
340
+ rescue SystemExit
341
+ exit $!.status
331
342
  rescue Object => e
332
343
  Marshal.dump(e, ipc.exception)
333
344
  ipc.exception.flush
@@ -1,3 +1,3 @@
1
1
  module AngryShell
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angry_shell
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: 27
5
+ prerelease:
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 1
9
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
10
11
  platform: ruby
11
12
  authors:
12
13
  - Lachie Cox
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-10-24 00:00:00 +11:00
18
+ date: 2011-02-18 00:00:00 +11:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
@@ -30,7 +31,6 @@ extra_rdoc_files: []
30
31
  files:
31
32
  - .gitignore
32
33
  - Gemfile
33
- - Gemfile.lock
34
34
  - Rakefile
35
35
  - Readme.md
36
36
  - angry_shell.gemspec
@@ -48,23 +48,27 @@ rdoc_options: []
48
48
  require_paths:
49
49
  - lib
50
50
  required_ruby_version: !ruby/object:Gem::Requirement
51
+ none: false
51
52
  requirements:
52
53
  - - ">="
53
54
  - !ruby/object:Gem::Version
55
+ hash: 3
54
56
  segments:
55
57
  - 0
56
58
  version: "0"
57
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
58
61
  requirements:
59
62
  - - ">="
60
63
  - !ruby/object:Gem::Version
64
+ hash: 3
61
65
  segments:
62
66
  - 0
63
67
  version: "0"
64
68
  requirements: []
65
69
 
66
70
  rubyforge_project: angry_shell
67
- rubygems_version: 1.3.6
71
+ rubygems_version: 1.4.2
68
72
  signing_key:
69
73
  specification_version: 3
70
74
  summary: Shell
@@ -1,16 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- angry_shell (0.0.1)
5
-
6
- GEM
7
- remote: http://rubygems.org/
8
- specs:
9
- exemplor (3000.3.0)
10
-
11
- PLATFORMS
12
- ruby
13
-
14
- DEPENDENCIES
15
- angry_shell!
16
- exemplor