backlog 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. data/History.txt +10 -0
  2. data/Rakefile +2 -1
  3. data/app/controllers/application.rb +55 -8
  4. data/app/controllers/groups_controller.rb +62 -0
  5. data/app/controllers/periods_controller.rb +13 -55
  6. data/app/controllers/tasks_controller.rb +9 -5
  7. data/app/controllers/works_controller.rb +43 -6
  8. data/app/helpers/application_helper.rb +20 -2
  9. data/app/helpers/groups_helper.rb +2 -0
  10. data/app/models/backlog.rb +19 -10
  11. data/app/models/estimate.rb +2 -1
  12. data/app/models/group.rb +11 -0
  13. data/app/models/party.rb +3 -0
  14. data/app/models/period.rb +43 -6
  15. data/app/models/task.rb +27 -14
  16. data/app/models/user.rb +37 -8
  17. data/app/models/work.rb +4 -6
  18. data/app/views/backlogs/_name_list.rhtml +5 -0
  19. data/app/views/backlogs/show.rhtml +4 -4
  20. data/app/views/groups/_form.rhtml +7 -0
  21. data/app/views/groups/edit.rhtml +31 -0
  22. data/app/views/groups/list.rhtml +27 -0
  23. data/app/views/groups/new.rhtml +8 -0
  24. data/app/views/layouts/wide.rhtml +2 -2
  25. data/app/views/periods/_burn_down_chart.rhtml +1 -1
  26. data/app/views/periods/_form.rhtml +13 -9
  27. data/app/views/periods/_show_active.rhtml +6 -12
  28. data/app/views/periods/_title.rhtml +4 -5
  29. data/app/views/periods/edit.rhtml +1 -1
  30. data/app/views/periods/new.rhtml +1 -1
  31. data/app/views/periods/show.rhtml +10 -6
  32. data/app/views/tasks/_backlog_header.rhtml +22 -0
  33. data/app/views/tasks/_description_list.rhtml +5 -0
  34. data/app/views/tasks/_form.rhtml +26 -7
  35. data/app/views/tasks/_task.rhtml +4 -4
  36. data/app/views/tasks/edit.rhtml +2 -3
  37. data/app/views/tasks/list_started.rhtml +1 -0
  38. data/app/views/tasks/new.rhtml +2 -2
  39. data/app/views/works/_buttons.rhtml +3 -0
  40. data/app/views/works/_form.rhtml +15 -10
  41. data/app/views/works/daily_work_sheet.rhtml +30 -18
  42. data/app/views/works/edit.rhtml +4 -4
  43. data/app/views/works/list.rhtml +2 -2
  44. data/app/views/works/new.rhtml +3 -2
  45. data/app/views/works/weekly_work_sheet.rhtml +2 -2
  46. data/bin/backlog +2 -0
  47. data/bin/backlog_init.d_kubosch_production +27 -0
  48. data/bin/copy_production2development.rb +33 -0
  49. data/config/database.yml +13 -7
  50. data/config/deploy_kubosch.rb +1 -0
  51. data/config/environment.rb +2 -0
  52. data/config/environments/development_mysql.rb +27 -0
  53. data/config/environments/kubosch_production_mysql.rb +21 -0
  54. data/config/routes.rb +1 -1
  55. data/db/migrate/{001_tasks.rb → 001_create_tasks.rb} +1 -1
  56. data/db/migrate/{002_backlogs.rb → 002_create_backlogs.rb} +2 -2
  57. data/db/migrate/003_add_estimation_points.rb +1 -1
  58. data/db/migrate/004_add_period.rb +2 -2
  59. data/db/migrate/013_create_estimates.rb +1 -1
  60. data/db/migrate/015_add_user_option.rb +9 -5
  61. data/db/migrate/017_insert_datek_projects.rb +13 -10
  62. data/db/migrate/018_create_groups.rb +115 -0
  63. data/db/schema.rb +72 -12
  64. data/lang/en.yaml +7 -0
  65. data/lang/no.yaml +7 -0
  66. data/lib/big_decimal_yaml_fix.rb +27 -0
  67. data/lib/class_table_inheritance.rb +163 -0
  68. data/lib/tasks/backup.rake +92 -0
  69. data/public/images/person.org.png +0 -0
  70. data/public/images/person.png +0 -0
  71. data/public/stylesheets/backlog.css +3 -1
  72. data/public/stylesheets/mwrt002.css +1 -1
  73. data/test/fixtures/groups.yml +6 -0
  74. data/test/fixtures/parties.yml +31 -0
  75. data/test/fixtures/periods.yml +2 -2
  76. data/test/fixtures/tasks.yml +2 -0
  77. data/test/fixtures/users.yml +6 -6
  78. data/test/functional/backlogs_controller_test.rb +1 -1
  79. data/test/functional/groups_controller_test.rb +120 -0
  80. data/test/functional/periods_controller_test.rb +1 -1
  81. data/test/functional/tasks_controller_test.rb +16 -1
  82. data/test/functional/user_controller_test.rb +8 -2
  83. data/test/test_helper.rb +5 -0
  84. data/test/unit/big_decimal_yaml_fix_test.rb +14 -0
  85. data/test/unit/estimate_test.rb +1 -1
  86. data/test/unit/group_test.rb +10 -0
  87. data/test/unit/user_test.rb +56 -44
  88. data/tmp/sessions/ruby_sess.22dec3e9df47fb4e +0 -0
  89. data/tmp/sessions/ruby_sess.8037e0ab58cbcf1a +0 -0
  90. data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +35 -0
  91. data/vendor/rails/actionmailer/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
  92. data/vendor/rails/{actionwebservice/lib/action_web_service/templates/scaffolds/layout.rhtml → railties/configs/empty.log} +0 -0
  93. metadata +36 -105
  94. data/backlog.gemspec +0 -21
  95. data/vendor/rails/actionwebservice/CHANGELOG +0 -265
  96. data/vendor/rails/actionwebservice/MIT-LICENSE +0 -21
  97. data/vendor/rails/actionwebservice/README +0 -364
  98. data/vendor/rails/actionwebservice/Rakefile +0 -171
  99. data/vendor/rails/actionwebservice/TODO +0 -32
  100. data/vendor/rails/actionwebservice/examples/googlesearch/README +0 -143
  101. data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_api.rb +0 -50
  102. data/vendor/rails/actionwebservice/examples/googlesearch/autoloading/google_search_controller.rb +0 -57
  103. data/vendor/rails/actionwebservice/examples/googlesearch/delegated/google_search_service.rb +0 -108
  104. data/vendor/rails/actionwebservice/examples/googlesearch/delegated/search_controller.rb +0 -7
  105. data/vendor/rails/actionwebservice/examples/googlesearch/direct/google_search_api.rb +0 -50
  106. data/vendor/rails/actionwebservice/examples/googlesearch/direct/search_controller.rb +0 -58
  107. data/vendor/rails/actionwebservice/examples/metaWeblog/README +0 -17
  108. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_api.rb +0 -60
  109. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/blogger_service.rb +0 -34
  110. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_api.rb +0 -67
  111. data/vendor/rails/actionwebservice/examples/metaWeblog/apis/meta_weblog_service.rb +0 -48
  112. data/vendor/rails/actionwebservice/examples/metaWeblog/controllers/xmlrpc_controller.rb +0 -16
  113. data/vendor/rails/actionwebservice/install.rb +0 -30
  114. data/vendor/rails/actionwebservice/lib/action_web_service.rb +0 -66
  115. data/vendor/rails/actionwebservice/lib/action_web_service/api.rb +0 -301
  116. data/vendor/rails/actionwebservice/lib/action_web_service/base.rb +0 -42
  117. data/vendor/rails/actionwebservice/lib/action_web_service/casting.rb +0 -138
  118. data/vendor/rails/actionwebservice/lib/action_web_service/client.rb +0 -3
  119. data/vendor/rails/actionwebservice/lib/action_web_service/client/base.rb +0 -28
  120. data/vendor/rails/actionwebservice/lib/action_web_service/client/soap_client.rb +0 -113
  121. data/vendor/rails/actionwebservice/lib/action_web_service/client/xmlrpc_client.rb +0 -58
  122. data/vendor/rails/actionwebservice/lib/action_web_service/container.rb +0 -3
  123. data/vendor/rails/actionwebservice/lib/action_web_service/container/action_controller_container.rb +0 -93
  124. data/vendor/rails/actionwebservice/lib/action_web_service/container/delegated_container.rb +0 -86
  125. data/vendor/rails/actionwebservice/lib/action_web_service/container/direct_container.rb +0 -69
  126. data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher.rb +0 -2
  127. data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/abstract.rb +0 -207
  128. data/vendor/rails/actionwebservice/lib/action_web_service/dispatcher/action_controller_dispatcher.rb +0 -379
  129. data/vendor/rails/actionwebservice/lib/action_web_service/invocation.rb +0 -202
  130. data/vendor/rails/actionwebservice/lib/action_web_service/protocol.rb +0 -4
  131. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/abstract.rb +0 -112
  132. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/discovery.rb +0 -37
  133. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol.rb +0 -176
  134. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/soap_protocol/marshaler.rb +0 -235
  135. data/vendor/rails/actionwebservice/lib/action_web_service/protocol/xmlrpc_protocol.rb +0 -122
  136. data/vendor/rails/actionwebservice/lib/action_web_service/scaffolding.rb +0 -283
  137. data/vendor/rails/actionwebservice/lib/action_web_service/struct.rb +0 -68
  138. data/vendor/rails/actionwebservice/lib/action_web_service/support/class_inheritable_options.rb +0 -26
  139. data/vendor/rails/actionwebservice/lib/action_web_service/support/signature_types.rb +0 -226
  140. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/layout.erb +0 -65
  141. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.erb +0 -6
  142. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/methods.rhtml +0 -0
  143. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.erb +0 -29
  144. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/parameters.rhtml +0 -0
  145. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.erb +0 -30
  146. data/vendor/rails/actionwebservice/lib/action_web_service/templates/scaffolds/result.rhtml +0 -0
  147. data/vendor/rails/actionwebservice/lib/action_web_service/test_invoke.rb +0 -110
  148. data/vendor/rails/actionwebservice/lib/action_web_service/version.rb +0 -9
  149. data/vendor/rails/actionwebservice/setup.rb +0 -1379
  150. data/vendor/rails/actionwebservice/test/abstract_client.rb +0 -183
  151. data/vendor/rails/actionwebservice/test/abstract_dispatcher.rb +0 -551
  152. data/vendor/rails/actionwebservice/test/abstract_unit.rb +0 -45
  153. data/vendor/rails/actionwebservice/test/api_test.rb +0 -102
  154. data/vendor/rails/actionwebservice/test/apis/auto_load_api.rb +0 -3
  155. data/vendor/rails/actionwebservice/test/apis/broken_auto_load_api.rb +0 -2
  156. data/vendor/rails/actionwebservice/test/base_test.rb +0 -42
  157. data/vendor/rails/actionwebservice/test/casting_test.rb +0 -86
  158. data/vendor/rails/actionwebservice/test/client_soap_test.rb +0 -153
  159. data/vendor/rails/actionwebservice/test/client_xmlrpc_test.rb +0 -152
  160. data/vendor/rails/actionwebservice/test/container_test.rb +0 -73
  161. data/vendor/rails/actionwebservice/test/dispatcher_action_controller_soap_test.rb +0 -137
  162. data/vendor/rails/actionwebservice/test/dispatcher_action_controller_xmlrpc_test.rb +0 -59
  163. data/vendor/rails/actionwebservice/test/fixtures/db_definitions/mysql.sql +0 -8
  164. data/vendor/rails/actionwebservice/test/fixtures/users.yml +0 -12
  165. data/vendor/rails/actionwebservice/test/gencov +0 -3
  166. data/vendor/rails/actionwebservice/test/invocation_test.rb +0 -185
  167. data/vendor/rails/actionwebservice/test/run +0 -6
  168. data/vendor/rails/actionwebservice/test/scaffolded_controller_test.rb +0 -146
  169. data/vendor/rails/actionwebservice/test/struct_test.rb +0 -52
  170. data/vendor/rails/actionwebservice/test/test_invoke_test.rb +0 -112
