emdrb 0.1.0 → 0.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.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
1
  == 0.1.0 / 2008-10-23
2
2
 
3
3
  * First public release
4
+
5
+ == 0.1.1 / 2008-12-02
6
+
7
+ * Basic unit tests
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
- #
2
- # $Id: Rakefile 5 2008-10-23 09:31:35Z dido $
1
+ # -*- Ruby -*-
2
+ # $Id: Rakefile 18 2008-12-02 03:58:53Z dido $
3
3
  #
4
4
  load 'tasks/setup.rb'
5
5
 
@@ -15,6 +15,7 @@ PROJ.url = 'http://emdrb.rubyforge.org'
15
15
  PROJ.rubyforge.name = 'emdrb'
16
16
  PROJ.version = EMDRb::Version::STRING
17
17
  PROJ.dependencies = ["eventmachine"]
18
+ PROJ.rcov.opts += ["-Ilib"] # Why is this necessary?
18
19
 
19
20
  PROJ.spec.opts << '--color'
20
21
 
data/lib/emdrb/emdrb.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # Homepage:: http://emdrb.rubyforge.org/
5
5
  # License:: GNU General Public License / Ruby License
6
6
  #
7
- # $Id: emdrb.rb 10 2008-10-23 09:48:11Z dido $
7
+ # $Id: emdrb.rb 17 2008-12-02 03:58:23Z dido $
8
8
  #
9
9
  #----------------------------------------------------------------------------
10
10
  #
@@ -248,11 +248,11 @@ module EMDRb
248
248
  when :argv
249
249
  @argv << @request[:argv]
250
250
  @argc -= 1
251
- if @argc <= 1
251
+ if @argc < 1
252
252
  @state = :block
253
253
  end
254
254
  when :block
255
- @request[:argv] = @argv
255
+ @request[:argv] = @argv
256
256
  @state = :ref
257
257
  send_reply(*perform)
258
258
  @request = {}
@@ -348,8 +348,10 @@ module EMDRb
348
348
  option = $4
349
349
  [host, port, option]
350
350
  else
351
- raise(DRb::DRbBadScheme, uri) unless uri =~ /^druby:/
352
- raise(DRb::DRbBadURI, 'can\'t parse uri:' + uri)
351
+ unless uri =~ /^druby:/
352
+ raise DRb::DRbBadScheme.new(uri)
353
+ end
354
+ raise DRb::DRbBadURI.new('can\'t parse uri:' + uri)
353
355
  end
354
356
  end
355
357
  module_function :parse_uri
data/lib/emdrb/version.rb CHANGED
@@ -4,7 +4,7 @@
4
4
  # Homepage:: http://emdrb.rubyforge.org/
5
5
  # License:: GNU Lesser General Public License / Ruby License
6
6
  #
7
- # $Id: version.rb 4 2008-10-23 09:29:31Z dido $
7
+ # $Id: version.rb 20 2008-12-02 04:00:25Z dido $
8
8
  #
9
9
  #----------------------------------------------------------------------------
10
10
  #
@@ -26,7 +26,7 @@ module EMDRb
26
26
 
27
27
  MAJOR = 0
28
28
  MINOR = 1
29
- TINY = 0
29
+ TINY = 1
30
30
 
31
31
  # The version of EMDRb in use.
32
32
  STRING = [ MAJOR, MINOR, TINY ].join(".")
data/test/test_emdrb.rb CHANGED
@@ -0,0 +1,64 @@
1
+ #
2
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
3
+ # Copyright:: Copyright (c) 2008 Rafael R. Sevilla
4
+ # Homepage:: http://emdrb.rubyforge.org/
5
+ # License:: GNU General Public License / Ruby License
6
+ #
7
+ # $Id: test_emdrb.rb 19 2008-12-02 03:59:14Z dido $
8
+ #
9
+ #----------------------------------------------------------------------------
10
+ #
11
+ # Copyright (C) 2008 Rafael Sevilla
12
+ # This file is part of EMDRb
13
+ #
14
+ # This program is free software; you can redistribute it and/or modify
15
+ # it under the terms of either: 1) the GNU General Public License
16
+ # as published by the Free Software Foundation; either version 2 of the
17
+ # License, or (at your option) any later version; or 2) Ruby's License.
18
+ #
19
+ # See the file COPYING for complete licensing information.
20
+ #----------------------------------------------------------------------------
21
+ #
22
+ require 'test/unit'
23
+ require 'emdrb/emdrb'
24
+ require 'drb'
25
+
26
+ Thread.abort_on_exception = true
27
+
28
+ class TestServer
29
+ def identity(x)
30
+ return(x)
31
+ end
32
+
33
+ def addtwo(x, y)
34
+ return(x+y)
35
+ end
36
+
37
+ def sum(*vals)
38
+ return(vals.inject(0) { |x,y| x + y })
39
+ end
40
+
41
+ def blockyield(*vals)
42
+ vals.each do |x|
43
+ yield x
44
+ end
45
+ end
46
+ end
47
+
48
+ class EMDRbTest < Test::Unit::TestCase
49
+ def test_drb
50
+ EMDRb.start_service("druby://:12345", TestServer.new)
51
+ o = DRbObject.new_with_uri("druby://localhost:12345")
52
+ DRb.start_service
53
+ assert_equal(1, o.identity(1))
54
+ assert_equal(3, o.addtwo(1, 2))
55
+ assert_raises(ArgumentError) do
56
+ o.addtwo(1)
57
+ end
58
+ assert_equal(15, o.sum(1,2,3,4,5))
59
+ val = 1
60
+ o.blockyield(1,2,3,4,5,6,7) { |x| val *= x }
61
+ assert_equal(5040, val)
62
+ end
63
+
64
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emdrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dido@imperium.ph
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-10-23 00:00:00 +08:00
12
+ date: 2008-12-02 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15