adaptation 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -1
- data/bin/breakpointer +3 -0
- data/bin/mom +43 -5
- data/bin/mom~ +46 -0
- data/configs/mom.yml +10 -8
- data/configs/settings.yml +6 -0
- data/dispatches/publish.rb +19 -4
- data/helpers/test_helper.rb +3 -0
- data/lib/adaptation/base.rb +3 -3
- data/lib/adaptation/druby_subscriber.rb +85 -0
- data/lib/adaptation/druby_subscriber.rb~ +79 -0
- data/lib/adaptation/message.rb +255 -75
- data/lib/adaptation/mom.rb +52 -48
- data/lib/adaptation/mom.rb~ +74 -0
- data/lib/adaptation/oapdaemon.rb~ +42 -0
- data/lib/adaptation/test/test_help.rb +3 -3
- data/lib/adaptation.rb +1 -0
- data/lib/binding_of_caller.rb +85 -0
- data/lib/breakpoint.rb +554 -0
- data/lib/breakpoint_client.rb +196 -0
- data/lib/commands/breakpointer.rb +1 -0
- data/lib/commands/subscribe.rb +21 -7
- data/lib/commands/subscribe.rb~ +25 -0
- data/lib/rails_generator/generators/applications/app/app_generator.rb +4 -1
- data/lib/rails_generator/generators/applications/app/app_generator.rb~ +136 -0
- data/lib/rails_generator/generators/components/adaptor/templates/functional_test.rb +1 -1
- data/lib/rails_generator/generators/components/message/templates/unit_test.rb +0 -1
- metadata +49 -36
- data/lib/adaptation/oapdaemon.rb +0 -38
- /data/lib/commands/{mom.rb → mom.rb.descartat} +0 -0
@@ -0,0 +1,196 @@
|
|
1
|
+
require 'breakpoint'
|
2
|
+
require 'optparse'
|
3
|
+
require 'timeout'
|
4
|
+
|
5
|
+
Options = {
|
6
|
+
:ClientURI => nil,
|
7
|
+
:ServerURI => "druby://localhost:42531",
|
8
|
+
:RetryDelay => 2,
|
9
|
+
:Permanent => true,
|
10
|
+
:Verbose => false
|
11
|
+
}
|
12
|
+
|
13
|
+
ARGV.options do |opts|
|
14
|
+
script_name = File.basename($0)
|
15
|
+
opts.banner = [
|
16
|
+
"Usage: ruby #{script_name} [Options] [server uri]",
|
17
|
+
"",
|
18
|
+
"This tool lets you connect to a breakpoint service ",
|
19
|
+
"which was started via Breakpoint.activate_drb.",
|
20
|
+
"",
|
21
|
+
"The server uri defaults to druby://localhost:42531"
|
22
|
+
].join("\n")
|
23
|
+
|
24
|
+
opts.separator ""
|
25
|
+
|
26
|
+
opts.on("-c", "--client-uri=uri",
|
27
|
+
"Run the client on the specified uri.",
|
28
|
+
"This can be used to specify the port",
|
29
|
+
"that the client uses to allow for back",
|
30
|
+
"connections from the server.",
|
31
|
+
"Default: Find a good URI automatically.",
|
32
|
+
"Example: -c druby://localhost:12345"
|
33
|
+
) { |v| Options[:ClientURI] = v }
|
34
|
+
|
35
|
+
opts.on("-s", "--server-uri=uri",
|
36
|
+
"Connect to the server specified at the",
|
37
|
+
"specified uri.",
|
38
|
+
"Default: druby://localhost:42531"
|
39
|
+
) { |v| Options[:ServerURI] = v }
|
40
|
+
|
41
|
+
opts.on("-R", "--retry-delay=delay", Integer,
|
42
|
+
"Automatically try to reconnect to the",
|
43
|
+
"server after delay seconds when the",
|
44
|
+
"connection failed or timed out.",
|
45
|
+
"A value of 0 disables automatical",
|
46
|
+
"reconnecting completely.",
|
47
|
+
"Default: 10"
|
48
|
+
) { |v| Options[:RetryDelay] = v }
|
49
|
+
|
50
|
+
opts.on("-P", "--[no-]permanent",
|
51
|
+
"Run the breakpoint client in permanent mode.",
|
52
|
+
"This means that the client will keep continue",
|
53
|
+
"running even after the server has closed the",
|
54
|
+
"connection. Useful for example in Rails."
|
55
|
+
) { |v| Options[:Permanent] = v }
|
56
|
+
|
57
|
+
opts.on("-V", "--[no-]verbose",
|
58
|
+
"Run the breakpoint client in verbose mode.",
|
59
|
+
"Will produce more messages, for example between",
|
60
|
+
"individual breakpoints. This might help in seeing",
|
61
|
+
"that the breakpoint client is still alive, but adds",
|
62
|
+
"quite a bit of clutter."
|
63
|
+
) { |v| Options[:Verbose] = v }
|
64
|
+
|
65
|
+
opts.separator ""
|
66
|
+
|
67
|
+
opts.on("-h", "--help",
|
68
|
+
"Show this help message."
|
69
|
+
) { puts opts; exit }
|
70
|
+
opts.on("-v", "--version",
|
71
|
+
"Display the version information."
|
72
|
+
) do
|
73
|
+
id = %q$Id: breakpoint_client.rb 91 2005-02-04 22:34:08Z flgr $
|
74
|
+
puts id.sub("Id: ", "")
|
75
|
+
puts "(Breakpoint::Version = #{Breakpoint::Version})"
|
76
|
+
exit
|
77
|
+
end
|
78
|
+
|
79
|
+
opts.parse!
|
80
|
+
end
|
81
|
+
|
82
|
+
Options[:ServerURI] = ARGV[0] if ARGV[0]
|
83
|
+
|
84
|
+
module Handlers #:nodoc:
|
85
|
+
extend self
|
86
|
+
|
87
|
+
def breakpoint_handler(workspace, message)
|
88
|
+
puts message
|
89
|
+
IRB.start(nil, nil, workspace)
|
90
|
+
|
91
|
+
puts ""
|
92
|
+
if Options[:Verbose] then
|
93
|
+
puts "Resumed execution. Waiting for next breakpoint...", ""
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def eval_handler(code)
|
98
|
+
result = eval(code, TOPLEVEL_BINDING)
|
99
|
+
if result then
|
100
|
+
DRbObject.new(result)
|
101
|
+
else
|
102
|
+
result
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def collision_handler()
|
107
|
+
msg = [
|
108
|
+
" *** Breakpoint service collision ***",
|
109
|
+
" Another Breakpoint service tried to use the",
|
110
|
+
" port already occupied by this one. It will",
|
111
|
+
" keep waiting until this Breakpoint service",
|
112
|
+
" is shut down.",
|
113
|
+
" ",
|
114
|
+
" If you are using the Breakpoint library for",
|
115
|
+
" debugging a Rails or other CGI application",
|
116
|
+
" this likely means that this Breakpoint",
|
117
|
+
" session belongs to an earlier, outdated",
|
118
|
+
" request and should be shut down via 'exit'."
|
119
|
+
].join("\n")
|
120
|
+
|
121
|
+
if RUBY_PLATFORM["win"] then
|
122
|
+
# This sucks. Sorry, I'm not doing this because
|
123
|
+
# I like funky message boxes -- I need to do this
|
124
|
+
# because on Windows I have no way of displaying
|
125
|
+
# my notification via puts() when gets() is still
|
126
|
+
# being performed on STDIN. I have not found a
|
127
|
+
# better solution.
|
128
|
+
begin
|
129
|
+
require 'tk'
|
130
|
+
root = TkRoot.new { withdraw }
|
131
|
+
Tk.messageBox('message' => msg, 'type' => 'ok')
|
132
|
+
root.destroy
|
133
|
+
rescue Exception
|
134
|
+
puts "", msg, ""
|
135
|
+
end
|
136
|
+
else
|
137
|
+
puts "", msg, ""
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
# Used for checking whether we are currently in the reconnecting loop.
|
143
|
+
reconnecting = false
|
144
|
+
|
145
|
+
loop do
|
146
|
+
DRb.start_service(Options[:ClientURI])
|
147
|
+
|
148
|
+
begin
|
149
|
+
service = DRbObject.new(nil, Options[:ServerURI])
|
150
|
+
|
151
|
+
begin
|
152
|
+
ehandler = Handlers.method(:eval_handler)
|
153
|
+
chandler = Handlers.method(:collision_handler)
|
154
|
+
handler = Handlers.method(:breakpoint_handler)
|
155
|
+
service.eval_handler = ehandler
|
156
|
+
service.collision_handler = chandler
|
157
|
+
service.handler = handler
|
158
|
+
|
159
|
+
reconnecting = false
|
160
|
+
if Options[:Verbose] then
|
161
|
+
puts "Connection established. Waiting for breakpoint...", ""
|
162
|
+
end
|
163
|
+
|
164
|
+
loop do
|
165
|
+
begin
|
166
|
+
service.ping
|
167
|
+
rescue DRb::DRbConnError => error
|
168
|
+
puts "Server exited. Closing connection...", ""
|
169
|
+
exit! unless Options[:Permanent]
|
170
|
+
break
|
171
|
+
end
|
172
|
+
|
173
|
+
sleep(0.5)
|
174
|
+
end
|
175
|
+
ensure
|
176
|
+
service.eval_handler = nil
|
177
|
+
service.collision_handler = nil
|
178
|
+
service.handler = nil
|
179
|
+
end
|
180
|
+
rescue Exception => error
|
181
|
+
if Options[:RetryDelay] > 0 then
|
182
|
+
if not reconnecting then
|
183
|
+
reconnecting = true
|
184
|
+
puts "No connection to breakpoint service at #{Options[:ServerURI]} " +
|
185
|
+
"(#{error.class})"
|
186
|
+
puts error.backtrace if $DEBUG
|
187
|
+
puts "Tries to connect will be made every #{Options[:RetryDelay]} seconds..."
|
188
|
+
end
|
189
|
+
|
190
|
+
sleep Options[:RetryDelay]
|
191
|
+
retry
|
192
|
+
else
|
193
|
+
raise
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'breakpoint_client'
|
data/lib/commands/subscribe.rb
CHANGED
@@ -1,11 +1,25 @@
|
|
1
1
|
require 'adaptation'
|
2
|
-
require 'adaptation/oapdaemon'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
subscriber_uri = "druby://#{config["subscriber"]["host"]}:#{config["subscriber"]["port"]}"
|
7
|
-
topics = config["subscriber"]["topics"].split(' ')
|
3
|
+
environment = "development" # TODO: "un-hardcode" this
|
4
|
+
config = YAML::load(File.open("config/mom.yml"))["development"]
|
8
5
|
|
9
|
-
|
10
|
-
|
6
|
+
case config["mom"]["type"]
|
7
|
+
when "druby"
|
8
|
+
require 'adaptation/druby_subscriber'
|
9
|
+
|
10
|
+
mom_uri = "druby://#{config["mom"]["host"]}:#{config["mom"]["port"]}"
|
11
|
+
subscriber_uri = "druby://#{config["subscriber"]["host"]}:#{config["subscriber"]["port"]}"
|
12
|
+
topics = config["subscriber"]["topics"].split(' ')
|
13
|
+
|
14
|
+
Signal.trap("INT") { puts "Shutting down subscriber (#{config["mom"]["type"]})"; exit }
|
15
|
+
|
16
|
+
oapdaemon = Adaptation::Mom::DrubySubscriber.new subscriber_uri, mom_uri, topics
|
17
|
+
oapdaemon.start
|
18
|
+
|
19
|
+
#when "xmlblaster"
|
20
|
+
#
|
21
|
+
|
22
|
+
else
|
23
|
+
puts "Unknown MOM server type: #{config["mom"]["type"]}"
|
24
|
+
end
|
11
25
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'adaptation'
|
2
|
+
|
3
|
+
environment = "development" # TODO: "un-hardcode" this
|
4
|
+
config = YAML::load(File.open("config/mom.yml"))["development"]
|
5
|
+
|
6
|
+
case config["mom"]["type"]
|
7
|
+
when "druby"
|
8
|
+
require 'adaptation/druby_subscriber'
|
9
|
+
|
10
|
+
mom_uri = "druby://#{config["mom"]["host"]}:#{config["mom"]["port"]}"
|
11
|
+
subscriber_uri = "druby://#{config["subscriber"]["host"]}:#{config["subscriber"]["port"]}"
|
12
|
+
topics = config["subscriber"]["topics"].split(' ')
|
13
|
+
|
14
|
+
Signal.trap("INT") { puts "Shutting down subscriber (#{config["mom"]["type"]})"; exit }
|
15
|
+
|
16
|
+
oapdaemon = Adaptation::Mom::DrubySubscriber.new subscriber_uri, mom_uri, topics
|
17
|
+
oapdaemon.start
|
18
|
+
|
19
|
+
#when "xmlblaster"
|
20
|
+
#
|
21
|
+
|
22
|
+
else
|
23
|
+
puts "Unknown MOM server type: #{config["mom"]["type"]}"
|
24
|
+
end
|
25
|
+
|
@@ -43,6 +43,9 @@ class AppGenerator < Rails::Generator::Base
|
|
43
43
|
# mom.yml
|
44
44
|
m.template "configs/mom.yml", "config/mom.yml"
|
45
45
|
|
46
|
+
# settings.yml
|
47
|
+
m.template "configs/settings.yml", "config/settings.yml"
|
48
|
+
|
46
49
|
# boot.rb, needed by some scripts
|
47
50
|
m.file "configs/boot.rb", "config/boot.rb"
|
48
51
|
|
@@ -54,7 +57,7 @@ class AppGenerator < Rails::Generator::Base
|
|
54
57
|
#m.file "environments/test.rb", "config/environments/test.rb"
|
55
58
|
|
56
59
|
# Scripts
|
57
|
-
%w(
|
60
|
+
%w( generate destroy about subscribe breakpointer ).each do |file|
|
58
61
|
m.file "bin/#{file}", "script/#{file}", script_options
|
59
62
|
end
|
60
63
|
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
class AppGenerator < Rails::Generator::Base
|
4
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
5
|
+
Config::CONFIG['ruby_install_name'])
|
6
|
+
|
7
|
+
DATABASES = %w(mysql oracle postgresql sqlite2 sqlite3 frontbase)
|
8
|
+
|
9
|
+
default_options :db => "mysql", :shebang => DEFAULT_SHEBANG, :freeze => false
|
10
|
+
mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
|
11
|
+
|
12
|
+
def initialize(runtime_args, runtime_options = {})
|
13
|
+
super
|
14
|
+
usage if args.empty?
|
15
|
+
usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}") if (options[:db] && !DATABASES.include?(options[:db]))
|
16
|
+
@destination_root = args.shift
|
17
|
+
@app_name = File.basename(File.expand_path(@destination_root))
|
18
|
+
end
|
19
|
+
|
20
|
+
def manifest
|
21
|
+
# Use /usr/bin/env if no special shebang was specified
|
22
|
+
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
23
|
+
dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] }
|
24
|
+
|
25
|
+
record do |m|
|
26
|
+
# Root directory and all subdirectories.
|
27
|
+
m.directory ''
|
28
|
+
BASEDIRS.each { |path| m.directory path }
|
29
|
+
|
30
|
+
# Root
|
31
|
+
m.file "README", "README"
|
32
|
+
|
33
|
+
# Application
|
34
|
+
m.file "helpers/test_helper.rb", "test/test_helper.rb"
|
35
|
+
m.file "helpers/publish.rb", "test/mocks/test/publish.rb"
|
36
|
+
|
37
|
+
# database.yml
|
38
|
+
m.template "configs/databases/#{options[:db]}.yml", "config/database.yml", :assigns => {
|
39
|
+
:app_name => @app_name,
|
40
|
+
:socket => options[:db] == "mysql" ? mysql_socket_location : nil
|
41
|
+
}
|
42
|
+
|
43
|
+
# mom.yml
|
44
|
+
m.template "configs/mom.yml", "config/mom.yml"
|
45
|
+
|
46
|
+
# settings.yml
|
47
|
+
m.template "configs/settings.yml", "config/settings.yml"
|
48
|
+
|
49
|
+
# boot.rb, needed by some scripts
|
50
|
+
m.file "configs/boot.rb", "config/boot.rb"
|
51
|
+
|
52
|
+
# Environments
|
53
|
+
#m.file "environments/boot.rb", "config/boot.rb"
|
54
|
+
#m.template "environments/environment.rb", "config/environment.rb", :assigns => { :freeze => options[:freeze] }
|
55
|
+
#m.file "environments/production.rb", "config/environments/production.rb"
|
56
|
+
#m.file "environments/development.rb", "config/environments/development.rb"
|
57
|
+
#m.file "environments/test.rb", "config/environments/test.rb"
|
58
|
+
|
59
|
+
# Scripts
|
60
|
+
%w( generate destroy about subscribe ).each do |file|
|
61
|
+
m.file "bin/#{file}", "script/#{file}", script_options
|
62
|
+
end
|
63
|
+
|
64
|
+
# Dispatches
|
65
|
+
m.file "dispatches/dispatch.rb", "public/dispatch.rb", script_options
|
66
|
+
m.file "dispatches/publish.rb", "public/publish.rb", script_options
|
67
|
+
|
68
|
+
# Docs
|
69
|
+
m.file "doc/README_FOR_APP", "doc/README_FOR_APP"
|
70
|
+
|
71
|
+
# Logs
|
72
|
+
%w(server production development test).each { |file|
|
73
|
+
m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666
|
74
|
+
}
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
protected
|
79
|
+
def banner
|
80
|
+
"Usage: #{$0} /path/to/your/app [options]"
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_options!(opt)
|
84
|
+
opt.separator ''
|
85
|
+
opt.separator 'Options:'
|
86
|
+
opt.on("-r", "--ruby=path", String,
|
87
|
+
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
|
88
|
+
"Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
|
89
|
+
|
90
|
+
opt.on("-d", "--database=name", String,
|
91
|
+
"Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite2/sqlite3).",
|
92
|
+
"Default: mysql") { |v| options[:db] = v }
|
93
|
+
|
94
|
+
#opt.on("-f", "--freeze",
|
95
|
+
# "Freeze Rails in vendor/rails from the gems generating the skeleton",
|
96
|
+
# "Default: false") { |v| options[:freeze] = v }
|
97
|
+
end
|
98
|
+
|
99
|
+
def mysql_socket_location
|
100
|
+
MYSQL_SOCKET_LOCATIONS.find { |f| File.exists?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
# Installation skeleton. Intermediate directories are automatically
|
105
|
+
# created so don't sweat their absence here.
|
106
|
+
BASEDIRS = %w(
|
107
|
+
app/adaptors
|
108
|
+
app/messages
|
109
|
+
app/models
|
110
|
+
config/environments
|
111
|
+
db
|
112
|
+
doc
|
113
|
+
lib
|
114
|
+
lib/tasks
|
115
|
+
log
|
116
|
+
public
|
117
|
+
script
|
118
|
+
test/fixtures
|
119
|
+
test/functional
|
120
|
+
test/mocks/development
|
121
|
+
test/mocks/test
|
122
|
+
test/unit
|
123
|
+
)
|
124
|
+
|
125
|
+
MYSQL_SOCKET_LOCATIONS = [
|
126
|
+
"/tmp/mysql.sock", # default
|
127
|
+
"/var/run/mysqld/mysqld.sock", # debian/gentoo
|
128
|
+
"/var/tmp/mysql.sock", # freebsd
|
129
|
+
"/var/lib/mysql/mysql.sock", # fedora
|
130
|
+
"/opt/local/lib/mysql/mysql.sock", # fedora
|
131
|
+
"/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
|
132
|
+
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
|
133
|
+
"/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
|
134
|
+
"/opt/lampp/var/mysql/mysql.sock" # xampp for linux
|
135
|
+
]
|
136
|
+
end
|
metadata
CHANGED
@@ -1,9 +1,9 @@
|
|
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: adaptation
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
6
|
+
version: 0.0.3
|
7
7
|
date: 2007-04-30 00:00:00 +02:00
|
8
8
|
summary: Framework to facilitate web-application interaction.
|
9
9
|
require_paths:
|
@@ -15,7 +15,7 @@ description: Adaptation is a framework for building "adaptors" for web-applicati
|
|
15
15
|
autorequire: adaptation
|
16
16
|
default_executable: adaptation
|
17
17
|
bindir: bin
|
18
|
-
has_rdoc:
|
18
|
+
has_rdoc: false
|
19
19
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">"
|
@@ -29,76 +29,88 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- Xavi Vila Morell
|
31
31
|
files:
|
32
|
+
- bin/generate
|
32
33
|
- bin/destroy
|
33
34
|
- bin/adaptation
|
34
35
|
- bin/about
|
35
|
-
- bin/
|
36
|
+
- bin/breakpointer
|
37
|
+
- bin/mom~
|
36
38
|
- bin/mom
|
37
|
-
- bin/
|
38
|
-
- lib/commands
|
39
|
-
- lib/adaptation
|
39
|
+
- bin/subscribe
|
40
40
|
- lib/rails_generator.rb
|
41
|
+
- lib/adaptation
|
42
|
+
- lib/binding_of_caller.rb
|
43
|
+
- lib/breakpoint_client.rb
|
44
|
+
- lib/adaptation.rb
|
41
45
|
- lib/commands.rb
|
46
|
+
- lib/breakpoint.rb
|
47
|
+
- lib/commands
|
42
48
|
- lib/ruby_version_check.rb
|
43
|
-
- lib/adaptation.rb
|
44
49
|
- lib/rails_generator
|
45
|
-
- lib/commands/about.rb
|
46
|
-
- lib/commands/mom.rb
|
47
|
-
- lib/commands/destroy.rb
|
48
|
-
- lib/commands/generate.rb
|
49
|
-
- lib/commands/subscribe.rb
|
50
50
|
- lib/adaptation/version.rb
|
51
|
-
- lib/adaptation/
|
51
|
+
- lib/adaptation/mom.rb~
|
52
52
|
- lib/adaptation/message.rb
|
53
|
-
- lib/adaptation/mom.rb
|
54
53
|
- lib/adaptation/adaptor.rb
|
55
|
-
- lib/adaptation/
|
54
|
+
- lib/adaptation/druby_subscriber.rb
|
55
|
+
- lib/adaptation/druby_subscriber.rb~
|
56
|
+
- lib/adaptation/mom.rb
|
56
57
|
- lib/adaptation/test
|
58
|
+
- lib/adaptation/oapdaemon.rb~
|
59
|
+
- lib/adaptation/base.rb
|
57
60
|
- lib/adaptation/test/test_help.rb
|
58
|
-
- lib/
|
59
|
-
- lib/
|
61
|
+
- lib/commands/mom.rb.descartat
|
62
|
+
- lib/commands/subscribe.rb~
|
63
|
+
- lib/commands/destroy.rb
|
64
|
+
- lib/commands/subscribe.rb
|
65
|
+
- lib/commands/about.rb
|
66
|
+
- lib/commands/breakpointer.rb
|
67
|
+
- lib/commands/generate.rb
|
60
68
|
- lib/rails_generator/lookup.rb
|
69
|
+
- lib/rails_generator/generators
|
61
70
|
- lib/rails_generator/commands.rb
|
62
|
-
- lib/rails_generator/simple_logger.rb
|
63
71
|
- lib/rails_generator/scripts.rb
|
64
|
-
- lib/rails_generator/
|
65
|
-
- lib/rails_generator/generated_attribute.rb
|
72
|
+
- lib/rails_generator/simple_logger.rb
|
66
73
|
- lib/rails_generator/options.rb
|
67
|
-
- lib/rails_generator/generators
|
68
74
|
- lib/rails_generator/spec.rb
|
69
|
-
- lib/rails_generator/
|
70
|
-
- lib/rails_generator/scripts
|
71
|
-
- lib/rails_generator/
|
75
|
+
- lib/rails_generator/manifest.rb
|
76
|
+
- lib/rails_generator/scripts
|
77
|
+
- lib/rails_generator/generated_attribute.rb
|
78
|
+
- lib/rails_generator/base.rb
|
72
79
|
- lib/rails_generator/generators/components
|
73
80
|
- lib/rails_generator/generators/applications
|
74
81
|
- lib/rails_generator/generators/components/model
|
75
|
-
- lib/rails_generator/generators/components/message
|
76
82
|
- lib/rails_generator/generators/components/adaptor
|
83
|
+
- lib/rails_generator/generators/components/message
|
77
84
|
- lib/rails_generator/generators/components/model/USAGE
|
78
85
|
- lib/rails_generator/generators/components/model/model_generator.rb
|
79
86
|
- lib/rails_generator/generators/components/model/templates
|
80
87
|
- lib/rails_generator/generators/components/model/templates/unit_test.rb
|
81
|
-
- lib/rails_generator/generators/components/model/templates/migration.rb
|
82
|
-
- lib/rails_generator/generators/components/model/templates/model.rb
|
83
88
|
- lib/rails_generator/generators/components/model/templates/fixtures.yml
|
84
|
-
- lib/rails_generator/generators/components/
|
85
|
-
- lib/rails_generator/generators/components/
|
86
|
-
- lib/rails_generator/generators/components/message/templates
|
87
|
-
- lib/rails_generator/generators/components/message/templates/unit_test.rb
|
88
|
-
- lib/rails_generator/generators/components/message/templates/message.rb
|
89
|
-
- lib/rails_generator/generators/components/message/templates/fixtures.xml
|
89
|
+
- lib/rails_generator/generators/components/model/templates/model.rb
|
90
|
+
- lib/rails_generator/generators/components/model/templates/migration.rb
|
90
91
|
- lib/rails_generator/generators/components/adaptor/USAGE
|
91
92
|
- lib/rails_generator/generators/components/adaptor/adaptor_generator.rb
|
92
93
|
- lib/rails_generator/generators/components/adaptor/templates
|
93
|
-
- lib/rails_generator/generators/components/adaptor/templates/functional_test.rb
|
94
94
|
- lib/rails_generator/generators/components/adaptor/templates/adaptor.rb
|
95
|
+
- lib/rails_generator/generators/components/adaptor/templates/functional_test.rb
|
96
|
+
- lib/rails_generator/generators/components/message/USAGE
|
97
|
+
- lib/rails_generator/generators/components/message/message_generator.rb
|
98
|
+
- lib/rails_generator/generators/components/message/templates
|
99
|
+
- lib/rails_generator/generators/components/message/templates/message.rb
|
100
|
+
- lib/rails_generator/generators/components/message/templates/unit_test.rb
|
101
|
+
- lib/rails_generator/generators/components/message/templates/fixtures.xml
|
95
102
|
- lib/rails_generator/generators/applications/app
|
96
103
|
- lib/rails_generator/generators/applications/app/USAGE
|
104
|
+
- lib/rails_generator/generators/applications/app/app_generator.rb~
|
97
105
|
- lib/rails_generator/generators/applications/app/app_generator.rb
|
98
|
-
-
|
106
|
+
- lib/rails_generator/scripts/destroy.rb
|
107
|
+
- lib/rails_generator/scripts/update.rb
|
108
|
+
- lib/rails_generator/scripts/generate.rb
|
99
109
|
- helpers/publish.rb
|
110
|
+
- helpers/test_helper.rb
|
100
111
|
- doc/README_FOR_APP
|
101
112
|
- configs/databases
|
113
|
+
- configs/settings.yml
|
102
114
|
- configs/empty.log
|
103
115
|
- configs/boot.rb
|
104
116
|
- configs/mom.yml
|
@@ -117,6 +129,7 @@ extra_rdoc_files:
|
|
117
129
|
- README
|
118
130
|
executables:
|
119
131
|
- adaptation
|
132
|
+
- mom
|
120
133
|
extensions: []
|
121
134
|
|
122
135
|
requirements: []
|
data/lib/adaptation/oapdaemon.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'drb'
|
2
|
-
require 'yaml'
|
3
|
-
|
4
|
-
module Adaptation
|
5
|
-
|
6
|
-
class Oapdaemon
|
7
|
-
|
8
|
-
def initialize subscriber_uri, mom_uri, topics
|
9
|
-
@subscriber_uri = subscriber_uri
|
10
|
-
@mom_uri = mom_uri
|
11
|
-
@topics = topics
|
12
|
-
end
|
13
|
-
|
14
|
-
def call_adaptor message, topic
|
15
|
-
if ( (@topics.include?(topic)) or (@topics == "all") )
|
16
|
-
system("ruby public/dispatch.rb #{message}")
|
17
|
-
end
|
18
|
-
puts "#{topic} => #{message}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def subscription_result subscribed
|
22
|
-
if subscribed
|
23
|
-
puts "Subscribed to mom (#{@mom_uri}). Listening at #{@subscriber_uri}"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def start
|
28
|
-
DRb.start_service(@subscriber_uri, self)
|
29
|
-
|
30
|
-
mom = DRbObject.new(nil, @mom_uri)
|
31
|
-
mom.subscribe @subscriber_uri
|
32
|
-
|
33
|
-
DRb.thread.join # Don't exit just yet!
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
File without changes
|