adhearsion 0.7.5 → 0.7.6
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/.version +1 -1
- data/CHANGELOG +25 -18
- data/LICENSE +386 -269
- data/Rakefile +4 -4
- data/TODO +22 -0
- data/ahn +72 -56
- data/apps/default/config/adhearsion.sqlite3 +0 -0
- data/apps/default/config/adhearsion.yml +52 -1
- data/apps/default/config/helpers/growler.yml +21 -0
- data/apps/default/config/migration.rb +7 -11
- data/apps/default/helpers/growler.rb +53 -0
- data/apps/default/helpers/lookup.rb +27 -18
- data/apps/default/helpers/manager_proxy.rb +19 -2
- data/apps/default/helpers/micromenus.rb +1 -1
- data/lib/adhearsion.rb +257 -44
- data/lib/constants.rb +15 -12
- data/lib/core_extensions.rb +11 -11
- data/lib/drb_server.rb +101 -0
- data/lib/logging.rb +18 -1
- data/lib/servlet_container.rb +23 -23
- data/test/asterisk_module_test.rb +1 -1
- metadata +35 -23
- data/apps/default/helpers/drb_server.rb +0 -32
data/lib/constants.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
# Adhearsion, open source technology integrator
|
2
|
-
# Copyright 2006 Jay Phillips
|
2
|
+
# Copyright (C) 2006,2007 Jay Phillips
|
3
3
|
#
|
4
|
-
# This
|
5
|
-
# modify it under the terms of the GNU General Public
|
6
|
-
# as published by the Free Software Foundation; either
|
7
|
-
# of the License, or (at your option) any later version.
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
8
|
#
|
9
|
-
# This
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
10
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
#
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
13
|
#
|
14
|
-
# You should have received a copy of the GNU General Public
|
15
|
-
# along with this
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
18
|
# Please help adjust these if they may be inaccurate!
|
19
19
|
LOCAL_NUMBER = /^[1-9]\d{6}$/
|
20
|
-
US_NUMBER = /^1?[1-9]\d{2}[1-9]\d{6}$/
|
20
|
+
US_NUMBER = /^1?[1-9]\d{2}[1-9]\d{6}$/
|
21
|
+
ISN = /^\d+\*\d+$/ # See http://freenum.org
|
22
|
+
|
23
|
+
Infinity = 1.0/0.0
|
data/lib/core_extensions.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# Adhearsion, open source technology integrator
|
2
|
-
# Copyright 2006 Jay Phillips
|
2
|
+
# Copyright (C) 2006,2007 Jay Phillips
|
3
3
|
#
|
4
|
-
# This
|
5
|
-
# modify it under the terms of the GNU General Public
|
6
|
-
# as published by the Free Software Foundation; either
|
7
|
-
# of the License, or (at your option) any later version.
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
8
|
#
|
9
|
-
# This
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
10
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
#
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
13
|
#
|
14
|
-
# You should have received a copy of the GNU General Public
|
15
|
-
# along with this
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
18
|
require 'active_support'
|
19
19
|
|
data/lib/drb_server.rb
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Adhearsion, open source technology integrator
|
2
|
+
# Copyright (C) 2006,2007 Jay Phillips
|
3
|
+
#
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
18
|
+
require 'drb'
|
19
|
+
require 'drb/acl'
|
20
|
+
require 'thread'
|
21
|
+
|
22
|
+
module DRbServerManager
|
23
|
+
|
24
|
+
def self.start
|
25
|
+
config = CONFIG['drb'] || {}
|
26
|
+
|
27
|
+
permissions = []
|
28
|
+
# For greater control over the ACL
|
29
|
+
if config['raw_acl']
|
30
|
+
permissions = config['raw_acl'].flatten
|
31
|
+
else
|
32
|
+
[config['deny']].flatten.each { |ip| permissions << "deny" << ip }
|
33
|
+
[config['allow']].flatten.each { |ip| permissions << "allow" << ip }
|
34
|
+
end
|
35
|
+
|
36
|
+
# Load the Access Control List
|
37
|
+
DRb.install_acl ACL.new(permissions)
|
38
|
+
|
39
|
+
host = config['host'] || 'localhost'
|
40
|
+
port = config['port'] || 9050
|
41
|
+
DRb.start_service "druby://#{host}:#{port}", DRbDoor.new
|
42
|
+
|
43
|
+
|
44
|
+
info "Started DRb server on #{DRb.uri}."
|
45
|
+
info "DRb Server Access Control List:"
|
46
|
+
0.step permissions.length-1, 2 do |i|
|
47
|
+
info " #{permissions[i].upcase} #{permissions[i+1]}"
|
48
|
+
end
|
49
|
+
|
50
|
+
$HUTDOWN.hook { DRbServerManager.stop }
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.stop
|
54
|
+
DRb.stop_service
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
# == Using Distributed Ruby (DRb) in Adhearsion
|
60
|
+
#
|
61
|
+
# A DRb server works by offering a single object to other Ruby instances
|
62
|
+
# who wish to use it over TCP. The DRbDoor class is designed to provide
|
63
|
+
# remote access to the Adhearsion's internals, such as the +PBX+ object,
|
64
|
+
# helpers' methods, etc.
|
65
|
+
#
|
66
|
+
# == Usage example
|
67
|
+
#
|
68
|
+
# Below is an example DRb client which accesses Adhearsion's internals.
|
69
|
+
#
|
70
|
+
# require 'drb'
|
71
|
+
# DRb.start_service
|
72
|
+
# Adhearsion = DRbObject.new nil, 'druby://localhost:9050'
|
73
|
+
# p Adhearsion.PBX.sip_users
|
74
|
+
# p Adhearsion.weather 'Dallas, Texas'
|
75
|
+
#
|
76
|
+
# Notice the subtle differences above in the two remote DRb procedure calls.
|
77
|
+
# When calling a method on the DRbDoor (called Adhearsion in the example), the
|
78
|
+
# target method is inspected to see whether the name meets the Ruby's constant
|
79
|
+
# syntax: capitalized first letter. The example PBX method actually returns
|
80
|
+
# the equivalent of Module.const_get(:PBX). When calling a traditionally-formatted
|
81
|
+
# method (no first capital letter), the return value of that method is evaluated.
|
82
|
+
class DRbDoor
|
83
|
+
|
84
|
+
instance_methods.each { |m| undef_method m unless m =~ /^(__|((private|protected)_methods|to_s|class)$)/ }
|
85
|
+
|
86
|
+
|
87
|
+
@@door = Object.new
|
88
|
+
class << @@door
|
89
|
+
def metaclass() class << self; self; end; end
|
90
|
+
def meta_eval(&block) metaclass.instance_eval(&block) end
|
91
|
+
end
|
92
|
+
|
93
|
+
def method_missing name, *args, &block
|
94
|
+
# Check whether it's a constant
|
95
|
+
if (?A..?Z).include? name.to_s[0] then Module.const_get name
|
96
|
+
else @@door.meta_eval { __send__ name, *args, &block }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def cli(&block) self.instance_eval(&block) end
|
101
|
+
end
|
data/lib/logging.rb
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# Adhearsion, open source technology integrator
|
2
|
+
# Copyright (C) 2006,2007 Jay Phillips
|
3
|
+
#
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
|
+
|
1
18
|
require 'logger'
|
2
19
|
|
3
20
|
LOGGERS = []
|
@@ -62,7 +79,7 @@ end
|
|
62
79
|
|
63
80
|
class StandardLogger < Logger
|
64
81
|
def initialize *args
|
65
|
-
super
|
82
|
+
super(*args)
|
66
83
|
formatter = lambda {}
|
67
84
|
end
|
68
85
|
end
|
data/lib/servlet_container.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
# Adhearsion, open source technology integrator
|
2
|
-
# Copyright 2006 Jay Phillips
|
2
|
+
# Copyright (C) 2006,2007 Jay Phillips
|
3
3
|
#
|
4
|
-
# This
|
5
|
-
# modify it under the terms of the GNU General Public
|
6
|
-
# as published by the Free Software Foundation; either
|
7
|
-
# of the License, or (at your option) any later version.
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License as published by the Free Software Foundation; either
|
7
|
+
# version 2.1 of the License, or (at your option) any later version.
|
8
8
|
#
|
9
|
-
# This
|
9
|
+
# This library is distributed in the hope that it will be useful,
|
10
10
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
#
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
13
|
#
|
14
|
-
# You should have received a copy of the GNU General Public
|
15
|
-
# along with this
|
16
|
-
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this library; if not, write to the Free Software
|
16
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
17
17
|
|
18
18
|
class ServletContainer
|
19
19
|
|
@@ -30,19 +30,21 @@ class ServletContainer
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def read_variables io
|
33
|
-
# When debugging, this method could actually not do any IO operations and just
|
34
|
-
# return a development Hash of call variables
|
35
33
|
call_variables = {}
|
36
34
|
while(line = io.gets.chomp)
|
37
35
|
break if line.empty? # Empty lines signify no more variables
|
38
36
|
variable = line.split(/:\s*/)
|
39
37
|
new_name, new_value = variable.first[4..-1].downcase, variable.last
|
38
|
+
if new_name == 'extension'
|
39
|
+
new_value.gsub! '-', '_'
|
40
|
+
call_variables['str_extension'] = new_value
|
41
|
+
end
|
40
42
|
call_variables["#{new_name}"] = new_value =~ /^\d+$/ ? Integer(new_value) : new_value
|
41
43
|
end
|
42
44
|
call_variables
|
43
45
|
end
|
44
46
|
|
45
|
-
# GServer allows all functionality to be packed into
|
47
|
+
# GServer allows all functionality to be packed into this one serve() method.
|
46
48
|
def serve io
|
47
49
|
io.sync = true
|
48
50
|
Thread.current[:io] = io
|
@@ -69,16 +71,14 @@ class ServletContainer
|
|
69
71
|
|
70
72
|
log "Executing call with variables: " + call_variables.inspect
|
71
73
|
|
72
|
-
# TODO Will perform cache checking here.
|
73
|
-
|
74
74
|
call_variables.each do |k,v|
|
75
75
|
Thread.current[:container].run_inside do
|
76
|
-
meta_def
|
76
|
+
meta_def(k) { v }
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
# Execute all before_call hooks
|
81
|
-
[$BEFORE_CALl_HIGH, $BEFORE_CALL, $BEFORE_CALL_LOW].flatten.compact.each
|
81
|
+
[$BEFORE_CALl_HIGH, $BEFORE_CALL, $BEFORE_CALL_LOW].flatten.compact.each(&:call)
|
82
82
|
+lambda { answer if CONFIG.answer_before_call }
|
83
83
|
|
84
84
|
# A call hook may decree that the call shouldn't be processed further (e.g. if
|
@@ -93,7 +93,7 @@ class ServletContainer
|
|
93
93
|
rescue => detail
|
94
94
|
log "Exception raised in extensions.rb! " << detail.message
|
95
95
|
# TODO: Make error reports more intutive. Use notifications DSL?
|
96
|
-
detail.backtrace.each do |msg| log " "*8 << msg end
|
96
|
+
detail.backtrace.each do |msg| log " " * 8 << msg end
|
97
97
|
end
|
98
98
|
|
99
99
|
log "Parsing of extensions.rb complete"
|
@@ -109,7 +109,7 @@ class ServletContainer
|
|
109
109
|
begin
|
110
110
|
+send(target_context.to_s.to_sym)
|
111
111
|
rescue => e
|
112
|
-
error e.inspect
|
112
|
+
error e.inspect + "\n " + e.backtrace * "\n "
|
113
113
|
+lambda {
|
114
114
|
play 'were-sorry'
|
115
115
|
hangup
|
@@ -132,13 +132,13 @@ class ServletContainer
|
|
132
132
|
detail.backtrace.each do |msg| log " "*8 << msg end
|
133
133
|
end
|
134
134
|
|
135
|
-
[$AFTER_CALL_HIGH, $AFTER_CALL, $AFTER_CALL_LOW].flatten.compact.each
|
135
|
+
[$AFTER_CALL_HIGH, $AFTER_CALL, $AFTER_CALL_LOW].flatten.compact.each(&:call)
|
136
136
|
+lambda { hangup if CONFIG['hangup_after_call'] }
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
def initialize(port=4573, native=false)
|
141
|
-
@server = (native ? NativeServer : RubyServer).new port,
|
140
|
+
def initialize(port=4573, host='0.0.0.0', native=false)
|
141
|
+
@server = (native ? NativeServer : RubyServer).new port, host, Infinity
|
142
142
|
@server.start
|
143
143
|
end
|
144
144
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: adhearsion
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.7.
|
7
|
-
date: 2007-
|
8
|
-
summary: Adhearsion is
|
6
|
+
version: 0.7.6
|
7
|
+
date: 2007-03-27 00:00:00 -05:00
|
8
|
+
summary: Adhearsion is metaprogramming framework for developing collaboration software.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
|
-
email:
|
11
|
+
email: jay -at- codemecca dot com
|
12
12
|
homepage: http://adhearsion.com
|
13
13
|
rubyforge_project: adhearsion
|
14
14
|
description:
|
@@ -31,39 +31,24 @@ authors:
|
|
31
31
|
files:
|
32
32
|
- ahn
|
33
33
|
- apps
|
34
|
-
- CHANGELOG
|
35
|
-
- docs
|
36
|
-
- lib
|
37
|
-
- LICENSE
|
38
|
-
- Rakefile
|
39
|
-
- test
|
40
34
|
- apps/codemeccollab
|
41
35
|
- apps/default
|
42
36
|
- apps/default/config
|
43
|
-
- apps/default/extensions.rb
|
44
|
-
- apps/default/helpers
|
45
|
-
- apps/default/logs
|
46
|
-
- apps/default/Rakefile
|
47
37
|
- apps/default/config/adhearsion.sqlite3
|
48
38
|
- apps/default/config/adhearsion.yml
|
49
39
|
- apps/default/config/database.rb
|
50
40
|
- apps/default/config/database.yml
|
51
41
|
- apps/default/config/helpers
|
52
|
-
- apps/default/config/migration.rb
|
53
42
|
- apps/default/config/helpers/drb_server.yml
|
54
43
|
- apps/default/config/helpers/factorial.alien.c.yml
|
44
|
+
- apps/default/config/helpers/growler.yml
|
55
45
|
- apps/default/config/helpers/lookup.yml
|
56
46
|
- apps/default/config/helpers/manager_proxy.yml
|
57
47
|
- apps/default/config/helpers/micromenus
|
58
|
-
- apps/default/config/helpers/micromenus.yml
|
59
|
-
- apps/default/config/helpers/multi_messenger.yml
|
60
|
-
- apps/default/config/helpers/weather.yml
|
61
|
-
- apps/default/config/helpers/xbmc.yml
|
62
48
|
- apps/default/config/helpers/micromenus/collab.rb
|
63
49
|
- apps/default/config/helpers/micromenus/images
|
64
|
-
- apps/default/config/helpers/micromenus/javascripts
|
65
|
-
- apps/default/config/helpers/micromenus/stylesheets
|
66
50
|
- apps/default/config/helpers/micromenus/images/tux.bmp
|
51
|
+
- apps/default/config/helpers/micromenus/javascripts
|
67
52
|
- apps/default/config/helpers/micromenus/javascripts/builder.js
|
68
53
|
- apps/default/config/helpers/micromenus/javascripts/controls.js
|
69
54
|
- apps/default/config/helpers/micromenus/javascripts/dragdrop.js
|
@@ -72,10 +57,18 @@ files:
|
|
72
57
|
- apps/default/config/helpers/micromenus/javascripts/scriptaculous.js
|
73
58
|
- apps/default/config/helpers/micromenus/javascripts/slider.js
|
74
59
|
- apps/default/config/helpers/micromenus/javascripts/unittest.js
|
60
|
+
- apps/default/config/helpers/micromenus/stylesheets
|
75
61
|
- apps/default/config/helpers/micromenus/stylesheets/firefox.css
|
76
62
|
- apps/default/config/helpers/micromenus/stylesheets/firefox.xul.css
|
77
|
-
- apps/default/helpers/
|
63
|
+
- apps/default/config/helpers/micromenus.yml
|
64
|
+
- apps/default/config/helpers/multi_messenger.yml
|
65
|
+
- apps/default/config/helpers/weather.yml
|
66
|
+
- apps/default/config/helpers/xbmc.yml
|
67
|
+
- apps/default/config/migration.rb
|
68
|
+
- apps/default/extensions.rb
|
69
|
+
- apps/default/helpers
|
78
70
|
- apps/default/helpers/factorial.alien.c
|
71
|
+
- apps/default/helpers/growler.rb
|
79
72
|
- apps/default/helpers/lookup.rb
|
80
73
|
- apps/default/helpers/manager_proxy.rb
|
81
74
|
- apps/default/helpers/micromenus.rb
|
@@ -83,18 +76,28 @@ files:
|
|
83
76
|
- apps/default/helpers/oscar_wilde_quotes.rb
|
84
77
|
- apps/default/helpers/weather.rb
|
85
78
|
- apps/default/helpers/xbmc.rb
|
79
|
+
- apps/default/logs
|
86
80
|
- apps/default/logs/adhearsion.log
|
87
81
|
- apps/default/logs/database.log
|
82
|
+
- apps/default/Rakefile
|
83
|
+
- CHANGELOG
|
84
|
+
- docs
|
85
|
+
- lib
|
88
86
|
- lib/adhearsion.rb
|
89
87
|
- lib/constants.rb
|
90
88
|
- lib/core_extensions.rb
|
89
|
+
- lib/drb_server.rb
|
91
90
|
- lib/logging.rb
|
92
91
|
- lib/rami.rb
|
93
92
|
- lib/servlet_container.rb
|
93
|
+
- LICENSE
|
94
|
+
- Rakefile
|
95
|
+
- test
|
94
96
|
- test/asterisk_module_test.rb
|
95
97
|
- test/core_extensions_test.rb
|
96
98
|
- test/dial_test.rb
|
97
99
|
- test/test_micromenus.rb
|
100
|
+
- TODO
|
98
101
|
- .version
|
99
102
|
test_files: []
|
100
103
|
|
@@ -127,3 +130,12 @@ dependencies:
|
|
127
130
|
- !ruby/object:Gem::Version
|
128
131
|
version: 0.7.1
|
129
132
|
version:
|
133
|
+
- !ruby/object:Gem::Dependency
|
134
|
+
name: daemons
|
135
|
+
version_requirement:
|
136
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 1.0.5
|
141
|
+
version:
|
@@ -1,32 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'drb'
|
3
|
-
require 'drb/acl'
|
4
|
-
require 'thread'
|
5
|
-
|
6
|
-
# Load the access control list
|
7
|
-
config = $HELPERS['drb_server']
|
8
|
-
|
9
|
-
permissions = []
|
10
|
-
# For greater control over the ACL
|
11
|
-
if config['raw_acl']
|
12
|
-
permissions = config['raw_acl'].flatten
|
13
|
-
else
|
14
|
-
[config['deny']].flatten.each { |ip| permissions << "deny" << ip }
|
15
|
-
[config['allow']].flatten.each { |ip| permissions << "allow" << ip }
|
16
|
-
end
|
17
|
-
|
18
|
-
DRb.install_acl ACL.new(permissions)
|
19
|
-
|
20
|
-
host = config['host'] || 'localhost'
|
21
|
-
port = config['port'] || 9050
|
22
|
-
DRb.start_service "druby://#{host}:#{port}", PBX
|
23
|
-
|
24
|
-
log "Started DRb server on #{DRb.uri}."
|
25
|
-
log "DRb Server Access Control List:"
|
26
|
-
0.step permissions.length-1, 2 do |i|
|
27
|
-
log " #{permissions[i].upcase} #{permissions[i+1]}"
|
28
|
-
end
|
29
|
-
|
30
|
-
$HUTDOWN.hook do
|
31
|
-
DRb.stop_service
|
32
|
-
end
|