auser-ruberl 0.0.2 → 0.0.3
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/lib/ruberl/base.rb +29 -6
- data/lib/ruberl/version.rb +1 -1
- data/ruberl.gemspec +9 -7
- data/website/index.html +2 -2
- metadata +4 -3
data/lib/ruberl/base.rb
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
module Ruberl
|
|
2
2
|
class Base
|
|
3
|
-
attr_accessor :host, :port
|
|
3
|
+
attr_accessor :host, :port, :recv_timeout
|
|
4
4
|
def initialize(host="localhost", port=7050)
|
|
5
5
|
@host = host
|
|
6
6
|
@port = port
|
|
7
|
+
|
|
8
|
+
@recv_timeout = 3
|
|
7
9
|
end
|
|
8
10
|
def with_socket(&block)
|
|
9
11
|
begin
|
|
@@ -14,6 +16,27 @@ module Ruberl
|
|
|
14
16
|
rescue Exception => e
|
|
15
17
|
end
|
|
16
18
|
end
|
|
19
|
+
def with_udp(&block)
|
|
20
|
+
out,sock = nil,nil
|
|
21
|
+
begin
|
|
22
|
+
socket = UDPSocket.open
|
|
23
|
+
out = yield(socket)
|
|
24
|
+
rescue IOError, SystemCallError
|
|
25
|
+
ensure
|
|
26
|
+
socket.close if socket
|
|
27
|
+
end
|
|
28
|
+
out
|
|
29
|
+
end
|
|
30
|
+
def messenger_cast!(cmd)
|
|
31
|
+
with_udp do |sock|
|
|
32
|
+
sock.send(cmd, 0, @host, @port)
|
|
33
|
+
@resp = if select([sock], nil, nil, @recv_timeout)
|
|
34
|
+
sock.recvfrom(65536)
|
|
35
|
+
end
|
|
36
|
+
@resp[0] = @resp[0][4..-1] if @resp
|
|
37
|
+
end
|
|
38
|
+
@resp ? @resp[0] : nil
|
|
39
|
+
end
|
|
17
40
|
def messenger_send!(msg="get_current_load cpu")
|
|
18
41
|
with_socket do |sock|
|
|
19
42
|
sock.send(msg, 0)
|
|
@@ -21,10 +44,10 @@ module Ruberl
|
|
|
21
44
|
end
|
|
22
45
|
@str
|
|
23
46
|
end
|
|
24
|
-
def messenger_cast!(msg="force_reconfig")
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
end
|
|
47
|
+
# def messenger_cast!(msg="force_reconfig")
|
|
48
|
+
# with_socket do |sock|
|
|
49
|
+
# sock.send(msg, 0)
|
|
50
|
+
# end
|
|
51
|
+
# end
|
|
29
52
|
end
|
|
30
53
|
end
|
data/lib/ruberl/version.rb
CHANGED
data/ruberl.gemspec
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
1
3
|
Gem::Specification.new do |s|
|
|
2
4
|
s.name = %q{ruberl}
|
|
3
|
-
s.version = "0.0.
|
|
5
|
+
s.version = "0.0.3"
|
|
4
6
|
|
|
5
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
6
8
|
s.authors = ["Ari Lerner"]
|
|
7
|
-
s.date = %q{
|
|
9
|
+
s.date = %q{2009-03-03}
|
|
8
10
|
s.description = %q{A quick and dirty module you can include in your classes to give you an easy connection to your gen_tcp erlang server}
|
|
9
11
|
s.email = ["arilerner@mac.com"]
|
|
10
12
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "website/index.txt"]
|
|
@@ -19,7 +21,7 @@ For more information on ruberl, see http://ruberl.rubyforge.org
|
|
|
19
21
|
s.rdoc_options = ["--main", "README.txt"]
|
|
20
22
|
s.require_paths = ["lib"]
|
|
21
23
|
s.rubyforge_project = %q{ruberl}
|
|
22
|
-
s.rubygems_version = %q{1.
|
|
24
|
+
s.rubygems_version = %q{1.3.1}
|
|
23
25
|
s.summary = %q{A quick and dirty module you can include in your classes to give you an easy connection to your gen_tcp erlang server}
|
|
24
26
|
s.test_files = ["test/test_helper.rb", "test/test_ruberl.rb"]
|
|
25
27
|
|
|
@@ -27,12 +29,12 @@ For more information on ruberl, see http://ruberl.rubyforge.org
|
|
|
27
29
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
28
30
|
s.specification_version = 2
|
|
29
31
|
|
|
30
|
-
if
|
|
31
|
-
s.add_development_dependency(%q<hoe>, [">= 1.8.
|
|
32
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
33
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
|
32
34
|
else
|
|
33
|
-
s.add_dependency(%q<hoe>, [">= 1.8.
|
|
35
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
|
34
36
|
end
|
|
35
37
|
else
|
|
36
|
-
s.add_dependency(%q<hoe>, [">= 1.8.
|
|
38
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
|
37
39
|
end
|
|
38
40
|
end
|
data/website/index.html
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<h1>ruberl</h1>
|
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ruberl"; return false'>
|
|
35
35
|
<p>Get Version</p>
|
|
36
|
-
<a href="http://rubyforge.org/projects/ruberl" class="numbers">0.0.
|
|
36
|
+
<a href="http://rubyforge.org/projects/ruberl" class="numbers">0.0.3</a>
|
|
37
37
|
</div>
|
|
38
38
|
<h1>&#x2192; ‘ruberl’</h1>
|
|
39
39
|
<h2>What</h2>
|
|
@@ -58,7 +58,7 @@ end</p>
|
|
|
58
58
|
<h2>Contact</h2>
|
|
59
59
|
<p>Comments are welcome. Send an email to <a href="mailto:arilerner@mac.com">Ari Lerner</a></p>
|
|
60
60
|
<p class="coda">
|
|
61
|
-
<a href="FIXME email">FIXME full name</a>,
|
|
61
|
+
<a href="FIXME email">FIXME full name</a>, 3rd March 2009<br>
|
|
62
62
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
|
63
63
|
</p>
|
|
64
64
|
</div>
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auser-ruberl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ari Lerner
|
|
@@ -9,17 +9,18 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date:
|
|
12
|
+
date: 2009-03-03 00:00:00 -08:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: hoe
|
|
17
|
+
type: :development
|
|
17
18
|
version_requirement:
|
|
18
19
|
version_requirements: !ruby/object:Gem::Requirement
|
|
19
20
|
requirements:
|
|
20
21
|
- - ">="
|
|
21
22
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 1.8.
|
|
23
|
+
version: 1.8.0
|
|
23
24
|
version:
|
|
24
25
|
description: A quick and dirty module you can include in your classes to give you an easy connection to your gen_tcp erlang server
|
|
25
26
|
email:
|