classroom 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |s|
4
4
  s.name = 'classroom'
5
- s.version = "0.0.1"
5
+ s.version = "0.0.2"
6
6
  s.platform = Gem::Platform::RUBY
7
7
  s.summary = "ClassRoom is a 'class server' based on DRb"
8
8
  s.files = Dir.glob("**/**/**").delete_if {|item| item.include?(".svn")}
@@ -17,7 +17,7 @@ klass = %q{
17
17
  # Here's the magic..
18
18
  class_server = ClassRoom::Client.new(ARGV.first || 'classroom://:2001')
19
19
  class_server.add_class(klass)
20
- class_server.load_class(binding, :all)
20
+ class_server.load_class(:all)
21
21
 
22
22
  # Create and use objects as you would normally, but remember
23
23
  # 'BasicQueue' actually exists on the ClassRoom server and,
@@ -9,7 +9,7 @@ require 'rubygems'
9
9
  require 'classroom'
10
10
 
11
11
  class_server = ClassRoom::Client.new(ARGV.first || 'classroom://:2001')
12
- class_server.load_class(binding, :BasicQueue)
12
+ class_server.load_class(:BasicQueue)
13
13
 
14
14
  q = BasicQueue.new(5)
15
15
  10.times { |i| q.push("test #{i}") }
@@ -19,7 +19,7 @@ class_server.add_class(klass)
19
19
 
20
20
  # Load local references to all the classes on the ClassRoom server,
21
21
  # including BasicDataClass
22
- class_server.load_class(binding, :all)
22
+ class_server.load_class(:all)
23
23
 
24
24
  # Create and use objects as you would normally, but remember
25
25
  # 'BasicDataClass' actually exists on the ClassRoom server
@@ -37,8 +37,8 @@ klass = %q{
37
37
  # Here's the magic..
38
38
  class_server = ClassRoom::Client.new(ARGV.first || 'druby://coop-pb:2001')
39
39
  class_server.add_class(klass)
40
- class_server.load_class(binding, :all)
41
- #class_server.load_non_present_classes(binding)
40
+ class_server.load_class(:all)
41
+ #class_server.load_non_present_classes()
42
42
 
43
43
  puts BasicParent.give_child.x
44
44
  puts BasicParent.x
@@ -25,7 +25,7 @@ klass = %q{
25
25
  # Here's the magic..
26
26
  class_server = ClassRoom::Client.new(ARGV.first || 'druby://coop-pb:2001')
27
27
  class_server.add_class(klass)
28
- class_server.load_class(binding, :all)
28
+ class_server.load_class(:all)
29
29
 
30
30
  a = BasicParent.new
31
31
 
@@ -36,7 +36,7 @@ klass = %q{
36
36
  # Here's the magic..
37
37
  class_server = ClassRoom::Client.new(ARGV.first || 'druby://coop-pb:2001')
38
38
  class_server.add_class(klass)
39
- class_server.load_non_present_classes(binding)
39
+ class_server.load_non_present_classes
40
40
 
41
41
  puts class_server.classes.inspect
42
42
  puts TestModule::BasicParent.give_child.x
@@ -26,7 +26,7 @@ klass2 = %q{
26
26
  class_server = ClassRoom::Client.new(ARGV.first || 'druby://coop-pb:2001')
27
27
  class_server.add_class(klass)
28
28
  class_server.add_class(klass2)
29
- class_server.load_class(binding, :all)
29
+ class_server.load_class(:all)
30
30
 
31
31
  x = Something.new(10)
32
32
  puts x.blah
@@ -20,7 +20,7 @@ klass = %q{
20
20
  # Here's the magic..
21
21
  class_server = ClassRoom::Client.new(ARGV.first || 'druby://coop-pb:2001')
22
22
  class_server.add_class(klass)
23
- class_server.load_class(binding, :all)
23
+ class_server.load_class(:all)
24
24
 
25
25
 
26
26
  class Something
@@ -162,23 +162,22 @@ module ClassRoom
162
162
 
163
163
  # Load a class (or all classes, if :all is specified) from the
164
164
  # ClassRoom server to be used locally
165
- def load_class(b, *classes)
166
- return nil unless classes && b
165
+ def load_class(*classes)
166
+ return nil unless classes
167
167
  classes = self.classes if classes.first == :all
168
168
  classes.each do |class_name|
169
- eval %Q{
169
+ eval(%Q{
170
170
  class #{class_name} < ClassRoom::Client::ProxyObject
171
171
  end
172
172
  #{class_name}.class_name = :\"#{class_name}\"
173
173
  #{class_name}.drb = ClassRoom::Client::get_drb('#{@drb_url}')
174
- }, b
174
+ }, TOPLEVEL_BINDING)
175
175
  end
176
176
  end
177
177
 
178
178
  # Load all classes on the ClassRoom server that do not already
179
179
  # exist locally (not fully tested yet!)
180
- def load_non_present_classes(b)
181
- return nil unless b
180
+ def load_non_present_classes
182
181
  classes = self.classes
183
182
  classes.each do |class_name|
184
183
  eval %Q{
@@ -186,19 +185,19 @@ module ClassRoom
186
185
  class #{class_name} < ClassRoom::Client::ProxyObject
187
186
  end
188
187
  end
189
- }, b
188
+ }, TOPLEVEL_BINDING
190
189
  eval %Q{
191
190
  begin
192
191
  #{class_name}.drb = @drb
193
192
  rescue
194
193
  end
195
- }
194
+ }, TOPLEVEL_BINDING
196
195
  eval %Q{
197
196
  begin
198
197
  #{class_name}.class_name = :\"#{class_name}\"
199
198
  rescue
200
199
  end
201
- }
200
+ }, TOPLEVEL_BINDING
202
201
  end
203
202
  end
204
203
 
@@ -2,9 +2,6 @@ require 'test/unit'
2
2
  require 'rubygems'
3
3
  require 'classroom'
4
4
 
5
- # Get a binding for the top level
6
- $top_level_binding = binding
7
-
8
5
  class ClassRoomTest < Test::Unit::TestCase
9
6
 
10
7
  def setup
@@ -35,7 +32,7 @@ class ClassRoomTest < Test::Unit::TestCase
35
32
  end
36
33
 
37
34
  def test_e_can_import_classes
38
- assert $class_server.load_class($top_level_binding, :all)
35
+ assert $class_server.load_class(:all)
39
36
  end
40
37
 
41
38
  def test_f_can_use_imported_classes
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: classroom
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
6
+ version: 0.0.2
7
7
  date: 2006-07-12 00:00:00 +01:00
8
8
  summary: ClassRoom is a 'class server' based on DRb
9
9
  require_paths: