rubyjedi-actionwebservice 2.3.5.20100615120735

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/CHANGELOG +335 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +381 -0
  4. data/Rakefile +180 -0
  5. data/TODO +32 -0
  6. data/examples/googlesearch/README +143 -0
  7. data/examples/googlesearch/autoloading/google_search_api.rb +50 -0
  8. data/examples/googlesearch/autoloading/google_search_controller.rb +57 -0
  9. data/examples/googlesearch/delegated/google_search_service.rb +108 -0
  10. data/examples/googlesearch/delegated/search_controller.rb +7 -0
  11. data/examples/googlesearch/direct/google_search_api.rb +50 -0
  12. data/examples/googlesearch/direct/search_controller.rb +58 -0
  13. data/examples/metaWeblog/README +17 -0
  14. data/examples/metaWeblog/apis/blogger_api.rb +60 -0
  15. data/examples/metaWeblog/apis/blogger_service.rb +34 -0
  16. data/examples/metaWeblog/apis/meta_weblog_api.rb +67 -0
  17. data/examples/metaWeblog/apis/meta_weblog_service.rb +48 -0
  18. data/examples/metaWeblog/controllers/xmlrpc_controller.rb +16 -0
  19. data/generators/web_service/USAGE +28 -0
  20. data/generators/web_service/templates/api_definition.rb +5 -0
  21. data/generators/web_service/templates/controller.rb +8 -0
  22. data/generators/web_service/templates/functional_test.rb +19 -0
  23. data/generators/web_service/web_service_generator.rb +29 -0
  24. data/lib/action_web_service/acts_as_web_service.rb +24 -0
  25. data/lib/action_web_service/api.rb +297 -0
  26. data/lib/action_web_service/base.rb +38 -0
  27. data/lib/action_web_service/casting.rb +151 -0
  28. data/lib/action_web_service/client/base.rb +28 -0
  29. data/lib/action_web_service/client/soap_client.rb +113 -0
  30. data/lib/action_web_service/client/xmlrpc_client.rb +58 -0
  31. data/lib/action_web_service/client.rb +3 -0
  32. data/lib/action_web_service/container/action_controller_container.rb +93 -0
  33. data/lib/action_web_service/container/delegated_container.rb +86 -0
  34. data/lib/action_web_service/container/direct_container.rb +69 -0
  35. data/lib/action_web_service/container.rb +3 -0
  36. data/lib/action_web_service/dispatcher/abstract.rb +208 -0
  37. data/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +396 -0
  38. data/lib/action_web_service/dispatcher.rb +2 -0
  39. data/lib/action_web_service/invocation.rb +202 -0
  40. data/lib/action_web_service/protocol/abstract.rb +112 -0
  41. data/lib/action_web_service/protocol/discovery.rb +37 -0
  42. data/lib/action_web_service/protocol/soap_protocol/marshaler.rb +242 -0
  43. data/lib/action_web_service/protocol/soap_protocol.rb +176 -0
  44. data/lib/action_web_service/protocol/xmlrpc_protocol.rb +123 -0
  45. data/lib/action_web_service/protocol.rb +4 -0
  46. data/lib/action_web_service/scaffolding.rb +281 -0
  47. data/lib/action_web_service/simple.rb +53 -0
  48. data/lib/action_web_service/string_to_datetime_for_soap.rb +16 -0
  49. data/lib/action_web_service/struct.rb +68 -0
  50. data/lib/action_web_service/support/class_inheritable_options.rb +26 -0
  51. data/lib/action_web_service/support/signature_types.rb +261 -0
  52. data/lib/action_web_service/templates/scaffolds/layout.html.erb +65 -0
  53. data/lib/action_web_service/templates/scaffolds/methods.html.erb +6 -0
  54. data/lib/action_web_service/templates/scaffolds/parameters.html.erb +29 -0
  55. data/lib/action_web_service/templates/scaffolds/result.html.erb +30 -0
  56. data/lib/action_web_service/test_invoke.rb +110 -0
  57. data/lib/action_web_service/version.rb +9 -0
  58. data/lib/action_web_service.rb +60 -0
  59. data/lib/actionwebservice.rb +1 -0
  60. data/setup.rb +1379 -0
  61. data/test/abstract_client.rb +184 -0
  62. data/test/abstract_dispatcher.rb +549 -0
  63. data/test/abstract_unit.rb +43 -0
  64. data/test/actionwebservice_unittest.db +0 -0
  65. data/test/api_test.rb +102 -0
  66. data/test/apis/auto_load_api.rb +3 -0
  67. data/test/apis/broken_auto_load_api.rb +2 -0
  68. data/test/base_test.rb +42 -0
  69. data/test/casting_test.rb +95 -0
  70. data/test/client_soap_test.rb +156 -0
  71. data/test/client_xmlrpc_test.rb +154 -0
  72. data/test/container_test.rb +75 -0
  73. data/test/debug.log +12305 -0
  74. data/test/dispatcher_action_controller_soap_test.rb +139 -0
  75. data/test/dispatcher_action_controller_xmlrpc_test.rb +59 -0
  76. data/test/fixtures/db_definitions/mysql.sql +8 -0
  77. data/test/fixtures/db_definitions/sqlite3.sql +8 -0
  78. data/test/fixtures/users.yml +12 -0
  79. data/test/gencov +3 -0
  80. data/test/invocation_test.rb +186 -0
  81. data/test/run +6 -0
  82. data/test/scaffolded_controller_test.rb +147 -0
  83. data/test/struct_test.rb +84 -0
  84. data/test/test_invoke_test.rb +113 -0
  85. metadata +182 -0
data/README ADDED
@@ -0,0 +1,381 @@
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
+ If you're not using SOAP (or you're having serialisation difficulties),
265
+ you can test XMLRPC like this:
266
+
267
+ class PersonApiControllerTest < Test::Unit::TestCase
268
+ def setup
269
+ @controller = PersonController.new
270
+ @request = ActionController::TestRequest.new
271
+ @response = ActionController::TestResponse.new
272
+
273
+ @protocol = :xmlrpc # can also be :soap, the default
274
+ end
275
+
276
+ def test_add
277
+ result = invoke :remove, 1 # no change here
278
+ assert_equal true, result
279
+ end
280
+ end
281
+
282
+ === Scaffolding
283
+
284
+ You can also test your APIs with a web browser by attaching scaffolding
285
+ to the controller.
286
+
287
+ Example:
288
+
289
+ class PersonController
290
+ web_service_scaffold :invocation
291
+ end
292
+
293
+ This creates an action named <tt>invocation</tt> on the PersonController.
294
+
295
+ Navigating to this action lets you select the method to invoke, supply the parameters,
296
+ and view the result of the invocation.
297
+
298
+
299
+ == Using the client support
300
+
301
+ Action Web Service includes client classes that can use the same API
302
+ definition as the server. The advantage of this approach is that your client
303
+ will have the same support for Active Record and structured types as the
304
+ server, and can just use them directly, and rely on the marshaling to Do The
305
+ Right Thing.
306
+
307
+ *Note*: The client support is intended for communication between Ruby on Rails
308
+ applications that both use Action Web Service. It may work with other servers, but
309
+ that is not its intended use, and interoperability can't be guaranteed, especially
310
+ not for .NET web services.
311
+
312
+ Web services protocol specifications are complex, and Action Web Service client
313
+ support can only be guaranteed to work with a subset.
314
+
315
+
316
+ ==== Factory created client example
317
+
318
+ class BlogManagerController < ApplicationController
319
+ web_client_api :blogger, :xmlrpc, 'http://url/to/blog/api/RPC2', :handler_name => 'blogger'
320
+ end
321
+
322
+ class SearchingController < ApplicationController
323
+ web_client_api :google, :soap, 'http://url/to/blog/api/beta', :service_name => 'GoogleSearch'
324
+ end
325
+
326
+ See ActionWebService::API::ActionController::ClassMethods for more details.
327
+
328
+ ==== Manually created client example
329
+
330
+ class PersonAPI < ActionWebService::API::Base
331
+ api_method :find_all, :returns => [[Person]]
332
+ end
333
+
334
+ soap_client = ActionWebService::Client::Soap.new(PersonAPI, "http://...")
335
+ persons = soap_client.find_all
336
+
337
+ class BloggerAPI < ActionWebService::API::Base
338
+ inflect_names false
339
+ api_method :getRecentPosts, :returns => [[Blog::Post]]
340
+ end
341
+
342
+ blog = ActionWebService::Client::XmlRpc.new(BloggerAPI, "http://.../xmlrpc", :handler_name => "blogger")
343
+ posts = blog.getRecentPosts
344
+
345
+
346
+ See ActionWebService::Client::Soap and ActionWebService::Client::XmlRpc for more details.
347
+
348
+ == Dependencies
349
+
350
+ Action Web Service requires that the Action Pack and Active Record are either
351
+ available to be required immediately or are accessible as GEMs.
352
+
353
+ It also requires a version of Ruby that includes SOAP support in the standard
354
+ library. At least version 1.8.2 final (2004-12-25) of Ruby is recommended; this
355
+ is the version tested against.
356
+
357
+
358
+ == Download
359
+
360
+ The latest Action Web Service version can be downloaded from
361
+ http://rubyforge.org/projects/actionservice
362
+
363
+
364
+ == Installation
365
+
366
+ You can install Action Web Service with the following command.
367
+
368
+ % [sudo] ruby setup.rb
369
+
370
+
371
+ == License
372
+
373
+ Action Web Service is released under the MIT license.
374
+
375
+
376
+ == Support
377
+
378
+ The Ruby on Rails mailing list
379
+
380
+ Or, to contact the author, send mail to bitserf@gmail.com
381
+
data/Rakefile ADDED
@@ -0,0 +1,180 @@
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'] : ".#{Time.now.strftime('%Y%m%d%H%M%S')}"
12
+ PKG_NAME = 'rubyjedi-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( mysql -u root -p --execute='CREATE DATABASE actionwebservice_unittest; CREATE USER unit_tester@localhost; GRANT ALL PRIVILEGES ON actionwebservice_unittest.* TO unit_tester;' )
38
+ %x( mysql -uunit_tester -p actionwebservice_unittest < #{File.join(SCHEMA_PATH, 'mysql.sql')} )
39
+ end
40
+
41
+ desc 'Build the sqlite3 test database'
42
+ task :build_sqlite3_database do
43
+ filename = 'actionwebservice_unittest.db'
44
+ File.delete filename if File.exist? filename
45
+ %x(sqlite3 #{filename} < #{File.join(SCHEMA_PATH, 'sqlite3.sql')})
46
+ end
47
+
48
+
49
+ # Generate the RDoc documentation
50
+ Rake::RDocTask.new { |rdoc|
51
+ rdoc.rdoc_dir = 'doc'
52
+ rdoc.title = "Action Web Service -- Web services for Action Pack"
53
+ rdoc.options << '--line-numbers' << '--inline-source'
54
+ rdoc.options << '--charset' << 'utf-8'
55
+ rdoc.template = "#{ENV['template']}.rb" if ENV['template']
56
+ rdoc.rdoc_files.include('README')
57
+ rdoc.rdoc_files.include('CHANGELOG')
58
+ rdoc.rdoc_files.include('lib/action_web_service.rb')
59
+ rdoc.rdoc_files.include('lib/action_web_service/*.rb')
60
+ rdoc.rdoc_files.include('lib/action_web_service/api/*.rb')
61
+ rdoc.rdoc_files.include('lib/action_web_service/client/*.rb')
62
+ rdoc.rdoc_files.include('lib/action_web_service/container/*.rb')
63
+ rdoc.rdoc_files.include('lib/action_web_service/dispatcher/*.rb')
64
+ rdoc.rdoc_files.include('lib/action_web_service/protocol/*.rb')
65
+ rdoc.rdoc_files.include('lib/action_web_service/support/*.rb')
66
+ }
67
+
68
+
69
+ # Create compressed packages
70
+ spec = Gem::Specification.new do |s|
71
+ s.platform = Gem::Platform::RUBY
72
+ s.name = PKG_NAME
73
+ s.summary = "Web service support for Action Pack."
74
+ s.description = %q{Adds WSDL/SOAP and XML-RPC web service support to Action Pack}
75
+ s.version = PKG_VERSION
76
+
77
+ s.author = "Leon Breedt, Kent Sibilev"
78
+ s.email = "bitserf@gmail.com, ksibilev@yahoo.com"
79
+ s.rubyforge_project = "aws"
80
+ s.homepage = "http://www.rubyonrails.org"
81
+
82
+ s.add_dependency('actionpack', '~> 2.3.5')
83
+ s.add_dependency('activerecord', '~> 2.3.5')
84
+
85
+ s.has_rdoc = true
86
+ s.requirements << 'none'
87
+ s.require_path = 'lib'
88
+ s.autorequire = 'actionwebservice'
89
+
90
+ s.files = [ "Rakefile", "setup.rb", "README", "TODO", "CHANGELOG", "MIT-LICENSE" ]
91
+ s.files = s.files + Dir.glob( "examples/**/*" ).delete_if { |item| item.match( /\.(svn|git)/ ) }
92
+ s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.match( /\.(svn|git)/ ) }
93
+ s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.match( /\.(svn|git)/ ) }
94
+ s.files = s.files + Dir.glob( "generators/**/*" ).delete_if { |item| item.match( /\.(svn|git)/ ) }
95
+ end
96
+ Rake::GemPackageTask.new(spec) do |p|
97
+ p.gem_spec = spec
98
+ p.need_tar = true
99
+ p.need_zip = true
100
+ end
101
+
102
+
103
+ # Publish beta gem
104
+ desc "Publish the API documentation"
105
+ task :pgem => [:package] do
106
+ Rake::SshFilePublisher.new("davidhh@wrath.rubyonrails.org", "public_html/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
107
+ `ssh davidhh@wrath.rubyonrails.org './gemupdate.sh'`
108
+ end
109
+
110
+ # Publish documentation
111
+ desc "Publish the API documentation"
112
+ task :pdoc => [:rdoc] do
113
+ Rake::SshDirPublisher.new("davidhh@wrath.rubyonrails.org", "public_html/aws", "doc").upload
114
+ end
115
+
116
+
117
+ def each_source_file(*args)
118
+ prefix, includes, excludes, open_file = args
119
+ prefix ||= File.dirname(__FILE__)
120
+ open_file = true if open_file.nil?
121
+ includes ||= %w[lib\/action_web_service\.rb$ lib\/action_web_service\/.*\.rb$]
122
+ excludes ||= %w[lib\/action_web_service\/vendor]
123
+ Find.find(prefix) do |file_name|
124
+ next if file_name =~ /\.svn/
125
+ file_name.gsub!(/^\.\//, '')
126
+ continue = false
127
+ includes.each do |inc|
128
+ if file_name.match(/#{inc}/)
129
+ continue = true
130
+ break
131
+ end
132
+ end
133
+ next unless continue
134
+ excludes.each do |exc|
135
+ if file_name.match(/#{exc}/)
136
+ continue = false
137
+ break
138
+ end
139
+ end
140
+ next unless continue
141
+ if open_file
142
+ File.open(file_name) do |f|
143
+ yield file_name, f
144
+ end
145
+ else
146
+ yield file_name
147
+ end
148
+ end
149
+ end
150
+
151
+ desc "Count lines of the AWS source code"
152
+ task :lines do
153
+ total_lines = total_loc = 0
154
+ puts "Per File:"
155
+ each_source_file do |file_name, f|
156
+ file_lines = file_loc = 0
157
+ while line = f.gets
158
+ file_lines += 1
159
+ next if line =~ /^\s*$/
160
+ next if line =~ /^\s*#/
161
+ file_loc += 1
162
+ end
163
+ puts " #{file_name}: Lines #{file_lines}, LOC #{file_loc}"
164
+ total_lines += file_lines
165
+ total_loc += file_loc
166
+ end
167
+ puts "Total:"
168
+ puts " Lines #{total_lines}, LOC #{total_loc}"
169
+ end
170
+
171
+ desc "Publish the release files to RubyForge."
172
+ task :release => [ :package ] do
173
+ require 'rubyforge'
174
+
175
+ packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
176
+
177
+ rubyforge = RubyForge.new
178
+ rubyforge.login
179
+ rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
180
+ end
data/TODO ADDED
@@ -0,0 +1,32 @@
1
+ = Post-1.0
2
+ - Document/Literal SOAP support
3
+ - URL-based dispatching, URL identifies method
4
+
5
+ - Add :rest dispatching mode, a.l.a. Backpack API. Clean up dispatching
6
+ in general. Support vanilla XML-format as a "Rails" protocol?
7
+ XML::Simple deserialization into params?
8
+
9
+ web_service_dispatching_mode :rest
10
+
11
+ def method1(params)
12
+ end
13
+
14
+ def method2(params)
15
+ end
16
+
17
+
18
+ /ws/method1
19
+ <xml>
20
+ /ws/method2
21
+ <yaml>
22
+
23
+ - Allow locking down a controller to only accept messages for a particular
24
+ protocol. This will allow us to generate fully conformant error messages
25
+ in cases where we currently fudge it if we don't know the protocol.
26
+
27
+ - Allow AWS user to participate in typecasting, so they can centralize
28
+ workarounds for buggy input in one place
29
+
30
+ = Refactoring
31
+ - Don't have clean way to go from SOAP Class object to the xsd:NAME type
32
+ string -- NaHi possibly looking at remedying this situation