backlog 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Rakefile +2 -1
- data/app/controllers/application.rb +55 -8
- data/app/controllers/groups_controller.rb +62 -0
- data/app/controllers/periods_controller.rb +13 -55
- data/app/controllers/tasks_controller.rb +9 -5
- data/app/controllers/works_controller.rb +43 -6
- data/app/helpers/application_helper.rb +20 -2
- data/app/helpers/groups_helper.rb +2 -0
- data/app/models/backlog.rb +19 -10
- data/app/models/estimate.rb +2 -1
- data/app/models/group.rb +11 -0
- data/app/models/party.rb +3 -0
- data/app/models/period.rb +43 -6
- data/app/models/task.rb +27 -14
- data/app/models/user.rb +37 -8
- data/app/models/work.rb +4 -6
- data/app/views/backlogs/_name_list.rhtml +5 -0
- data/app/views/backlogs/show.rhtml +4 -4
- data/app/views/groups/_form.rhtml +7 -0
- data/app/views/groups/edit.rhtml +31 -0
- data/app/views/groups/list.rhtml +27 -0
- data/app/views/groups/new.rhtml +8 -0
- data/app/views/layouts/wide.rhtml +2 -2
- data/app/views/periods/_burn_down_chart.rhtml +1 -1
- data/app/views/periods/_form.rhtml +13 -9
- data/app/views/periods/_show_active.rhtml +6 -12
- data/app/views/periods/_title.rhtml +4 -5
- data/app/views/periods/edit.rhtml +1 -1
- data/app/views/periods/new.rhtml +1 -1
- data/app/views/periods/show.rhtml +10 -6
- data/app/views/tasks/_backlog_header.rhtml +22 -0
- data/app/views/tasks/_description_list.rhtml +5 -0
- data/app/views/tasks/_form.rhtml +26 -7
- data/app/views/tasks/_task.rhtml +4 -4
- data/app/views/tasks/edit.rhtml +2 -3
- data/app/views/tasks/list_started.rhtml +1 -0
- data/app/views/tasks/new.rhtml +2 -2
- data/app/views/works/_buttons.rhtml +3 -0
- data/app/views/works/_form.rhtml +15 -10
- data/app/views/works/daily_work_sheet.rhtml +30 -18
- data/app/views/works/edit.rhtml +4 -4
- data/app/views/works/list.rhtml +2 -2
- data/app/views/works/new.rhtml +3 -2
- data/app/views/works/weekly_work_sheet.rhtml +2 -2
- data/bin/backlog +2 -0
- data/bin/backlog_init.d_kubosch_production +27 -0
- data/bin/copy_production2development.rb +33 -0
- data/config/database.yml +13 -7
- data/config/deploy_kubosch.rb +1 -0
- data/config/environment.rb +2 -0
- data/config/environments/development_mysql.rb +27 -0
- data/config/environments/kubosch_production_mysql.rb +21 -0
- data/config/routes.rb +1 -1
- data/db/migrate/{001_tasks.rb → 001_create_tasks.rb} +1 -1
- data/db/migrate/{002_backlogs.rb → 002_create_backlogs.rb} +2 -2
- data/db/migrate/003_add_estimation_points.rb +1 -1
- data/db/migrate/004_add_period.rb +2 -2
- data/db/migrate/013_create_estimates.rb +1 -1
- data/db/migrate/015_add_user_option.rb +9 -5
- data/db/migrate/017_insert_datek_projects.rb +13 -10
- data/db/migrate/018_create_groups.rb +115 -0
- data/db/schema.rb +72 -12
- data/lang/en.yaml +7 -0
- data/lang/no.yaml +7 -0
- data/lib/big_decimal_yaml_fix.rb +27 -0
- data/lib/class_table_inheritance.rb +163 -0
- data/lib/tasks/backup.rake +92 -0
- data/public/images/person.org.png +0 -0
- data/public/images/person.png +0 -0
- data/public/stylesheets/backlog.css +3 -1
- data/public/stylesheets/mwrt002.css +1 -1
- data/test/fixtures/groups.yml +6 -0
- data/test/fixtures/parties.yml +31 -0
- data/test/fixtures/periods.yml +2 -2
- data/test/fixtures/tasks.yml +2 -0
- data/test/fixtures/users.yml +6 -6
- data/test/functional/backlogs_controller_test.rb +1 -1
- data/test/functional/groups_controller_test.rb +120 -0
- data/test/functional/periods_controller_test.rb +1 -1
- data/test/functional/tasks_controller_test.rb +16 -1
- data/test/functional/user_controller_test.rb +8 -2
- data/test/test_helper.rb +5 -0
- data/test/unit/big_decimal_yaml_fix_test.rb +14 -0
- data/test/unit/estimate_test.rb +1 -1
- data/test/unit/group_test.rb +10 -0
- data/test/unit/user_test.rb +56 -44
- data/tmp/sessions/ruby_sess.22dec3e9df47fb4e +0 -0
- data/tmp/sessions/ruby_sess.8037e0ab58cbcf1a +0 -0
- data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +35 -0
- data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
- data/vendor/rails/{actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml → railties/configs/empty.log} +0 -0
- metadata +36 -105
- data/backlog.gemspec +0 -21
- data/vendor/rails/actionwebservice/CHANGELOG +0 -265
- data/vendor/rails/actionwebservice/MIT-LICENSE +0 -21
- data/vendor/rails/actionwebservice/README +0 -364
- data/vendor/rails/actionwebservice/Rakefile +0 -171
- data/vendor/rails/actionwebservice/TODO +0 -32
- data/vendor/rails/actionwebservice/examples/googlesearch/README +0 -143
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +0 -57
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +0 -108
- data/vendor/rails/actionwebservice/examples/googlesearch/delegated/search_controller.rb +0 -7
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/google_search_api.rb +0 -50
- data/vendor/rails/actionwebservice/examples/googlesearch/direct/search_controller.rb +0 -58
- data/vendor/rails/actionwebservice/examples/metaWeblog/README +0 -17
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +0 -60
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +0 -34
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +0 -67
- data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +0 -48
- data/vendor/rails/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +0 -16
- data/vendor/rails/actionwebservice/install.rb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service.rb +0 -66
- data/vendor/rails/actionwebservice/lib/action_web_service/api.rb +0 -301
- data/vendor/rails/actionwebservice/lib/action_web_service/base.rb +0 -42
- data/vendor/rails/actionwebservice/lib/action_web_service/casting.rb +0 -138
- data/vendor/rails/actionwebservice/lib/action_web_service/client.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/client/base.rb +0 -28
- data/vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb +0 -113
- data/vendor/rails/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +0 -58
- data/vendor/rails/actionwebservice/lib/action_web_service/container.rb +0 -3
- data/vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb +0 -93
- data/vendor/rails/actionwebservice/lib/action_web_service/container/delegated_container.rb +0 -86
- data/vendor/rails/actionwebservice/lib/action_web_service/container/direct_container.rb +0 -69
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher.rb +0 -2
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +0 -207
- data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +0 -379
- data/vendor/rails/actionwebservice/lib/action_web_service/invocation.rb +0 -202
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol.rb +0 -4
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/abstract.rb +0 -112
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/discovery.rb +0 -37
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +0 -176
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +0 -235
- data/vendor/rails/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +0 -122
- data/vendor/rails/actionwebservice/lib/action_web_service/scaffolding.rb +0 -283
- data/vendor/rails/actionwebservice/lib/action_web_service/struct.rb +0 -68
- data/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +0 -26
- data/vendor/rails/actionwebservice/lib/action_web_service/support/signature_types.rb +0 -226
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb +0 -65
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb +0 -6
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb +0 -29
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb +0 -30
- data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +0 -0
- data/vendor/rails/actionwebservice/lib/action_web_service/test_invoke.rb +0 -110
- data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +0 -9
- data/vendor/rails/actionwebservice/setup.rb +0 -1379
- data/vendor/rails/actionwebservice/test/abstract_client.rb +0 -183
- data/vendor/rails/actionwebservice/test/abstract_dispatcher.rb +0 -551
- data/vendor/rails/actionwebservice/test/abstract_unit.rb +0 -45
- data/vendor/rails/actionwebservice/test/api_test.rb +0 -102
- data/vendor/rails/actionwebservice/test/apis/auto_load_api.rb +0 -3
- data/vendor/rails/actionwebservice/test/apis/broken_auto_load_api.rb +0 -2
- data/vendor/rails/actionwebservice/test/base_test.rb +0 -42
- data/vendor/rails/actionwebservice/test/casting_test.rb +0 -86
- data/vendor/rails/actionwebservice/test/client_soap_test.rb +0 -153
- data/vendor/rails/actionwebservice/test/client_xmlrpc_test.rb +0 -152
- data/vendor/rails/actionwebservice/test/container_test.rb +0 -73
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_soap_test.rb +0 -137
- data/vendor/rails/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +0 -59
- data/vendor/rails/actionwebservice/test/fixtures/db_definitions/mysql.sql +0 -8
- data/vendor/rails/actionwebservice/test/fixtures/users.yml +0 -12
- data/vendor/rails/actionwebservice/test/gencov +0 -3
- data/vendor/rails/actionwebservice/test/invocation_test.rb +0 -185
- data/vendor/rails/actionwebservice/test/run +0 -6
- data/vendor/rails/actionwebservice/test/scaffolded_controller_test.rb +0 -146
- data/vendor/rails/actionwebservice/test/struct_test.rb +0 -52
- data/vendor/rails/actionwebservice/test/test_invoke_test.rb +0 -112
@@ -1,21 +0,0 @@
|
|
1
|
-
Copyright (C) 2005 Leon Breedt
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
-
|
@@ -1,364 +0,0 @@
|
|
1
|
-
= Action Web Service -- Serving APIs on rails
|
2
|
-
|
3
|
-
Action Web Service provides a way to publish interoperable web service APIs with
|
4
|
-
Rails without spending a lot of time delving into protocol details.
|
5
|
-
|
6
|
-
|
7
|
-
== Features
|
8
|
-
|
9
|
-
* SOAP RPC protocol support
|
10
|
-
* Dynamic WSDL generation for APIs
|
11
|
-
* XML-RPC protocol support
|
12
|
-
* Clients that use the same API definitions as the server for
|
13
|
-
easy interoperability with other Action Web Service based applications
|
14
|
-
* Type signature hints to improve interoperability with static languages
|
15
|
-
* Active Record model class support in signatures
|
16
|
-
|
17
|
-
|
18
|
-
== Defining your APIs
|
19
|
-
|
20
|
-
You specify the methods you want to make available as API methods in an
|
21
|
-
ActionWebService::API::Base derivative, and then specify this API
|
22
|
-
definition class wherever you want to use that API.
|
23
|
-
|
24
|
-
The implementation of the methods is done separately from the API
|
25
|
-
specification.
|
26
|
-
|
27
|
-
|
28
|
-
==== Method name inflection
|
29
|
-
|
30
|
-
Action Web Service will camelcase the method names according to Rails Inflector
|
31
|
-
rules for the API visible to public callers. What this means, for example,
|
32
|
-
is that the method names in generated WSDL will be camelcased, and callers will
|
33
|
-
have to supply the camelcased name in their requests for the request to
|
34
|
-
succeed.
|
35
|
-
|
36
|
-
If you do not desire this behaviour, you can turn it off with the
|
37
|
-
ActionWebService::API::Base +inflect_names+ option.
|
38
|
-
|
39
|
-
|
40
|
-
==== Inflection examples
|
41
|
-
|
42
|
-
:add => Add
|
43
|
-
:find_all => FindAll
|
44
|
-
|
45
|
-
|
46
|
-
==== Disabling inflection
|
47
|
-
|
48
|
-
class PersonAPI < ActionWebService::API::Base
|
49
|
-
inflect_names false
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
==== API definition example
|
54
|
-
|
55
|
-
class PersonAPI < ActionWebService::API::Base
|
56
|
-
api_method :add, :expects => [:string, :string, :bool], :returns => [:int]
|
57
|
-
api_method :remove, :expects => [:int], :returns => [:bool]
|
58
|
-
end
|
59
|
-
|
60
|
-
==== API usage example
|
61
|
-
|
62
|
-
class PersonController < ActionController::Base
|
63
|
-
web_service_api PersonAPI
|
64
|
-
|
65
|
-
def add
|
66
|
-
end
|
67
|
-
|
68
|
-
def remove
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
== Publishing your APIs
|
74
|
-
|
75
|
-
Action Web Service uses Action Pack to process protocol requests. There are two
|
76
|
-
modes of dispatching protocol requests, _Direct_, and _Delegated_.
|
77
|
-
|
78
|
-
|
79
|
-
=== Direct dispatching
|
80
|
-
|
81
|
-
This is the default mode. In this mode, public controller instance methods
|
82
|
-
implement the API methods, and parameters are passed through to the methods in
|
83
|
-
accordance with the API specification.
|
84
|
-
|
85
|
-
The return value of the method is sent back as the return value to the
|
86
|
-
caller.
|
87
|
-
|
88
|
-
In this mode, a special <tt>api</tt> action is generated in the target
|
89
|
-
controller to unwrap the protocol request, forward it on to the relevant method
|
90
|
-
and send back the wrapped return value. <em>This action must not be
|
91
|
-
overridden.</em>
|
92
|
-
|
93
|
-
==== Direct dispatching example
|
94
|
-
|
95
|
-
class PersonController < ApplicationController
|
96
|
-
web_service_api PersonAPI
|
97
|
-
|
98
|
-
def add
|
99
|
-
end
|
100
|
-
|
101
|
-
def remove
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
class PersonAPI < ActionWebService::API::Base
|
106
|
-
...
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
For this example, protocol requests for +Add+ and +Remove+ methods sent to
|
111
|
-
<tt>/person/api</tt> will be routed to the controller methods +add+ and +remove+.
|
112
|
-
|
113
|
-
|
114
|
-
=== Delegated dispatching
|
115
|
-
|
116
|
-
This mode can be turned on by setting the +web_service_dispatching_mode+ option
|
117
|
-
in a controller to <tt>:delegated</tt>.
|
118
|
-
|
119
|
-
In this mode, the controller contains one or more web service objects (objects
|
120
|
-
that implement an ActionWebService::API::Base definition). These web service
|
121
|
-
objects are each mapped onto one controller action only.
|
122
|
-
|
123
|
-
==== Delegated dispatching example
|
124
|
-
|
125
|
-
class ApiController < ApplicationController
|
126
|
-
web_service_dispatching_mode :delegated
|
127
|
-
|
128
|
-
web_service :person, PersonService.new
|
129
|
-
end
|
130
|
-
|
131
|
-
class PersonService < ActionWebService::Base
|
132
|
-
web_service_api PersonAPI
|
133
|
-
|
134
|
-
def add
|
135
|
-
end
|
136
|
-
|
137
|
-
def remove
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
class PersonAPI < ActionWebService::API::Base
|
142
|
-
...
|
143
|
-
end
|
144
|
-
|
145
|
-
|
146
|
-
For this example, all protocol requests for +PersonService+ are
|
147
|
-
sent to the <tt>/api/person</tt> action.
|
148
|
-
|
149
|
-
The <tt>/api/person</tt> action is generated when the +web_service+
|
150
|
-
method is called. <em>This action must not be overridden.</em>
|
151
|
-
|
152
|
-
Other controller actions (actions that aren't the target of a +web_service+ call)
|
153
|
-
are ignored for ActionWebService purposes, and can do normal action tasks.
|
154
|
-
|
155
|
-
|
156
|
-
=== Layered dispatching
|
157
|
-
|
158
|
-
This mode can be turned on by setting the +web_service_dispatching_mode+ option
|
159
|
-
in a controller to <tt>:layered</tt>.
|
160
|
-
|
161
|
-
This mode is similar to _delegated_ mode, in that multiple web service objects
|
162
|
-
can be attached to one controller, however, all protocol requests are sent to a
|
163
|
-
single endpoint.
|
164
|
-
|
165
|
-
Use this mode when you want to share code between XML-RPC and SOAP clients,
|
166
|
-
for APIs where the XML-RPC method names have prefixes. An example of such
|
167
|
-
a method name would be <tt>blogger.newPost</tt>.
|
168
|
-
|
169
|
-
|
170
|
-
==== Layered dispatching example
|
171
|
-
|
172
|
-
|
173
|
-
class ApiController < ApplicationController
|
174
|
-
web_service_dispatching_mode :layered
|
175
|
-
|
176
|
-
web_service :mt, MovableTypeService.new
|
177
|
-
web_service :blogger, BloggerService.new
|
178
|
-
web_service :metaWeblog, MetaWeblogService.new
|
179
|
-
end
|
180
|
-
|
181
|
-
class MovableTypeService < ActionWebService::Base
|
182
|
-
...
|
183
|
-
end
|
184
|
-
|
185
|
-
class BloggerService < ActionWebService::Base
|
186
|
-
...
|
187
|
-
end
|
188
|
-
|
189
|
-
class MetaWeblogService < ActionWebService::API::Base
|
190
|
-
...
|
191
|
-
end
|
192
|
-
|
193
|
-
|
194
|
-
For this example, an XML-RPC call for a method with a name like
|
195
|
-
<tt>mt.getCategories</tt> will be sent to the <tt>getCategories</tt>
|
196
|
-
method on the <tt>:mt</tt> service.
|
197
|
-
|
198
|
-
|
199
|
-
== Customizing WSDL generation
|
200
|
-
|
201
|
-
You can customize the names used for the SOAP bindings in the generated
|
202
|
-
WSDL by using the wsdl_service_name option in a controller:
|
203
|
-
|
204
|
-
class WsController < ApplicationController
|
205
|
-
wsdl_service_name 'MyApp'
|
206
|
-
end
|
207
|
-
|
208
|
-
You can also customize the namespace used in the generated WSDL for
|
209
|
-
custom types and message definition types:
|
210
|
-
|
211
|
-
class WsController < ApplicationController
|
212
|
-
wsdl_namespace 'http://my.company.com/app/wsapi'
|
213
|
-
end
|
214
|
-
|
215
|
-
The default namespace used is 'urn:ActionWebService', if you don't supply
|
216
|
-
one.
|
217
|
-
|
218
|
-
|
219
|
-
== ActionWebService and UTF-8
|
220
|
-
|
221
|
-
If you're going to be sending back strings containing non-ASCII UTF-8
|
222
|
-
characters using the <tt>:string</tt> data type, you need to make sure that
|
223
|
-
Ruby is using UTF-8 as the default encoding for its strings.
|
224
|
-
|
225
|
-
The default in Ruby is to use US-ASCII encoding for strings, which causes a string
|
226
|
-
validation check in the Ruby SOAP library to fail and your string to be sent
|
227
|
-
back as a Base-64 value, which may confuse clients that expected strings
|
228
|
-
because of the WSDL.
|
229
|
-
|
230
|
-
Two ways of setting the default string encoding are:
|
231
|
-
|
232
|
-
* Start Ruby using the <tt>-Ku</tt> command-line option to the Ruby executable
|
233
|
-
* Set the <tt>$KCODE</tt> flag in <tt>config/environment.rb</tt> to the
|
234
|
-
string <tt>'UTF8'</tt>
|
235
|
-
|
236
|
-
|
237
|
-
== Testing your APIs
|
238
|
-
|
239
|
-
|
240
|
-
=== Functional testing
|
241
|
-
|
242
|
-
You can perform testing of your APIs by creating a functional test for the
|
243
|
-
controller dispatching the API, and calling #invoke in the test case to
|
244
|
-
perform the invocation.
|
245
|
-
|
246
|
-
Example:
|
247
|
-
|
248
|
-
class PersonApiControllerTest < Test::Unit::TestCase
|
249
|
-
def setup
|
250
|
-
@controller = PersonController.new
|
251
|
-
@request = ActionController::TestRequest.new
|
252
|
-
@response = ActionController::TestResponse.new
|
253
|
-
end
|
254
|
-
|
255
|
-
def test_add
|
256
|
-
result = invoke :remove, 1
|
257
|
-
assert_equal true, result
|
258
|
-
end
|
259
|
-
end
|
260
|
-
|
261
|
-
This example invokes the API method <tt>test</tt>, defined on
|
262
|
-
the PersonController, and returns the result.
|
263
|
-
|
264
|
-
|
265
|
-
=== Scaffolding
|
266
|
-
|
267
|
-
You can also test your APIs with a web browser by attaching scaffolding
|
268
|
-
to the controller.
|
269
|
-
|
270
|
-
Example:
|
271
|
-
|
272
|
-
class PersonController
|
273
|
-
web_service_scaffold :invocation
|
274
|
-
end
|
275
|
-
|
276
|
-
This creates an action named <tt>invocation</tt> on the PersonController.
|
277
|
-
|
278
|
-
Navigating to this action lets you select the method to invoke, supply the parameters,
|
279
|
-
and view the result of the invocation.
|
280
|
-
|
281
|
-
|
282
|
-
== Using the client support
|
283
|
-
|
284
|
-
Action Web Service includes client classes that can use the same API
|
285
|
-
definition as the server. The advantage of this approach is that your client
|
286
|
-
will have the same support for Active Record and structured types as the
|
287
|
-
server, and can just use them directly, and rely on the marshaling to Do The
|
288
|
-
Right Thing.
|
289
|
-
|
290
|
-
*Note*: The client support is intended for communication between Ruby on Rails
|
291
|
-
applications that both use Action Web Service. It may work with other servers, but
|
292
|
-
that is not its intended use, and interoperability can't be guaranteed, especially
|
293
|
-
not for .NET web services.
|
294
|
-
|
295
|
-
Web services protocol specifications are complex, and Action Web Service client
|
296
|
-
support can only be guaranteed to work with a subset.
|
297
|
-
|
298
|
-
|
299
|
-
==== Factory created client example
|
300
|
-
|
301
|
-
class BlogManagerController < ApplicationController
|
302
|
-
web_client_api :blogger, :xmlrpc, 'http://url/to/blog/api/RPC2', :handler_name => 'blogger'
|
303
|
-
end
|
304
|
-
|
305
|
-
class SearchingController < ApplicationController
|
306
|
-
web_client_api :google, :soap, 'http://url/to/blog/api/beta', :service_name => 'GoogleSearch'
|
307
|
-
end
|
308
|
-
|
309
|
-
See ActionWebService::API::ActionController::ClassMethods for more details.
|
310
|
-
|
311
|
-
==== Manually created client example
|
312
|
-
|
313
|
-
class PersonAPI < ActionWebService::API::Base
|
314
|
-
api_method :find_all, :returns => [[Person]]
|
315
|
-
end
|
316
|
-
|
317
|
-
soap_client = ActionWebService::Client::Soap.new(PersonAPI, "http://...")
|
318
|
-
persons = soap_client.find_all
|
319
|
-
|
320
|
-
class BloggerAPI < ActionWebService::API::Base
|
321
|
-
inflect_names false
|
322
|
-
api_method :getRecentPosts, :returns => [[Blog::Post]]
|
323
|
-
end
|
324
|
-
|
325
|
-
blog = ActionWebService::Client::XmlRpc.new(BloggerAPI, "http://.../xmlrpc", :handler_name => "blogger")
|
326
|
-
posts = blog.getRecentPosts
|
327
|
-
|
328
|
-
|
329
|
-
See ActionWebService::Client::Soap and ActionWebService::Client::XmlRpc for more details.
|
330
|
-
|
331
|
-
== Dependencies
|
332
|
-
|
333
|
-
Action Web Service requires that the Action Pack and Active Record are either
|
334
|
-
available to be required immediately or are accessible as GEMs.
|
335
|
-
|
336
|
-
It also requires a version of Ruby that includes SOAP support in the standard
|
337
|
-
library. At least version 1.8.2 final (2004-12-25) of Ruby is recommended; this
|
338
|
-
is the version tested against.
|
339
|
-
|
340
|
-
|
341
|
-
== Download
|
342
|
-
|
343
|
-
The latest Action Web Service version can be downloaded from
|
344
|
-
http://rubyforge.org/projects/actionservice
|
345
|
-
|
346
|
-
|
347
|
-
== Installation
|
348
|
-
|
349
|
-
You can install Action Web Service with the following command.
|
350
|
-
|
351
|
-
% [sudo] ruby setup.rb
|
352
|
-
|
353
|
-
|
354
|
-
== License
|
355
|
-
|
356
|
-
Action Web Service is released under the MIT license.
|
357
|
-
|
358
|
-
|
359
|
-
== Support
|
360
|
-
|
361
|
-
The Ruby on Rails mailing list
|
362
|
-
|
363
|
-
Or, to contact the author, send mail to bitserf@gmail.com
|
364
|
-
|
@@ -1,171 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'rake/rdoctask'
|
5
|
-
require 'rake/packagetask'
|
6
|
-
require 'rake/gempackagetask'
|
7
|
-
require 'rake/contrib/rubyforgepublisher'
|
8
|
-
require 'fileutils'
|
9
|
-
require File.join(File.dirname(__FILE__), 'lib', 'action_web_service', 'version')
|
10
|
-
|
11
|
-
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
12
|
-
PKG_NAME = 'actionwebservice'
|
13
|
-
PKG_VERSION = ActionWebService::VERSION::STRING + PKG_BUILD
|
14
|
-
PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
|
15
|
-
PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
|
16
|
-
|
17
|
-
RELEASE_NAME = "REL #{PKG_VERSION}"
|
18
|
-
|
19
|
-
RUBY_FORGE_PROJECT = "aws"
|
20
|
-
RUBY_FORGE_USER = "webster132"
|
21
|
-
|
22
|
-
desc "Default Task"
|
23
|
-
task :default => [ :test ]
|
24
|
-
|
25
|
-
|
26
|
-
# Run the unit tests
|
27
|
-
Rake::TestTask.new { |t|
|
28
|
-
t.libs << "test"
|
29
|
-
t.test_files = Dir['test/*_test.rb']
|
30
|
-
t.verbose = true
|
31
|
-
}
|
32
|
-
|
33
|
-
SCHEMA_PATH = File.join(File.dirname(__FILE__), *%w(test fixtures db_definitions))
|
34
|
-
|
35
|
-
desc 'Build the MySQL test database'
|
36
|
-
task :build_database do
|
37
|
-
%x( mysqladmin create actionwebservice_unittest )
|
38
|
-
%x( mysql actionwebservice_unittest < #{File.join(SCHEMA_PATH, 'mysql.sql')} )
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
# Generate the RDoc documentation
|
43
|
-
Rake::RDocTask.new { |rdoc|
|
44
|
-
rdoc.rdoc_dir = 'doc'
|
45
|
-
rdoc.title = "Action Web Service -- Web services for Action Pack"
|
46
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
47
|
-
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
48
|
-
rdoc.rdoc_files.include('README')
|
49
|
-
rdoc.rdoc_files.include('CHANGELOG')
|
50
|
-
rdoc.rdoc_files.include('lib/action_web_service.rb')
|
51
|
-
rdoc.rdoc_files.include('lib/action_web_service/*.rb')
|
52
|
-
rdoc.rdoc_files.include('lib/action_web_service/api/*.rb')
|
53
|
-
rdoc.rdoc_files.include('lib/action_web_service/client/*.rb')
|
54
|
-
rdoc.rdoc_files.include('lib/action_web_service/container/*.rb')
|
55
|
-
rdoc.rdoc_files.include('lib/action_web_service/dispatcher/*.rb')
|
56
|
-
rdoc.rdoc_files.include('lib/action_web_service/protocol/*.rb')
|
57
|
-
rdoc.rdoc_files.include('lib/action_web_service/support/*.rb')
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
# Create compressed packages
|
62
|
-
spec = Gem::Specification.new do |s|
|
63
|
-
s.platform = Gem::Platform::RUBY
|
64
|
-
s.name = PKG_NAME
|
65
|
-
s.summary = "Web service support for Action Pack."
|
66
|
-
s.description = %q{Adds WSDL/SOAP and XML-RPC web service support to Action Pack}
|
67
|
-
s.version = PKG_VERSION
|
68
|
-
|
69
|
-
s.author = "Leon Breedt"
|
70
|
-
s.email = "bitserf@gmail.com"
|
71
|
-
s.rubyforge_project = "aws"
|
72
|
-
s.homepage = "http://www.rubyonrails.org"
|
73
|
-
|
74
|
-
s.add_dependency('actionpack', '= 1.13.3' + PKG_BUILD)
|
75
|
-
s.add_dependency('activerecord', '= 1.15.3' + PKG_BUILD)
|
76
|
-
|
77
|
-
s.has_rdoc = true
|
78
|
-
s.requirements << 'none'
|
79
|
-
s.require_path = 'lib'
|
80
|
-
s.autorequire = 'action_web_service'
|
81
|
-
|
82
|
-
s.files = [ "Rakefile", "setup.rb", "README", "TODO", "CHANGELOG", "MIT-LICENSE" ]
|
83
|
-
s.files = s.files + Dir.glob( "examples/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
84
|
-
s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
85
|
-
s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
|
86
|
-
end
|
87
|
-
Rake::GemPackageTask.new(spec) do |p|
|
88
|
-
p.gem_spec = spec
|
89
|
-
p.need_tar = true
|
90
|
-
p.need_zip = true
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
# Publish beta gem
|
95
|
-
desc "Publish the API documentation"
|
96
|
-
task :pgem => [:package] do
|
97
|
-
Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
|
98
|
-
`ssh davidhh@wrath.rubyonrails.org './gemupdate.sh'`
|
99
|
-
end
|
100
|
-
|
101
|
-
# Publish documentation
|
102
|
-
desc "Publish the API documentation"
|
103
|
-
task :pdoc => [:rdoc] do
|
104
|
-
Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.org", "public_html/aws", "doc").upload
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
def each_source_file(*args)
|
109
|
-
prefix, includes, excludes, open_file = args
|
110
|
-
prefix ||= File.dirname(__FILE__)
|
111
|
-
open_file = true if open_file.nil?
|
112
|
-
includes ||= %w[lib\/action_web_service\.rb$ lib\/action_web_service\/.*\.rb$]
|
113
|
-
excludes ||= %w[lib\/action_web_service\/vendor]
|
114
|
-
Find.find(prefix) do |file_name|
|
115
|
-
next if file_name =~ /\.svn/
|
116
|
-
file_name.gsub!(/^\.\//, '')
|
117
|
-
continue = false
|
118
|
-
includes.each do |inc|
|
119
|
-
if file_name.match(/#{inc}/)
|
120
|
-
continue = true
|
121
|
-
break
|
122
|
-
end
|
123
|
-
end
|
124
|
-
next unless continue
|
125
|
-
excludes.each do |exc|
|
126
|
-
if file_name.match(/#{exc}/)
|
127
|
-
continue = false
|
128
|
-
break
|
129
|
-
end
|
130
|
-
end
|
131
|
-
next unless continue
|
132
|
-
if open_file
|
133
|
-
File.open(file_name) do |f|
|
134
|
-
yield file_name, f
|
135
|
-
end
|
136
|
-
else
|
137
|
-
yield file_name
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
desc "Count lines of the AWS source code"
|
143
|
-
task :lines do
|
144
|
-
total_lines = total_loc = 0
|
145
|
-
puts "Per File:"
|
146
|
-
each_source_file do |file_name, f|
|
147
|
-
file_lines = file_loc = 0
|
148
|
-
while line = f.gets
|
149
|
-
file_lines += 1
|
150
|
-
next if line =~ /^\s*$/
|
151
|
-
next if line =~ /^\s*#/
|
152
|
-
file_loc += 1
|
153
|
-
end
|
154
|
-
puts " #{file_name}: Lines #{file_lines}, LOC #{file_loc}"
|
155
|
-
total_lines += file_lines
|
156
|
-
total_loc += file_loc
|
157
|
-
end
|
158
|
-
puts "Total:"
|
159
|
-
puts " Lines #{total_lines}, LOC #{total_loc}"
|
160
|
-
end
|
161
|
-
|
162
|
-
desc "Publish the release files to RubyForge."
|
163
|
-
task :release => [ :package ] do
|
164
|
-
require 'rubyforge'
|
165
|
-
|
166
|
-
packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
|
167
|
-
|
168
|
-
rubyforge = RubyForge.new
|
169
|
-
rubyforge.login
|
170
|
-
rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
|
171
|
-
end
|