seamless 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/seamless +36 -0
- data/lib/seamless.rb +70 -0
- data/lib/seamless/active_record_extension.rb +11 -0
- data/lib/seamless/dispatcher.rb +45 -0
- data/lib/seamless/message_broker.rb +12 -0
- data/lib/seamless/message_broker_controller.rb +11 -0
- data/lib/seamless/messagebroker/inmemory_message_broker.rb +45 -0
- data/lib/seamless/migration.rb +8 -0
- data/lib/seamless/model.rb +94 -0
- data/lib/seamless/service.rb +186 -0
- data/seamless/seamless_generator.rb +181 -0
- data/seamless/templates/README +24 -0
- data/seamless/templates/admin.html +166 -0
- data/seamless/templates/application.rb +7 -0
- data/seamless/templates/css/global.css +333 -0
- data/seamless/templates/css/seamless-admin.css +281 -0
- data/seamless/templates/css/seamless.css +632 -0
- data/seamless/templates/environment.rb +65 -0
- data/seamless/templates/generate +25 -0
- data/seamless/templates/images/arch.png +0 -0
- data/seamless/templates/images/arrow_undo.png +0 -0
- data/seamless/templates/images/cell_phone.png +0 -0
- data/seamless/templates/images/confirm.png +0 -0
- data/seamless/templates/images/deny.png +0 -0
- data/seamless/templates/images/dialog_close.gif +0 -0
- data/seamless/templates/images/dialog_close_hover.gif +0 -0
- data/seamless/templates/images/email.png +0 -0
- data/seamless/templates/images/exclamation.png +0 -0
- data/seamless/templates/images/indicator.gif +0 -0
- data/seamless/templates/images/indicator2.gif +0 -0
- data/seamless/templates/images/seamless.gif +0 -0
- data/seamless/templates/images/shadow.gif +0 -0
- data/seamless/templates/images/shadowAlpha.png +0 -0
- data/seamless/templates/images/small_star.png +0 -0
- data/seamless/templates/images/table_add.png +0 -0
- data/seamless/templates/images/table_delete.png +0 -0
- data/seamless/templates/images/table_edit.png +0 -0
- data/seamless/templates/images/table_go.png +0 -0
- data/seamless/templates/images/table_refresh.png +0 -0
- data/seamless/templates/images/tag.png +0 -0
- data/seamless/templates/images/warning.png +0 -0
- data/seamless/templates/images/wizard.gif +0 -0
- data/seamless/templates/images/work_phone.png +0 -0
- data/seamless/templates/index.html +171 -0
- data/seamless/templates/js/seamless-admin.js +255 -0
- data/seamless/templates/js/seamless.js +2755 -0
- data/seamless/templates/message_broker.rb +6 -0
- data/seamless/templates/message_broker_helper.rb +2 -0
- data/seamless/templates/robots.txt +2 -0
- data/seamless/templates/routes.rb +18 -0
- data/seamless/templates/seamless.xml +5 -0
- data/seamless/templates/server +4 -0
- data/seamless/templates/test_service.rb +13 -0
- data/service/USAGE +21 -0
- data/service/service_generator.rb +59 -0
- data/service/templates/service.rb +14 -0
- metadata +122 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
# The priority is based upon order of creation: first created -> highest priority.
|
3
|
+
|
4
|
+
# Sample of regular route:
|
5
|
+
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
|
6
|
+
# Keep in mind you can assign values other than :controller and :action
|
7
|
+
|
8
|
+
# Sample of named route:
|
9
|
+
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
|
10
|
+
# This route can be invoked with purchase_url(:id => product.id)
|
11
|
+
|
12
|
+
# You can have the root of your site routed by hooking up ''
|
13
|
+
# -- just remember to delete public/index.html.
|
14
|
+
# map.connect '', :controller => "welcome"
|
15
|
+
|
16
|
+
# Install the seamless messagebroker
|
17
|
+
map.connect 'messagebroker', :controller => 'message_broker'
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
class TestService < Seamless::Service
|
3
|
+
|
4
|
+
handles_message 'seamless.test.message.request', :testMessage, 'seamless.test.message'
|
5
|
+
|
6
|
+
def testMessage(request,message)
|
7
|
+
p "received message: #{message.inspect}"
|
8
|
+
msg = message["message"]
|
9
|
+
{"message"=>"I received from you: #{msg}","success"=>true}
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
data/service/USAGE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Description:
|
2
|
+
The generator creates stubs for a new Seam(less) Service.
|
3
|
+
|
4
|
+
The generator takes a class name, message type and method name as arguments.
|
5
|
+
The messagehandler name may be given in CamelCase or under_score and should
|
6
|
+
not be suffixed with 'Service'.
|
7
|
+
|
8
|
+
The generator creates a service class in app/services.
|
9
|
+
|
10
|
+
./script/generate service <ServiceClassName> <ServiceMessageRequest> <ServiceMethod> [ServiceMessageResponse]
|
11
|
+
|
12
|
+
The following are the arguments:
|
13
|
+
|
14
|
+
ServiceClassName - name of the service class
|
15
|
+
ServiceMessageRequest - message request type
|
16
|
+
ServiceMethod - method name to call
|
17
|
+
|
18
|
+
Example:
|
19
|
+
./script/generate service CreditCard service.creditcard.charge.request charge [service.creditcard.charge.response]
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'action_controller'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
class ServiceGenerator < Rails::Generator::NamedBase
|
5
|
+
|
6
|
+
def initialize(runtime_args, runtime_options = {})
|
7
|
+
super
|
8
|
+
usage if args.empty?
|
9
|
+
|
10
|
+
@messagename = args.shift rescue usage
|
11
|
+
@messagetype = args.shift rescue usage
|
12
|
+
@messagefunc = args.shift rescue usage
|
13
|
+
@responsemsg = args.shift rescue nil
|
14
|
+
|
15
|
+
usage if @messagename==nil
|
16
|
+
usage if @messagetype==nil
|
17
|
+
usage if @messagefunc==nil
|
18
|
+
|
19
|
+
# trim off : if they use it
|
20
|
+
if @messagefunc[0] == 58
|
21
|
+
@messagefunc = @messagefunc.slice(1..@messagefunc.length)
|
22
|
+
end
|
23
|
+
|
24
|
+
camel = @messagename.camelize
|
25
|
+
under = camel.underscore
|
26
|
+
|
27
|
+
@messageFile = under.downcase + '_service.rb'
|
28
|
+
@messageClass = camel + 'Service'
|
29
|
+
end
|
30
|
+
|
31
|
+
def usage_message
|
32
|
+
File.read(File.join(File.dirname(__FILE__), 'USAGE')) rescue ''
|
33
|
+
end
|
34
|
+
|
35
|
+
def manifest
|
36
|
+
record do |m|
|
37
|
+
# Check for class naming collisions.
|
38
|
+
m.class_collisions @messageClass
|
39
|
+
|
40
|
+
# make sure we have a services dir
|
41
|
+
m.directory File.join('app/services', class_path)
|
42
|
+
|
43
|
+
responsetype = ''
|
44
|
+
response = ''
|
45
|
+
|
46
|
+
if @responsemsg
|
47
|
+
responsetype = ", '#{@responsemsg}'"
|
48
|
+
response = '{"success"=>true}'
|
49
|
+
end
|
50
|
+
|
51
|
+
# message handler template
|
52
|
+
m.template 'service/templates/service.rb',
|
53
|
+
File.join('app/services',
|
54
|
+
class_path,
|
55
|
+
"#{@messageFile}"),
|
56
|
+
:assigns => {'messageclass'=>@messageClass, 'messagetype'=>@messagetype, 'messagefunc'=>@messagefunc, 'responsetype'=>responsetype, 'response'=>response}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
class <%= messageclass %> < Seamless::Service
|
3
|
+
|
4
|
+
handles_message '<%= messagetype %>', :<%= messagefunc %><%= responsetype %>
|
5
|
+
|
6
|
+
def <%= messagefunc %>(request,message)
|
7
|
+
|
8
|
+
# TODO: implement service code
|
9
|
+
p "received message #{type} with #{message.inspect}"
|
10
|
+
|
11
|
+
<%= response %>
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
4
|
+
name: seamless
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-05-19 00:00:00 -04:00
|
8
|
+
summary: Seam(less) on Rails. Seam(less) is a web2.0, ajax web application framework by Hakano.org
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: jhaynie@hakano.com
|
12
|
+
homepage: http://www.hakano.org
|
13
|
+
rubyforge_project:
|
14
|
+
description:
|
15
|
+
autorequire:
|
16
|
+
default_executable: seamless
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: false
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Jeff Haynie
|
31
|
+
files:
|
32
|
+
- lib/seamless.rb
|
33
|
+
- lib/seamless/active_record_extension.rb
|
34
|
+
- lib/seamless/dispatcher.rb
|
35
|
+
- lib/seamless/message_broker.rb
|
36
|
+
- lib/seamless/message_broker_controller.rb
|
37
|
+
- lib/seamless/migration.rb
|
38
|
+
- lib/seamless/model.rb
|
39
|
+
- lib/seamless/service.rb
|
40
|
+
- lib/seamless/messagebroker/inmemory_message_broker.rb
|
41
|
+
- service/service_generator.rb
|
42
|
+
- service/templates
|
43
|
+
- service/USAGE
|
44
|
+
- service/templates/service.rb
|
45
|
+
- seamless/seamless_generator.rb
|
46
|
+
- seamless/templates/admin.html
|
47
|
+
- seamless/templates/application.rb
|
48
|
+
- seamless/templates/css
|
49
|
+
- seamless/templates/environment.rb
|
50
|
+
- seamless/templates/generate
|
51
|
+
- seamless/templates/images
|
52
|
+
- seamless/templates/index.html
|
53
|
+
- seamless/templates/js
|
54
|
+
- seamless/templates/message_broker.rb
|
55
|
+
- seamless/templates/message_broker_helper.rb
|
56
|
+
- seamless/templates/README
|
57
|
+
- seamless/templates/robots.txt
|
58
|
+
- seamless/templates/routes.rb
|
59
|
+
- seamless/templates/seamless.xml
|
60
|
+
- seamless/templates/server
|
61
|
+
- seamless/templates/test_service.rb
|
62
|
+
- seamless/templates/css/global.css
|
63
|
+
- seamless/templates/css/seamless-admin.css
|
64
|
+
- seamless/templates/css/seamless.css
|
65
|
+
- seamless/templates/js/seamless-admin.js
|
66
|
+
- seamless/templates/js/seamless.js
|
67
|
+
- seamless/templates/images/arch.png
|
68
|
+
- seamless/templates/images/arrow_undo.png
|
69
|
+
- seamless/templates/images/cell_phone.png
|
70
|
+
- seamless/templates/images/confirm.png
|
71
|
+
- seamless/templates/images/deny.png
|
72
|
+
- seamless/templates/images/dialog_close.gif
|
73
|
+
- seamless/templates/images/dialog_close_hover.gif
|
74
|
+
- seamless/templates/images/email.png
|
75
|
+
- seamless/templates/images/exclamation.png
|
76
|
+
- seamless/templates/images/indicator.gif
|
77
|
+
- seamless/templates/images/indicator2.gif
|
78
|
+
- seamless/templates/images/seamless.gif
|
79
|
+
- seamless/templates/images/shadow.gif
|
80
|
+
- seamless/templates/images/shadowAlpha.png
|
81
|
+
- seamless/templates/images/small_star.png
|
82
|
+
- seamless/templates/images/table_add.png
|
83
|
+
- seamless/templates/images/table_delete.png
|
84
|
+
- seamless/templates/images/table_edit.png
|
85
|
+
- seamless/templates/images/table_go.png
|
86
|
+
- seamless/templates/images/table_refresh.png
|
87
|
+
- seamless/templates/images/tag.png
|
88
|
+
- seamless/templates/images/warning.png
|
89
|
+
- seamless/templates/images/wizard.gif
|
90
|
+
- seamless/templates/images/work_phone.png
|
91
|
+
- bin/seamless
|
92
|
+
test_files: []
|
93
|
+
|
94
|
+
rdoc_options: []
|
95
|
+
|
96
|
+
extra_rdoc_files: []
|
97
|
+
|
98
|
+
executables:
|
99
|
+
- seamless
|
100
|
+
extensions: []
|
101
|
+
|
102
|
+
requirements: []
|
103
|
+
|
104
|
+
dependencies:
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: rails
|
107
|
+
version_requirement:
|
108
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 1.2.3
|
113
|
+
version:
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: json
|
116
|
+
version_requirement:
|
117
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
118
|
+
requirements:
|
119
|
+
- - ">="
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: 0.4.3
|
122
|
+
version:
|