dia 1.1.pre → 1.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.
Files changed (3) hide show
  1. data/NEWS.md +6 -1
  2. data/lib/dia/sandbox.rb +10 -7
  3. metadata +35 -19
data/NEWS.md CHANGED
@@ -1,7 +1,11 @@
1
1
  ## NEWS
2
2
 
3
- ### 1.1.pre
3
+ ### 1.1 (final)
4
+ * Dia::SandBox#run\_with\_block will exit the child process spawned by itself incase the user forgets to ..
4
5
 
6
+ * Added some tests for Dia::SandBox.new#run\_with\_block ..
7
+ We ain't got full coverage but we're getting there.
8
+
5
9
  * A person reported that ffi 0.6.0 does not work with dia ..
6
10
  Supplied an explicit dependency on ffi 0.5.4 until I figure it out.
7
11
 
@@ -10,3 +14,4 @@
10
14
  If you're running a block of ruby, you can forget about the second.
11
15
 
12
16
  * I documented my methods!
17
+
data/lib/dia/sandbox.rb CHANGED
@@ -20,16 +20,17 @@ module Dia
20
20
  #
21
21
  # @raise [ArgumentError] Will raise an ArgumentError if an application has not been supplied to
22
22
  # the constructer.
23
- # @raise [Dia::SandBoxException] Will raise Dia::SandBoxException if the sandbox could not be initiated.
23
+ # @raise [Dia::SandBoxException] Will raise Dia::SandBoxException in a child process and exit if the sandbox could not be initiated.
24
24
  # @return [Fixnum] The Process ID(PID) that the sandboxed application is being run under.
25
25
  def run
26
26
  raise ArgumentError, "No application path supplied" if @app_path.nil?
27
27
 
28
28
  @pid = fork do
29
- unless ( ret = sandbox_init(@profile, 0x0001, error = FFI::MemoryPointer.new(:pointer)) ) == 0
29
+ if ( ret = sandbox_init(@profile, 0x0001, error = FFI::MemoryPointer.new(:pointer)) ) != 0
30
30
  raise Dia::SandBoxException, "Couldn't sandbox #{@app_path}, sandbox_init returned #{ret} with error message: '#{error.get_pointer(0).read_string}'"
31
+ else
32
+ exec(@app_path)
31
33
  end
32
- exec(@app_path)
33
34
  end
34
35
  end
35
36
 
@@ -40,17 +41,19 @@ module Dia
40
41
  # the sandbox .. In any case, the parent process will not be affected and if you want to catch an exception you
41
42
  # should do so in your block.
42
43
  #
43
- # @raise [Dia::SandBoxException] Will raise Dia::SandBoxException if the sandbox could not be initiated.
44
+ # @raise [Dia::SandBoxException] Will raise Dia::SandBoxException in a child process and exit if the sandbox could not be initiated.
44
45
  # @return [Fixnum] The Process ID(PID) that the sandboxed block of code is being run under.
45
46
  def run_with_block &blk
46
47
  @pid = fork do
47
- unless ( ret = sandbox_init(@profile, 0x0001, error = FFI::MemoryPointer.new(:pointer)) ) == 0
48
+ if ( ret = sandbox_init(@profile, 0x0001, error = FFI::MemoryPointer.new(:pointer)) ) != 0
48
49
  raise Dia::SandBoxException, "Couldn't sandbox #{@app_path}, sandbox_init returned #{ret} with error message: '#{error.get_pointer(0).read_string}'"
50
+ else
51
+ yield
49
52
  end
50
- yield
53
+ exit
51
54
  end
52
55
  end
53
56
 
54
57
  end
55
58
 
56
- end
59
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dia
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.pre
4
+ version: "1.1"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Gleeson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-12 00:00:00 +00:00
12
+ date: 2010-02-16 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,17 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.5.4
24
24
  version:
25
- description: Dia allows you to sandbox applications on the OSX platform
25
+ - !ruby/object:Gem::Dependency
26
+ name: baretest
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.4
34
+ version:
35
+ description: Dia allows you to sandbox applications and/or a block of ruby on the OSX platform
26
36
  email: rob@flowof.info
27
37
  executables: []
28
38
 
@@ -41,19 +51,25 @@ has_rdoc: true
41
51
  homepage:
42
52
  licenses: []
43
53
 
44
- post_install_message: " Dia\n\
45
- -----\n\
46
- Thanks for taking the time to try out the prereleae of Dia 1.1\n\n\
47
- For people who had problems with Dia and FFI 0.6.0, I have added an explicit \n\
48
- dependency on 0.5.4 ..\n\n\
49
- Slight API changes alter the way Dia behaves .. \n\
50
- The change is minor, but worth noting because it breaks code written for 1.0\n\n\
51
- For more information: \n\
52
- http://github.com/robgleeson/Dia/blob/experimental/NEWS.md\n\
53
- http://github.com/robgleeson/Dia/blob/experimental/README.md\n\n\
54
- Please report bugs if you find any! \n\
55
- http://github.com/robgleeson/dia/issues\n\n\
56
- Rob\n"
54
+ post_install_message: |+
55
+
56
+ ----------------------------------------------------------
57
+ Thanks for taking the time to try out Dia 1.1 (Final)
58
+
59
+ API docs:
60
+ http://yardoc.org/docs/robgleeson-Dia
61
+
62
+ NEWS & README:
63
+ http://github.com/robgleeson/Dia/blob/master/NEWS.md
64
+ http://github.com/robgleeson/Dia/blob/master/README.md
65
+
66
+ IRC:
67
+ irc.freenode.net / #flowof.info
68
+
69
+ Bug tracker:
70
+ http://github.com/robgleeson/dia/issues
71
+ ----------------------------------------------------------
72
+
57
73
  rdoc_options: []
58
74
 
59
75
  require_paths:
@@ -66,9 +82,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
82
  version:
67
83
  required_rubygems_version: !ruby/object:Gem::Requirement
68
84
  requirements:
69
- - - ">"
85
+ - - ">="
70
86
  - !ruby/object:Gem::Version
71
- version: 1.3.1
87
+ version: "0"
72
88
  version:
73
89
  requirements: []
74
90
 
@@ -76,6 +92,6 @@ rubyforge_project:
76
92
  rubygems_version: 1.3.5
77
93
  signing_key:
78
94
  specification_version: 3
79
- summary: Dia allows you to sandbox applications on the OSX platform
95
+ summary: Dia allows you to sandbox applications and/or a block of ruby on the OSX platform
80
96
  test_files: []
81
97