@@ -1,58 +0,0 @@
1
- class SearchController < ApplicationController
2
- web_service_api :google_search
3
- wsdl_service_name 'GoogleSearch'
4
-
5
- def doGetCachedPage
6
- "<html><body>i am a cached page. my key was %s, url was %s</body></html>" % [@params['key'], @params['url']]
7
- end
8
-
9
- def doSpellingSuggestion
10
- "%s: Did you mean '%s'?" % [@params['key'], @params['phrase']]
11
- end
12
-
13
- def doGoogleSearch
14
- resultElement = ResultElement.new
15
- resultElement.summary = "ONlamp.com: Rolling with Ruby on Rails"
16
- resultElement.URL = "http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html"
17
- resultElement.snippet = "Curt Hibbs shows off Ruby on Rails by building a simple application that requires " +
18
- "almost no Ruby experience. ... Rolling with Ruby on Rails. ..."
19
- resultElement.title = "Teh Railz0r"
20
- resultElement.cachedSize = "Almost no lines of code!"
21
- resultElement.relatedInformationPresent = true
22
- resultElement.hostName = "rubyonrails.com"
23
- resultElement.directoryCategory = category("Web Development", "UTF-8")
24
-
25
- result = GoogleSearchResult.new
26
- result.documentFiltering = @params['filter']
27
- result.searchComments = ""
28
- result.estimatedTotalResultsCount = 322000
29
- result.estimateIsExact = false
30
- result.resultElements = [resultElement]
31
- result.searchQuery = "http://www.google.com/search?q=ruby+on+rails"
32
- result.startIndex = @params['start']
33
- result.endIndex = @params['start'] + @params['maxResults']
34
- result.searchTips = "\"on\" is a very common word and was not included in your search [details]"
35
- result.searchTime = 0.000001
36
-
37
- # For Mono, we have to clone objects if they're referenced by more than one place, otherwise
38
- # the Ruby SOAP collapses them into one instance and uses references all over the
39
- # place, confusing Mono.
40
- #
41
- # This has recently been fixed:
42
- # http://bugzilla.ximian.com/show_bug.cgi?id=72265
43
- result.directoryCategories = [
44
- category("Web Development", "UTF-8"),
45
- category("Programming", "US-ASCII"),
46
- ]
47
-
48
- result
49
- end
50
-
51
- private
52
- def category(name, encoding)
53
- cat = DirectoryCategory.new
54
- cat.fullViewableName = name.dup
55
- cat.specialEncoding = encoding.dup
56
- cat
57
- end
58
- end
@@ -1,17 +0,0 @@
1
- = metaWeblog example
2
-
3
- This example shows how one might begin to go about adding metaWeblog
4
- (http://www.xmlrpc.com/metaWeblogApi) API support to a Rails-based
5
- blogging application.
6
-
7
- The example APIs are more verbose than you may want to make them, for documentation
8
- reasons.
9
-
10
- = Running
11
-
12
- 1. Copy the "apis" directory and its files into "app" in a Rails project.
13
-
14
- 2. Copy the "controllers" directory and its files into "app" in a Rails project
15
-
16
- 3. Fire up a desktop blogging application (such as w.bloggar, MarsEdit, or BloGTK),
17
- point it at http://localhost:3000/xmlrpc/api, and try creating or editing blog posts.
@@ -1,60 +0,0 @@
1
- #
2
- # see the blogger API spec at http://www.blogger.com/developers/api/1_docs/
3
- # note that the method signatures are subtly different to metaWeblog, they
4
- # are not identical. take care to ensure you handle the different semantics
5
- # properly if you want to support blogger API too, to get maximum compatibility.
6
- #
7
-
8
- module Blog
9
- class Blog < ActionWebService::Struct
10
- member :url, :string
11
- member :blogid, :string
12
- member :blogName, :string
13
- end
14
-
15
- class User < ActionWebService::Struct
16
- member :nickname, :string
17
- member :userid, :string
18
- member :url, :string
19
- member :email, :string
20
- member :lastname, :string
21
- member :firstname, :string
22
- end
23
- end
24
-
25
- #
26
- # blogger
27
- #
28
- class BloggerAPI < ActionWebService::API::Base
29
- inflect_names false
30
-
31
- api_method :newPost, :returns => [:string], :expects => [
32
- {:appkey=>:string},
33
- {:blogid=>:string},
34
- {:username=>:string},
35
- {:password=>:string},
36
- {:content=>:string},
37
- {:publish=>:bool}
38
- ]
39
-
40
- api_method :editPost, :returns => [:bool], :expects => [
41
- {:appkey=>:string},
42
- {:postid=>:string},
43
- {:username=>:string},
44
- {:password=>:string},
45
- {:content=>:string},
46
- {:publish=>:bool}
47
- ]
48
-
49
- api_method :getUsersBlogs, :returns => [[Blog::Blog]], :expects => [
50
- {:appkey=>:string},
51
- {:username=>:string},
52
- {:password=>:string}
53
- ]
54
-
55
- api_method :getUserInfo, :returns => [Blog::User], :expects => [
56
- {:appkey=>:string},
57
- {:username=>:string},
58
- {:password=>:string}
59
- ]
60
- end
@@ -1,34 +0,0 @@
1
- require 'blogger_api'
2
-
3
- class BloggerService < ActionWebService::Base
4
- web_service_api BloggerAPI
5
-
6
- def initialize
7
- @postid = 0
8
- end
9
-
10
- def newPost(key, id, user, pw, content, publish)
11
- $stderr.puts "id=#{id} user=#{user} pw=#{pw}, content=#{content.inspect} [#{publish}]"
12
- (@postid += 1).to_s
13
- end
14
-
15
- def editPost(key, post_id, user, pw, content, publish)
16
- $stderr.puts "id=#{post_id} user=#{user} pw=#{pw} content=#{content.inspect} [#{publish}]"
17
- true
18
- end
19
-
20
- def getUsersBlogs(key, user, pw)
21
- $stderr.puts "getting blogs for #{user}"
22
- blog = Blog::Blog.new(
23
- :url =>'http://blog',
24
- :blogid => 'myblog',
25
- :blogName => 'My Blog'
26
- )
27
- [blog]
28
- end
29
-
30
- def getUserInfo(key, user, pw)
31
- $stderr.puts "getting user info for #{user}"
32
- Blog::User.new(:nickname => 'user', :email => 'user@test.com')
33
- end
34
- end
@@ -1,67 +0,0 @@
1
- #
2
- # here lie structures, cousins of those on http://www.xmlrpc.com/metaWeblog
3
- # but they don't necessarily the real world reflect
4
- # so if you do, find that your client complains:
5
- # please tell, of problems you suffered through
6
- #
7
-
8
- module Blog
9
- class Post < ActionWebService::Struct
10
- member :title, :string
11
- member :link, :string
12
- member :description, :string
13
- member :author, :string
14
- member :category, :string
15
- member :comments, :string
16
- member :guid, :string
17
- member :pubDate, :string
18
- end
19
-
20
- class Category < ActionWebService::Struct
21
- member :description, :string
22
- member :htmlUrl, :string
23
- member :rssUrl, :string
24
- end
25
- end
26
-
27
- #
28
- # metaWeblog
29
- #
30
- class MetaWeblogAPI < ActionWebService::API::Base
31
- inflect_names false
32
-
33
- api_method :newPost, :returns => [:string], :expects => [
34
- {:blogid=>:string},
35
- {:username=>:string},
36
- {:password=>:string},
37
- {:struct=>Blog::Post},
38
- {:publish=>:bool}
39
- ]
40
-
41
- api_method :editPost, :returns => [:bool], :expects => [
42
- {:postid=>:string},
43
- {:username=>:string},
44
- {:password=>:string},
45
- {:struct=>Blog::Post},
46
- {:publish=>:bool},
47
- ]
48
-
49
- api_method :getPost, :returns => [Blog::Post], :expects => [
50
- {:postid=>:string},
51
- {:username=>:string},
52
- {:password=>:string},
53
- ]
54
-
55
- api_method :getCategories, :returns => [[Blog::Category]], :expects => [
56
- {:blogid=>:string},
57
- {:username=>:string},
58
- {:password=>:string},
59
- ]
60
-
61
- api_method :getRecentPosts, :returns => [[Blog::Post]], :expects => [
62
- {:blogid=>:string},
63
- {:username=>:string},
64
- {:password=>:string},
65
- {:numberOfPosts=>:int},
66
- ]
67
- end
@@ -1,48 +0,0 @@
1
- require 'meta_weblog_api'
2
-
3
- class MetaWeblogService < ActionWebService::Base
4
- web_service_api MetaWeblogAPI
5
-
6
- def initialize
7
- @postid = 0
8
- end
9
-
10
- def newPost(id, user, pw, struct, publish)
11
- $stderr.puts "id=#{id} user=#{user} pw=#{pw}, struct=#{struct.inspect} [#{publish}]"
12
- (@postid += 1).to_s
13
- end
14
-
15
- def editPost(post_id, user, pw, struct, publish)
16
- $stderr.puts "id=#{post_id} user=#{user} pw=#{pw} struct=#{struct.inspect} [#{publish}]"
17
- true
18
- end
19
-
20
- def getPost(post_id, user, pw)
21
- $stderr.puts "get post #{post_id}"
22
- Blog::Post.new(:title => 'hello world', :description => 'first post!')
23
- end
24
-
25
- def getCategories(id, user, pw)
26
- $stderr.puts "categories for #{user}"
27
- cat = Blog::Category.new(
28
- :description => 'Tech',
29
- :htmlUrl => 'http://blog/tech',
30
- :rssUrl => 'http://blog/tech.rss')
31
- [cat]
32
- end
33
-
34
- def getRecentPosts(id, user, pw, num)
35
- $stderr.puts "recent #{num} posts for #{user} on blog #{id}"
36
- post1 = Blog::Post.new(
37
- :title => 'first post!',
38
- :link => 'http://blog.xeraph.org/testOne.html',
39
- :description => 'this is the first post'
40
- )
41
- post2 = Blog::Post.new(
42
- :title => 'second post!',
43
- :link => 'http://blog.xeraph.org/testTwo.html',
44
- :description => 'this is the second post'
45
- )
46
- [post1, post2]
47
- end
48
- end
@@ -1,16 +0,0 @@
1
- #
2
- # example controller implementing both blogger and metaWeblog APIs
3
- # in a way that should be compatible with clients supporting both/either.
4
- #
5
- # test by pointing your client at http://URL/xmlrpc/api
6
- #
7
-
8
- require 'meta_weblog_service'
9
- require 'blogger_service'
10
-
11
- class XmlrpcController < ApplicationController
12
- web_service_dispatching_mode :layered
13
-
14
- web_service :metaWeblog, MetaWeblogService.new
15
- web_service :blogger, BloggerService.new
16
- end
@@ -1,30 +0,0 @@
1
- require 'rbconfig'
2
- require 'find'
3
- require 'ftools'
4
-
5
- include Config
6
-
7
- # this was adapted from rdoc's install.rb by way of Log4r
8
-
9
- $sitedir = CONFIG["sitelibdir"]
10
- unless $sitedir
11
- version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
12
- $libdir = File.join(CONFIG["libdir"], "ruby", version)
13
- $sitedir = $:.find {|x| x =~ /site_ruby/ }
14
- if !$sitedir
15
- $sitedir = File.join($libdir, "site_ruby")
16
- elsif $sitedir !~ Regexp.quote(version)
17
- $sitedir = File.join($sitedir, version)
18
- end
19
- end
20
-
21
- # the acual gruntwork
22
- Dir.chdir("lib")
23
-
24
- Find.find("action_web_service", "action_web_service.rb") { |f|
25
- if f[-3..-1] == ".rb"
26
- File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
27
- else
28
- File::makedirs(File.join($sitedir, *f.split(/\//)))
29
- end
30
- }
@@ -1,66 +0,0 @@
1
- #--
2
- # Copyright (C) 2005 Leon Breedt
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining
5
- # a copy of this software and associated documentation files (the
6
- # "Software"), to deal in the Software without restriction, including
7
- # without limitation the rights to use, copy, modify, merge, publish,
8
- # distribute, sublicense, and/or sell copies of the Software, and to
9
- # permit persons to whom the Software is furnished to do so, subject to
10
- # the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be
13
- # included in all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
- #++
23
-
24
- begin
25
- require 'active_support'
26
- require 'action_controller'
27
- require 'active_record'
28
- rescue LoadError
29
- require 'rubygems'
30
- gem 'activesupport', '>= 1.0.2'
31
- gem 'actionpack', '>= 1.6.0'
32
- gem 'activerecord', '>= 1.9.0'
33
- end
34
-
35
- $:.unshift(File.dirname(__FILE__) + "/action_web_service/vendor/")
36
-
37
- require 'action_web_service/support/class_inheritable_options'
38
- require 'action_web_service/support/signature_types'
39
- require 'action_web_service/base'
40
- require 'action_web_service/client'
41
- require 'action_web_service/invocation'
42
- require 'action_web_service/api'
43
- require 'action_web_service/casting'
44
- require 'action_web_service/struct'
45
- require 'action_web_service/container'
46
- require 'action_web_service/protocol'
47
- require 'action_web_service/dispatcher'
48
- require 'action_web_service/scaffolding'
49
-
50
- ActionWebService::Base.class_eval do
51
- include ActionWebService::Container::Direct
52
- include ActionWebService::Invocation
53
- end
54
-
55
- ActionController::Base.class_eval do
56
- include ActionWebService::Protocol::Discovery
57
- include ActionWebService::Protocol::Soap
58
- include ActionWebService::Protocol::XmlRpc
59
- include ActionWebService::Container::Direct
60
- include ActionWebService::Container::Delegated
61
- include ActionWebService::Container::ActionController
62
- include ActionWebService::Invocation
63
- include ActionWebService::Dispatcher
64
- include ActionWebService::Dispatcher::ActionController
65
- include ActionWebService::Scaffolding
66
- end
@@ -1,301 +0,0 @@
1
- module ActionWebService # :nodoc:
2
- module API # :nodoc:
3
- # A web service API class specifies the methods that will be available for
4
- # invocation for an API. It also contains metadata such as the method type
5
- # signature hints.
6
- #
7
- # It is not intended to be instantiated.
8
- #
9
- # It is attached to web service implementation classes like
10
- # ActionWebService::Base and ActionController::Base derivatives by using
11
- # <tt>container.web_service_api</tt>, where <tt>container</tt> is an
12
- # ActionController::Base or a ActionWebService::Base.
13
- #
14
- # See ActionWebService::Container::Direct::ClassMethods for an example
15
- # of use.
16
- class Base
17
- # Action WebService API subclasses should be reloaded by the dispatcher in Rails
18
- # when Dependencies.mechanism = :load.
19
- include Reloadable::Deprecated
20
-
21
- # Whether to transform the public API method names into camel-cased names
22
- class_inheritable_option :inflect_names, true
23
-
24
- # By default only HTTP POST requests are processed
25
- class_inheritable_option :allowed_http_methods, [ :post ]
26
-
27
- # Whether to allow ActiveRecord::Base models in <tt>:expects</tt>.
28
- # The default is +false+; you should be aware of the security implications
29
- # of allowing this, and ensure that you don't allow remote callers to
30
- # easily overwrite data they should not have access to.
31
- class_inheritable_option :allow_active_record_expects, false
32
-
33
- # If present, the name of a method to call when the remote caller
34
- # tried to call a nonexistent method. Semantically equivalent to
35
- # +method_missing+.
36
- class_inheritable_option :default_api_method
37
-
38
- # Disallow instantiation
39
- private_class_method :new, :allocate
40
-
41
- class << self
42
- include ActionWebService::SignatureTypes
43
-
44
- # API methods have a +name+, which must be the Ruby method name to use when
45
- # performing the invocation on the web service object.
46
- #
47
- # The signatures for the method input parameters and return value can
48
- # by specified in +options+.
49
- #
50
- # A signature is an array of one or more parameter specifiers.
51
- # A parameter specifier can be one of the following:
52
- #
53
- # * A symbol or string representing one of the Action Web Service base types.
54
- # See ActionWebService::SignatureTypes for a canonical list of the base types.
55
- # * The Class object of the parameter type
56
- # * A single-element Array containing one of the two preceding items. This
57
- # will cause Action Web Service to treat the parameter at that position
58
- # as an array containing only values of the given type.
59
- # * A Hash containing as key the name of the parameter, and as value
60
- # one of the three preceding items
61
- #
62
- # If no method input parameter or method return value signatures are given,
63
- # the method is assumed to take no parameters and/or return no values of
64
- # interest, and any values that are received by the server will be
65
- # discarded and ignored.
66
- #
67
- # Valid options:
68
- # [<tt>:expects</tt>] Signature for the method input parameters
69
- # [<tt>:returns</tt>] Signature for the method return value
70
- # [<tt>:expects_and_returns</tt>] Signature for both input parameters and return value
71
- def api_method(name, options={})
72
- unless options.is_a?(Hash)
73
- raise(ActionWebServiceError, "Expected a Hash for options")
74
- end
75
- validate_options([:expects, :returns, :expects_and_returns], options.keys)
76
- if options[:expects_and_returns]
77
- expects = options[:expects_and_returns]
78
- returns = options[:expects_and_returns]
79
- else
80
- expects = options[:expects]
81
- returns = options[:returns]
82
- end
83
- expects = canonical_signature(expects)
84
- returns = canonical_signature(returns)
85
- if expects
86
- expects.each do |type|
87
- type = type.element_type if type.is_a?(ArrayType)
88
- if type.type_class.ancestors.include?(ActiveRecord::Base) && !allow_active_record_expects
89
- raise(ActionWebServiceError, "ActiveRecord model classes not allowed in :expects")
90
- end
91
- end
92
- end
93
- name = name.to_sym
94
- public_name = public_api_method_name(name)
95
- method = Method.new(name, public_name, expects, returns)
96
- write_inheritable_hash("api_methods", name => method)
97
- write_inheritable_hash("api_public_method_names", public_name => name)
98
- end
99
-
100
- # Whether the given method name is a service method on this API
101
- #
102
- # class ProjectsApi < ActionWebService::API::Base
103
- # api_method :getCount, :returns => [:int]
104
- # end
105
- #
106
- # ProjectsApi.has_api_method?('GetCount') #=> false
107
- # ProjectsApi.has_api_method?(:getCount) #=> true
108
- def has_api_method?(name)
109
- api_methods.has_key?(name)
110
- end
111
-
112
- # Whether the given public method name has a corresponding service method
113
- # on this API
114
- #
115
- # class ProjectsApi < ActionWebService::API::Base
116
- # api_method :getCount, :returns => [:int]
117
- # end
118
- #
119
- # ProjectsApi.has_api_method?(:getCount) #=> false
120
- # ProjectsApi.has_api_method?('GetCount') #=> true
121
- def has_public_api_method?(public_name)
122
- api_public_method_names.has_key?(public_name)
123
- end
124
-
125
- # The corresponding public method name for the given service method name
126
- #
127
- # ProjectsApi.public_api_method_name('GetCount') #=> "GetCount"
128
- # ProjectsApi.public_api_method_name(:getCount) #=> "GetCount"
129
- def public_api_method_name(name)
130
- if inflect_names
131
- name.to_s.camelize
132
- else
133
- name.to_s
134
- end
135
- end
136
-
137
- # The corresponding service method name for the given public method name
138
- #
139
- # class ProjectsApi < ActionWebService::API::Base
140
- # api_method :getCount, :returns => [:int]
141
- # end
142
- #
143
- # ProjectsApi.api_method_name('GetCount') #=> :getCount
144
- def api_method_name(public_name)
145
- api_public_method_names[public_name]
146
- end
147
-
148
- # A Hash containing all service methods on this API, and their
149
- # associated metadata.
150
- #
151
- # class ProjectsApi < ActionWebService::API::Base
152
- # api_method :getCount, :returns => [:int]
153
- # api_method :getCompletedCount, :returns => [:int]
154
- # end
155
- #
156
- # ProjectsApi.api_methods #=>
157
- # {:getCount=>#<ActionWebService::API::Method:0x24379d8 ...>,
158
- # :getCompletedCount=>#<ActionWebService::API::Method:0x2437794 ...>}
159
- # ProjectsApi.api_methods[:getCount].public_name #=> "GetCount"
160
- def api_methods
161
- read_inheritable_attribute("api_methods") || {}
162
- end
163
-
164
- # The Method instance for the given public API method name, if any
165
- #
166
- # class ProjectsApi < ActionWebService::API::Base
167
- # api_method :getCount, :returns => [:int]
168
- # api_method :getCompletedCount, :returns => [:int]
169
- # end
170
- #
171
- # ProjectsApi.public_api_method_instance('GetCount') #=> <#<ActionWebService::API::Method:0x24379d8 ...>
172
- # ProjectsApi.public_api_method_instance(:getCount) #=> nil
173
- def public_api_method_instance(public_method_name)
174
- api_method_instance(api_method_name(public_method_name))
175
- end
176
-
177
- # The Method instance for the given API method name, if any
178
- #
179
- # class ProjectsApi < ActionWebService::API::Base
180
- # api_method :getCount, :returns => [:int]
181
- # api_method :getCompletedCount, :returns => [:int]
182
- # end
183
- #
184
- # ProjectsApi.api_method_instance(:getCount) #=> <ActionWebService::API::Method:0x24379d8 ...>
185
- # ProjectsApi.api_method_instance('GetCount') #=> <ActionWebService::API::Method:0x24379d8 ...>
186
- def api_method_instance(method_name)
187
- api_methods[method_name]
188
- end
189
-
190
- # The Method instance for the default API method, if any
191
- def default_api_method_instance
192
- return nil unless name = default_api_method
193
- instance = read_inheritable_attribute("default_api_method_instance")
194
- if instance && instance.name == name
195
- return instance
196
- end
197
- instance = Method.new(name, public_api_method_name(name), nil, nil)
198
- write_inheritable_attribute("default_api_method_instance", instance)
199
- instance
200
- end
201
-
202
- private
203
- def api_public_method_names
204
- read_inheritable_attribute("api_public_method_names") || {}
205
- end
206
-
207
- def validate_options(valid_option_keys, supplied_option_keys)
208
- unknown_option_keys = supplied_option_keys - valid_option_keys
209
- unless unknown_option_keys.empty?
210
- raise(ActionWebServiceError, "Unknown options: #{unknown_option_keys}")
211
- end
212
- end
213
- end
214
- end
215
-
216
- # Represents an API method and its associated metadata, and provides functionality
217
- # to assist in commonly performed API method tasks.
218
- class Method
219
- attr :name
220
- attr :public_name
221
- attr :expects
222
- attr :returns
223
-
224
- def initialize(name, public_name, expects, returns)
225
- @name = name
226
- @public_name = public_name
227
- @expects = expects
228
- @returns = returns
229
- @caster = ActionWebService::Casting::BaseCaster.new(self)
230
- end
231
-
232
- # The list of parameter names for this method
233
- def param_names
234
- return [] unless @expects
235
- @expects.map{ |type| type.name }
236
- end
237
-
238
- # Casts a set of Ruby values into the expected Ruby values
239
- def cast_expects(params)
240
- @caster.cast_expects(params)
241
- end
242
-
243
- # Cast a Ruby return value into the expected Ruby value
244
- def cast_returns(return_value)
245
- @caster.cast_returns(return_value)
246
- end
247
-
248
- # Returns the index of the first expected parameter
249
- # with the given name
250
- def expects_index_of(param_name)
251
- return -1 if @expects.nil?
252
- (0..(@expects.length-1)).each do |i|
253
- return i if @expects[i].name.to_s == param_name.to_s
254
- end
255
- -1
256
- end
257
-
258
- # Returns a hash keyed by parameter name for the given
259
- # parameter list
260
- def expects_to_hash(params)
261
- return {} if @expects.nil?
262
- h = {}
263
- @expects.zip(params){ |type, param| h[type.name] = param }
264
- h
265
- end
266
-
267
- # Backwards compatibility with previous API
268
- def [](sig_type)
269
- case sig_type
270
- when :expects
271
- @expects.map{|x| compat_signature_entry(x)}
272
- when :returns
273
- @returns.map{|x| compat_signature_entry(x)}
274
- end
275
- end
276
-
277
- # String representation of this method
278
- def to_s
279
- fqn = ""
280
- fqn << (@returns ? (@returns[0].human_name(false) + " ") : "void ")
281
- fqn << "#{@public_name}("
282
- fqn << @expects.map{ |p| p.human_name }.join(", ") if @expects
283
- fqn << ")"
284
- fqn
285
- end
286
-
287
- private
288
- def compat_signature_entry(entry)
289
- if entry.array?
290
- [compat_signature_entry(entry.element_type)]
291
- else
292
- if entry.spec.is_a?(Hash)
293
- {entry.spec.keys.first => entry.type_class}
294
- else
295
- entry.type_class
296
- end
297
- end
298
- end
299
- end
300
- end
301
- end