rhodes-framework 1.0.10 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. data/Manifest.txt +159 -30
  2. data/Rakefile +3 -19
  3. data/lib/erb.rb +1 -1
  4. data/lib/rho/rho.rb +94 -107
  5. data/lib/rho/rhofsconnector.rb +4 -0
  6. data/lib/rho/rhoutils.rb +26 -0
  7. data/lib/rho/rhoviewhelpers.rb +1 -1
  8. data/lib/rhodes.rb +2 -2
  9. data/lib/rhoframework.rb +9 -9
  10. data/lib/rhom/rhom.rb +1 -1
  11. data/lib/rhom/rhom_db_adapter.rb +36 -15
  12. data/lib/rhom/rhom_db_adapterME.rb +2 -3
  13. data/lib/rhom/rhom_object.rb +14 -2
  14. data/lib/rhom/rhom_object_factory.rb +42 -11
  15. data/lib/version.rb +2 -2
  16. data/spec/README +1 -0
  17. data/spec/Rakefile +1 -0
  18. data/spec/{configs/account.rb → app/Account/config.rb} +0 -0
  19. data/spec/{configs/case.rb → app/Case/config.rb} +0 -0
  20. data/spec/app/Question/config.rb +3 -0
  21. data/spec/app/Settings/controller.rb +10 -0
  22. data/spec/app/Settings/index.erb +11 -0
  23. data/spec/app/SpecRunner/controller.rb +15 -0
  24. data/spec/app/SpecRunner/index.erb +14 -0
  25. data/spec/app/application.rb +4 -0
  26. data/spec/app/index.erb +17 -0
  27. data/spec/app/layout.erb +27 -0
  28. data/spec/app/loading.html +11 -0
  29. data/spec/app/mspec.rb +11 -0
  30. data/spec/app/mspec/expectations.rb +2 -0
  31. data/spec/app/mspec/expectations/expectations.rb +17 -0
  32. data/spec/app/mspec/expectations/should.rb +25 -0
  33. data/spec/app/mspec/fileutils.rb +1590 -0
  34. data/spec/app/mspec/guards.rb +16 -0
  35. data/spec/app/mspec/guards/background.rb +21 -0
  36. data/spec/app/mspec/guards/bug.rb +24 -0
  37. data/spec/app/mspec/guards/compliance.rb +37 -0
  38. data/spec/app/mspec/guards/conflict.rb +18 -0
  39. data/spec/app/mspec/guards/endian.rb +44 -0
  40. data/spec/app/mspec/guards/extensions.rb +20 -0
  41. data/spec/app/mspec/guards/guard.rb +166 -0
  42. data/spec/app/mspec/guards/noncompliance.rb +20 -0
  43. data/spec/app/mspec/guards/platform.rb +43 -0
  44. data/spec/app/mspec/guards/quarantine.rb +17 -0
  45. data/spec/app/mspec/guards/runner.rb +34 -0
  46. data/spec/app/mspec/guards/superuser.rb +17 -0
  47. data/spec/app/mspec/guards/support.rb +20 -0
  48. data/spec/app/mspec/guards/tty.rb +20 -0
  49. data/spec/app/mspec/guards/version.rb +38 -0
  50. data/spec/app/mspec/helpers.rb +11 -0
  51. data/spec/app/mspec/helpers/argv.rb +43 -0
  52. data/spec/app/mspec/helpers/bignum.rb +5 -0
  53. data/spec/app/mspec/helpers/const_lookup.rb +9 -0
  54. data/spec/app/mspec/helpers/environment.rb +23 -0
  55. data/spec/app/mspec/helpers/fixture.rb +20 -0
  56. data/spec/app/mspec/helpers/flunk.rb +5 -0
  57. data/spec/app/mspec/helpers/io.rb +17 -0
  58. data/spec/app/mspec/helpers/language_version.rb +20 -0
  59. data/spec/app/mspec/helpers/ruby_exe.rb +123 -0
  60. data/spec/app/mspec/helpers/scratch.rb +17 -0
  61. data/spec/app/mspec/helpers/tmp.rb +32 -0
  62. data/spec/app/mspec/matchers.rb +23 -0
  63. data/spec/app/mspec/matchers/base.rb +95 -0
  64. data/spec/app/mspec/matchers/be_an_instance_of.rb +26 -0
  65. data/spec/app/mspec/matchers/be_ancestor_of.rb +24 -0
  66. data/spec/app/mspec/matchers/be_close.rb +27 -0
  67. data/spec/app/mspec/matchers/be_empty.rb +20 -0
  68. data/spec/app/mspec/matchers/be_false.rb +20 -0
  69. data/spec/app/mspec/matchers/be_kind_of.rb +24 -0
  70. data/spec/app/mspec/matchers/be_nil.rb +20 -0
  71. data/spec/app/mspec/matchers/be_true.rb +20 -0
  72. data/spec/app/mspec/matchers/complain.rb +56 -0
  73. data/spec/app/mspec/matchers/eql.rb +26 -0
  74. data/spec/app/mspec/matchers/equal.rb +26 -0
  75. data/spec/app/mspec/matchers/equal_element.rb +78 -0
  76. data/spec/app/mspec/matchers/equal_utf16.rb +34 -0
  77. data/spec/app/mspec/matchers/have_constant.rb +30 -0
  78. data/spec/app/mspec/matchers/have_instance_method.rb +24 -0
  79. data/spec/app/mspec/matchers/have_method.rb +24 -0
  80. data/spec/app/mspec/matchers/have_private_instance_method.rb +24 -0
  81. data/spec/app/mspec/matchers/include.rb +32 -0
  82. data/spec/app/mspec/matchers/match_yaml.rb +47 -0
  83. data/spec/app/mspec/matchers/method.rb +14 -0
  84. data/spec/app/mspec/matchers/output.rb +67 -0
  85. data/spec/app/mspec/matchers/output_to_fd.rb +71 -0
  86. data/spec/app/mspec/matchers/raise_error.rb +48 -0
  87. data/spec/app/mspec/matchers/respond_to.rb +24 -0
  88. data/spec/app/mspec/matchers/stringsymboladapter.rb +8 -0
  89. data/spec/app/mspec/mocks.rb +3 -0
  90. data/spec/app/mspec/mocks/mock.rb +159 -0
  91. data/spec/app/mspec/mocks/object.rb +20 -0
  92. data/spec/app/mspec/mocks/proxy.rb +136 -0
  93. data/spec/app/mspec/pp.rb +893 -0
  94. data/spec/app/mspec/runner.rb +15 -0
  95. data/spec/app/mspec/runner/actions.rb +8 -0
  96. data/spec/app/mspec/runner/actions/debug.rb +17 -0
  97. data/spec/app/mspec/runner/actions/filter.rb +40 -0
  98. data/spec/app/mspec/runner/actions/gdb.rb +17 -0
  99. data/spec/app/mspec/runner/actions/tag.rb +133 -0
  100. data/spec/app/mspec/runner/actions/taglist.rb +56 -0
  101. data/spec/app/mspec/runner/actions/tagpurge.rb +56 -0
  102. data/spec/app/mspec/runner/actions/tally.rb +116 -0
  103. data/spec/app/mspec/runner/actions/timer.rb +22 -0
  104. data/spec/app/mspec/runner/context.rb +188 -0
  105. data/spec/app/mspec/runner/example.rb +34 -0
  106. data/spec/app/mspec/runner/exception.rb +43 -0
  107. data/spec/app/mspec/runner/filters.rb +4 -0
  108. data/spec/app/mspec/runner/filters/match.rb +22 -0
  109. data/spec/app/mspec/runner/filters/profile.rb +54 -0
  110. data/spec/app/mspec/runner/filters/regexp.rb +7 -0
  111. data/spec/app/mspec/runner/filters/tag.rb +29 -0
  112. data/spec/app/mspec/runner/formatters.rb +10 -0
  113. data/spec/app/mspec/runner/formatters/describe.rb +24 -0
  114. data/spec/app/mspec/runner/formatters/dotted.rb +98 -0
  115. data/spec/app/mspec/runner/formatters/file.rb +19 -0
  116. data/spec/app/mspec/runner/formatters/html.rb +81 -0
  117. data/spec/app/mspec/runner/formatters/method.rb +93 -0
  118. data/spec/app/mspec/runner/formatters/specdoc.rb +41 -0
  119. data/spec/app/mspec/runner/formatters/spinner.rb +99 -0
  120. data/spec/app/mspec/runner/formatters/summary.rb +11 -0
  121. data/spec/app/mspec/runner/formatters/unit.rb +21 -0
  122. data/spec/app/mspec/runner/formatters/yaml.rb +44 -0
  123. data/spec/app/mspec/runner/mspec.rb +361 -0
  124. data/spec/app/mspec/runner/object.rb +24 -0
  125. data/spec/app/mspec/runner/shared.rb +12 -0
  126. data/spec/app/mspec/runner/tag.rb +32 -0
  127. data/spec/app/mspec/utils/name_map.rb +129 -0
  128. data/spec/app/mspec/utils/options.rb +441 -0
  129. data/spec/app/mspec/utils/ruby_name.rb +8 -0
  130. data/spec/app/mspec/utils/script.rb +220 -0
  131. data/spec/app/mspec/utils/version.rb +53 -0
  132. data/spec/app/mspec/version.rb +5 -0
  133. data/spec/app/spec/fixtures/client_info.txt +2 -0
  134. data/spec/app/spec/fixtures/object_values.txt +90 -0
  135. data/spec/{rho_controller_spec.rb → app/spec/rho_controller_spec.rb} +4 -7
  136. data/spec/{rho_spec.rb → app/spec/rho_spec.rb} +15 -36
  137. data/spec/{rhom_object_factory_spec.rb → app/spec/rhom_object_factory_spec.rb} +108 -72
  138. data/spec/{rhom_spec.rb → app/spec/rhom_spec.rb} +8 -4
  139. data/spec/app/spec/spec_helper.rb +15 -0
  140. data/spec/app/spec/webview_spec.rb +27 -0
  141. data/spec/app/spec_runner.rb +26 -0
  142. data/spec/build.yml +28 -0
  143. data/spec/public/css/base.css +39 -0
  144. data/spec/public/css/blackberry.css +99 -0
  145. data/spec/public/css/iphone.css +392 -0
  146. data/spec/public/css/rho.css +3 -0
  147. data/spec/public/css/xhtml.css +114 -0
  148. data/spec/public/images/IUI_LICENSE.txt +21 -0
  149. data/spec/public/images/backButton.png +0 -0
  150. data/spec/public/images/blueButton.png +0 -0
  151. data/spec/public/images/cancel.png +0 -0
  152. data/spec/public/images/grayButton.png +0 -0
  153. data/spec/public/images/iui-logo-touch-icon.png +0 -0
  154. data/spec/public/images/listArrow.png +0 -0
  155. data/spec/public/images/listArrowSel.png +0 -0
  156. data/spec/public/images/listGroup.png +0 -0
  157. data/spec/public/images/loading.gif +0 -0
  158. data/spec/public/images/pinstripes.png +0 -0
  159. data/spec/public/images/right_button.png +0 -0
  160. data/spec/public/images/selection.png +0 -0
  161. data/spec/public/images/thumb.png +0 -0
  162. data/spec/public/images/toggle.png +0 -0
  163. data/spec/public/images/toggleOn.png +0 -0
  164. data/spec/public/images/toolButton.png +0 -0
  165. data/spec/public/images/toolButton_new.png +0 -0
  166. data/spec/public/images/toolbar.png +0 -0
  167. data/spec/public/images/whiteButton.png +0 -0
  168. data/spec/public/js/application.js +1 -0
  169. data/spec/public/js/jquery-1.2.6.min.js +32 -0
  170. data/spec/public/js/rho.js +4 -0
  171. data/spec/public/js/rhogeolocation-wm.js +59 -0
  172. data/spec/public/js/rhogeolocation.js +11 -0
  173. data/spec/rhoconfig.txt +19 -0
  174. metadata +169 -39
  175. data/History.txt +0 -37
  176. data/README.rdoc +0 -2
  177. data/lib/TestServe.rb +0 -9
  178. data/res/sqlite3/constants.rb +0 -49
  179. data/res/sqlite3/database.rb +0 -715
  180. data/res/sqlite3/driver/dl/api.rb +0 -154
  181. data/res/sqlite3/driver/dl/driver.rb +0 -307
  182. data/res/sqlite3/driver/native/driver.rb +0 -257
  183. data/res/sqlite3/errors.rb +0 -68
  184. data/res/sqlite3/pragmas.rb +0 -271
  185. data/res/sqlite3/resultset.rb +0 -176
  186. data/res/sqlite3/sqlite3_api.rb +0 -0
  187. data/res/sqlite3/statement.rb +0 -230
  188. data/res/sqlite3/translator.rb +0 -109
  189. data/res/sqlite3/value.rb +0 -57
  190. data/res/sqlite3/version.rb +0 -14
  191. data/rhodes.gemspec +0 -18
  192. data/spec/app_manifest.txt +0 -4
  193. data/spec/configs/contact.rb +0 -3
  194. data/spec/configs/employee.rb +0 -3
  195. data/spec/spec.opts +0 -1
  196. data/spec/spec_helper.rb +0 -49
  197. data/spec/stubs.rb +0 -39
  198. data/spec/syncdbtest.sqlite +0 -0
data/Manifest.txt CHANGED
@@ -1,10 +1,7 @@
1
1
  .gitignore
2
- History.txt
3
2
  Manifest.txt
4
- README.rdoc
5
3
  Rakefile
6
4
  lib/ServeME.rb
7
- lib/TestServe.rb
8
5
  lib/bsearch.rb
9
6
  lib/builtinME.rb
10
7
  lib/date.rb
@@ -22,6 +19,7 @@ lib/rho/rhocontact.rb
22
19
  lib/rho/rhocontroller.rb
23
20
  lib/rho/rhofsconnector.rb
24
21
  lib/rho/rhosupport.rb
22
+ lib/rho/rhoutils.rb
25
23
  lib/rho/rhoviewhelpers.rb
26
24
  lib/rhodes-framework.rb
27
25
  lib/rhodes.rb
@@ -37,31 +35,162 @@ lib/rhom/rhom_source.rb
37
35
  lib/singleton.rb
38
36
  lib/time.rb
39
37
  lib/version.rb
40
- res/sqlite3/constants.rb
41
- res/sqlite3/database.rb
42
- res/sqlite3/driver/dl/api.rb
43
- res/sqlite3/driver/dl/driver.rb
44
- res/sqlite3/driver/native/driver.rb
45
- res/sqlite3/errors.rb
46
- res/sqlite3/pragmas.rb
47
- res/sqlite3/resultset.rb
48
- res/sqlite3/sqlite3_api.rb
49
- res/sqlite3/statement.rb
50
- res/sqlite3/translator.rb
51
- res/sqlite3/value.rb
52
- res/sqlite3/version.rb
53
38
  rhodes-framework.gemspec
54
- rhodes.gemspec
55
- spec/app_manifest.txt
56
- spec/configs/account.rb
57
- spec/configs/case.rb
58
- spec/configs/contact.rb
59
- spec/configs/employee.rb
60
- spec/rho_controller_spec.rb
61
- spec/rho_spec.rb
62
- spec/rhom_object_factory_spec.rb
63
- spec/rhom_spec.rb
64
- spec/spec.opts
65
- spec/spec_helper.rb
66
- spec/stubs.rb
67
- spec/syncdbtest.sqlite
39
+ spec/README
40
+ spec/Rakefile
41
+ spec/app/Account/config.rb
42
+ spec/app/Case/config.rb
43
+ spec/app/Question/config.rb
44
+ spec/app/Settings/controller.rb
45
+ spec/app/Settings/index.erb
46
+ spec/app/SpecRunner/controller.rb
47
+ spec/app/SpecRunner/index.erb
48
+ spec/app/application.rb
49
+ spec/app/index.erb
50
+ spec/app/layout.erb
51
+ spec/app/loading.html
52
+ spec/app/mspec.rb
53
+ spec/app/mspec/expectations.rb
54
+ spec/app/mspec/expectations/expectations.rb
55
+ spec/app/mspec/expectations/should.rb
56
+ spec/app/mspec/fileutils.rb
57
+ spec/app/mspec/guards.rb
58
+ spec/app/mspec/guards/background.rb
59
+ spec/app/mspec/guards/bug.rb
60
+ spec/app/mspec/guards/compliance.rb
61
+ spec/app/mspec/guards/conflict.rb
62
+ spec/app/mspec/guards/endian.rb
63
+ spec/app/mspec/guards/extensions.rb
64
+ spec/app/mspec/guards/guard.rb
65
+ spec/app/mspec/guards/noncompliance.rb
66
+ spec/app/mspec/guards/platform.rb
67
+ spec/app/mspec/guards/quarantine.rb
68
+ spec/app/mspec/guards/runner.rb
69
+ spec/app/mspec/guards/superuser.rb
70
+ spec/app/mspec/guards/support.rb
71
+ spec/app/mspec/guards/tty.rb
72
+ spec/app/mspec/guards/version.rb
73
+ spec/app/mspec/helpers.rb
74
+ spec/app/mspec/helpers/argv.rb
75
+ spec/app/mspec/helpers/bignum.rb
76
+ spec/app/mspec/helpers/const_lookup.rb
77
+ spec/app/mspec/helpers/environment.rb
78
+ spec/app/mspec/helpers/fixture.rb
79
+ spec/app/mspec/helpers/flunk.rb
80
+ spec/app/mspec/helpers/io.rb
81
+ spec/app/mspec/helpers/language_version.rb
82
+ spec/app/mspec/helpers/ruby_exe.rb
83
+ spec/app/mspec/helpers/scratch.rb
84
+ spec/app/mspec/helpers/tmp.rb
85
+ spec/app/mspec/matchers.rb
86
+ spec/app/mspec/matchers/base.rb
87
+ spec/app/mspec/matchers/be_an_instance_of.rb
88
+ spec/app/mspec/matchers/be_ancestor_of.rb
89
+ spec/app/mspec/matchers/be_close.rb
90
+ spec/app/mspec/matchers/be_empty.rb
91
+ spec/app/mspec/matchers/be_false.rb
92
+ spec/app/mspec/matchers/be_kind_of.rb
93
+ spec/app/mspec/matchers/be_nil.rb
94
+ spec/app/mspec/matchers/be_true.rb
95
+ spec/app/mspec/matchers/complain.rb
96
+ spec/app/mspec/matchers/eql.rb
97
+ spec/app/mspec/matchers/equal.rb
98
+ spec/app/mspec/matchers/equal_element.rb
99
+ spec/app/mspec/matchers/equal_utf16.rb
100
+ spec/app/mspec/matchers/have_constant.rb
101
+ spec/app/mspec/matchers/have_instance_method.rb
102
+ spec/app/mspec/matchers/have_method.rb
103
+ spec/app/mspec/matchers/have_private_instance_method.rb
104
+ spec/app/mspec/matchers/include.rb
105
+ spec/app/mspec/matchers/match_yaml.rb
106
+ spec/app/mspec/matchers/method.rb
107
+ spec/app/mspec/matchers/output.rb
108
+ spec/app/mspec/matchers/output_to_fd.rb
109
+ spec/app/mspec/matchers/raise_error.rb
110
+ spec/app/mspec/matchers/respond_to.rb
111
+ spec/app/mspec/matchers/stringsymboladapter.rb
112
+ spec/app/mspec/mocks.rb
113
+ spec/app/mspec/mocks/mock.rb
114
+ spec/app/mspec/mocks/object.rb
115
+ spec/app/mspec/mocks/proxy.rb
116
+ spec/app/mspec/pp.rb
117
+ spec/app/mspec/runner.rb
118
+ spec/app/mspec/runner/actions.rb
119
+ spec/app/mspec/runner/actions/debug.rb
120
+ spec/app/mspec/runner/actions/filter.rb
121
+ spec/app/mspec/runner/actions/gdb.rb
122
+ spec/app/mspec/runner/actions/tag.rb
123
+ spec/app/mspec/runner/actions/taglist.rb
124
+ spec/app/mspec/runner/actions/tagpurge.rb
125
+ spec/app/mspec/runner/actions/tally.rb
126
+ spec/app/mspec/runner/actions/timer.rb
127
+ spec/app/mspec/runner/context.rb
128
+ spec/app/mspec/runner/example.rb
129
+ spec/app/mspec/runner/exception.rb
130
+ spec/app/mspec/runner/filters.rb
131
+ spec/app/mspec/runner/filters/match.rb
132
+ spec/app/mspec/runner/filters/profile.rb
133
+ spec/app/mspec/runner/filters/regexp.rb
134
+ spec/app/mspec/runner/filters/tag.rb
135
+ spec/app/mspec/runner/formatters.rb
136
+ spec/app/mspec/runner/formatters/describe.rb
137
+ spec/app/mspec/runner/formatters/dotted.rb
138
+ spec/app/mspec/runner/formatters/file.rb
139
+ spec/app/mspec/runner/formatters/html.rb
140
+ spec/app/mspec/runner/formatters/method.rb
141
+ spec/app/mspec/runner/formatters/specdoc.rb
142
+ spec/app/mspec/runner/formatters/spinner.rb
143
+ spec/app/mspec/runner/formatters/summary.rb
144
+ spec/app/mspec/runner/formatters/unit.rb
145
+ spec/app/mspec/runner/formatters/yaml.rb
146
+ spec/app/mspec/runner/mspec.rb
147
+ spec/app/mspec/runner/object.rb
148
+ spec/app/mspec/runner/shared.rb
149
+ spec/app/mspec/runner/tag.rb
150
+ spec/app/mspec/utils/name_map.rb
151
+ spec/app/mspec/utils/options.rb
152
+ spec/app/mspec/utils/ruby_name.rb
153
+ spec/app/mspec/utils/script.rb
154
+ spec/app/mspec/utils/version.rb
155
+ spec/app/mspec/version.rb
156
+ spec/app/spec/fixtures/client_info.txt
157
+ spec/app/spec/fixtures/object_values.txt
158
+ spec/app/spec/rho_controller_spec.rb
159
+ spec/app/spec/rho_spec.rb
160
+ spec/app/spec/rhom_object_factory_spec.rb
161
+ spec/app/spec/rhom_spec.rb
162
+ spec/app/spec/spec_helper.rb
163
+ spec/app/spec/webview_spec.rb
164
+ spec/app/spec_runner.rb
165
+ spec/build.yml
166
+ spec/public/css/base.css
167
+ spec/public/css/blackberry.css
168
+ spec/public/css/iphone.css
169
+ spec/public/css/rho.css
170
+ spec/public/css/xhtml.css
171
+ spec/public/images/IUI_LICENSE.txt
172
+ spec/public/images/backButton.png
173
+ spec/public/images/blueButton.png
174
+ spec/public/images/cancel.png
175
+ spec/public/images/grayButton.png
176
+ spec/public/images/iui-logo-touch-icon.png
177
+ spec/public/images/listArrow.png
178
+ spec/public/images/listArrowSel.png
179
+ spec/public/images/listGroup.png
180
+ spec/public/images/loading.gif
181
+ spec/public/images/pinstripes.png
182
+ spec/public/images/right_button.png
183
+ spec/public/images/selection.png
184
+ spec/public/images/thumb.png
185
+ spec/public/images/toggle.png
186
+ spec/public/images/toggleOn.png
187
+ spec/public/images/toolButton.png
188
+ spec/public/images/toolButton_new.png
189
+ spec/public/images/toolbar.png
190
+ spec/public/images/whiteButton.png
191
+ spec/public/js/application.js
192
+ spec/public/js/jquery-1.2.6.min.js
193
+ spec/public/js/rho.js
194
+ spec/public/js/rhogeolocation-wm.js
195
+ spec/public/js/rhogeolocation.js
196
+ spec/rhoconfig.txt
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- %w[rubygems rake rake/clean fileutils newgem spec/rake/spectask].each { |f| require f }
1
+ %w[rubygems rake rake/clean fileutils newgem].each { |f| require f }
2
2
  $:.unshift(File.join(File.dirname(__FILE__), 'lib'))
3
3
  require 'lib/version.rb'
4
4
 
@@ -8,7 +8,7 @@ task :default => [:spec]
8
8
  # Run 'rake -T' to see list of generated tasks (from gem root directory)
9
9
  $hoe = Hoe.new('rhodes-framework', RhodesFramework::VERSION) do |p|
10
10
  p.developer('Rhomobile Dev', 'dev@rhomobile.com')
11
- p.changes = p.paragraphs_of("../History.txt", 0..1).join("\n\n") if File.exists? "../History.txt"
11
+ #p.changes = p.paragraphs_of("../History.txt", 0..1).join("\n\n") if File.exists? "../History.txt"
12
12
  #p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
13
13
  p.rubyforge_name = p.name # TODO this is default value
14
14
  p.extra_deps = [
@@ -30,20 +30,4 @@ $hoe = Hoe.new('rhodes-framework', RhodesFramework::VERSION) do |p|
30
30
 
31
31
  end
32
32
 
33
- require 'newgem/tasks' # load /tasks/*.rake
34
- # remove test task TODO: why does this run anyway?
35
- Rake.application.remove_task(:test)
36
- Dir['tasks/**/*.rake'].each { |t| load t }
37
-
38
- desc "Run the specs under spec"
39
- Spec::Rake::SpecTask.new do |t|
40
- t.spec_opts = ['--options', "spec/spec.opts"]
41
- t.spec_files = FileList['spec/**/*_spec.rb']
42
- t.rcov = true
43
- t.rcov_opts = ['--include',
44
- '"lib/rhom/*,lib/rho/*"',
45
- '-x',
46
- 'spec,gems,sqlite3/*,lib/date.rb,lib/rational.rb,lib/time.rb,lib/find.rb,config.rb,lib/erb.rb,lib/singleton.rb,lib/pairparser.rb',
47
- '--text-report',
48
- '--html']
49
- end
33
+ require 'newgem/tasks'
data/lib/erb.rb CHANGED
@@ -720,7 +720,7 @@ class ERB
720
720
  compiler.insert_cmd = "#{eoutvar}.concat"
721
721
 
722
722
  cmd = []
723
- cmd.push "#{eoutvar} = ''"
723
+ cmd.push "#{eoutvar} = ''; #{eoutvar}.force_encoding('utf-8')"
724
724
 
725
725
  compiler.pre_cmd = cmd
726
726
 
data/lib/rho/rho.rb CHANGED
@@ -7,9 +7,10 @@ require 'rhofsconnector'
7
7
  module Rho
8
8
  class RHO
9
9
  APPLICATIONS = {}
10
-
10
+
11
11
  def initialize(app_manifest_filename=nil)
12
12
  puts "Calling RHO.initialize"
13
+ process_rhoconfig
13
14
  Rhom::RhomDbAdapter::open(Rho::RhoFSConnector::get_db_fullpathname)
14
15
  if app_manifest_filename
15
16
  process_model_dirs(app_manifest_filename)
@@ -31,6 +32,23 @@ module Rho
31
32
  end
32
33
  end
33
34
 
35
+ # Return the directories where we need to load configuration files
36
+ def process_rhoconfig
37
+ begin
38
+ File.open(Rho::RhoFSConnector.get_rhoconfig_filename).each do |line|
39
+ parts = line.chop.split('=')
40
+ key = parts[0]
41
+ value = parts[1..parts.length-1].join('=') if parts and parts.length > 1
42
+ if key and value
43
+ tmp = value.strip!
44
+ Rho::RhoConfig.config[key.strip] = tmp.gsub(/'|"/,'') if tmp
45
+ end
46
+ end
47
+ rescue Exception => e
48
+ puts "Error opening rhoconfig.txt: #{e}, using defaults."
49
+ end
50
+ end
51
+
34
52
  # setup the sources table and model attributes for all applications
35
53
  def init_sources
36
54
  if defined? Rho::RhoConfig::sources
@@ -39,7 +57,7 @@ module Rho
39
57
  uniq_sources = Rho::RhoConfig::sources.values.inject([]) { |result,h|
40
58
  result << h unless result.include?(h); result
41
59
  }
42
-
60
+
43
61
  # generate unique source list in database for sync
44
62
  uniq_sources.each do |source|
45
63
 
@@ -56,7 +74,7 @@ module Rho
56
74
  def source_initialized?(source_id)
57
75
  Rhom::RhomDbAdapter::select_from_table('sources','*', 'source_id'=>source_id).size > 0 ? true : false
58
76
  end
59
-
77
+
60
78
  def get_app(appname)
61
79
  if (APPLICATIONS[appname].nil?)
62
80
  require RhoApplication::get_app_path(appname)+'application'
@@ -66,66 +84,50 @@ module Rho
66
84
  APPLICATIONS[appname]
67
85
  end
68
86
 
69
- def get_start_path
70
- Rho::RhoConfig.start_path
71
- end
72
-
73
- def get_options_path
74
- Rho::RhoConfig.options_path
75
- end
76
-
77
- def get_rhobundle_zip_url
78
- Rho::RhoConfig.rhobundle_zip_url
79
- end
80
-
81
- def get_rhobundle_zip_pwd
82
- Rho::RhoConfig.rhobundle_zip_pwd
83
- end
84
-
85
87
  def serve(req)
86
88
  begin
87
- puts 'inside RHO.serve...'
89
+ puts 'inside RHO.serve...'
88
90
  res = init_response
89
91
  get_app(req['application']).send :serve, req, res
90
92
  return send_response(res)
91
93
  rescue Exception => e
92
94
  return send_error(e)
93
- end
95
+ end
94
96
  end
95
97
 
96
98
  def serve_hash(req)
97
- begin
98
- puts 'inside RHO.serve...'
99
- res = init_response
100
- get_app(req['application']).send :serve, req, res
101
- return send_response_hash(res)
102
- rescue Exception => e
103
- return send_error(e,500,true)
104
- end
105
- end
106
-
107
- def serve_index(index_name)
108
- begin
109
- puts 'inside RHO.serve_index: ' + index_name
110
- res = init_response
111
- res['request-body'] = RhoController::renderfile(index_name)
112
- return send_response(res)
113
- rescue Exception => e
114
- return send_error(e)
115
- end
116
- end
99
+ begin
100
+ puts 'inside RHO.serve...'
101
+ res = init_response
102
+ get_app(req['application']).send :serve, req, res
103
+ return send_response_hash(res)
104
+ rescue Exception => e
105
+ return send_error(e,500,true)
106
+ end
107
+ end
108
+
109
+ def serve_index(index_name)
110
+ begin
111
+ puts 'inside RHO.serve_index: ' + index_name
112
+ res = init_response
113
+ res['request-body'] = RhoController::renderfile(index_name)
114
+ return send_response(res)
115
+ rescue Exception => e
116
+ return send_error(e)
117
+ end
118
+ end
117
119
 
118
- def serve_index_hash(index_name)
119
- begin
120
- puts 'inside RHO.serve_index: ' + index_name
121
- res = init_response
122
- res['request-body'] = RhoController::renderfile(index_name)
123
- return send_response_hash(res)
124
- rescue Exception => e
125
- return send_error(e.message, 500, true)
126
- end
127
- end
128
-
120
+ def serve_index_hash(index_name)
121
+ begin
122
+ puts 'inside RHO.serve_index: ' + index_name
123
+ res = init_response
124
+ res['request-body'] = RhoController::renderfile(index_name)
125
+ return send_response_hash(res)
126
+ rescue Exception => e
127
+ return send_error(e.message, 500, true)
128
+ end
129
+ end
130
+
129
131
  def init_response(status=200,message="OK",body="")
130
132
  res = Hash.new
131
133
  res['status'] = status
@@ -144,7 +146,7 @@ module Rho
144
146
  CR = "\x0d"
145
147
  LF = "\x0a"
146
148
  CRLF = "\x0d\x0a"
147
-
149
+
148
150
  def send_response(res)
149
151
  res['headers']['Content-Length'] = res['request-body'].nil? ? 0 : res['request-body'].length
150
152
  data = "HTTP/1.1 #{res['status'].to_s} #{res['message']}" + CRLF
@@ -152,43 +154,52 @@ module Rho
152
154
  tmp = key.gsub(/\bwww|^te$|\b\w/){|s| s.upcase }
153
155
  data << "#{tmp}: #{value}" << CRLF
154
156
  }
157
+ data << "Pragma: no-cache" << CRLF
158
+ data << "Cache-Control: must-revalidate" << CRLF
159
+ data << "Cache-Control: no-cache" << CRLF
160
+ data << "Cache-Control: no-store" << CRLF
161
+ data << "Expires: 0" << CRLF
162
+
155
163
  data << CRLF
156
- data << res['request-body']
164
+ if ( !res['request-body'].nil? )
165
+ data << res['request-body']
166
+ end
167
+
157
168
  data
158
169
  end
159
170
 
160
171
  def send_response_hash(res)
161
- resp = Hash.new
162
- res['headers']['Content-Length'] = res['request-body'].nil? ? 0 : res['request-body'].length
163
- res['headers'].each{|key, value|
164
- tmp = key.gsub(/\bwww|^te$|\b\w/){|s| s.upcase }
165
- resp[tmp] = value
166
- }
172
+ resp = Hash.new
173
+ res['headers']['Content-Length'] = res['request-body'].nil? ? 0 : res['request-body'].length
174
+ res['headers'].each{|key, value|
175
+ tmp = key.gsub(/\bwww|^te$|\b\w/){|s| s.upcase }
176
+ resp[tmp] = value
177
+ }
167
178
  resp['request-body'] = res['request-body']
168
179
  resp['status'] = res['status']
169
180
  resp['message'] = res['message']
170
181
 
171
- resp
182
+ resp
172
183
  end
173
-
184
+
174
185
  def send_error(exception=nil,status=500,hash=false)
175
186
  body=''
176
187
  body << <<-_HTML_STRING_
177
- <html>
178
- <head>
179
- <title>Server Error</title>
180
- <meta name="viewport" content="width=320"/>
181
- </head>
182
- <body>
183
- <p>
188
+ <html>
189
+ <head>
190
+ <title>Server Error</title>
191
+ <meta name="viewport" content="width=320"/>
192
+ </head>
193
+ <body>
194
+ <p>
184
195
  _HTML_STRING_
185
196
  body << 'Error: ' << exception.message << "<br/>" if exception
186
197
  body << 'Trace: ' << exception.backtrace.join("\n") if exception
187
198
  body << <<-_HTML_STRING_
188
- </p>
189
- </body>
190
- </html>
191
-
199
+ </p>
200
+ </body>
201
+ </html>
202
+
192
203
  _HTML_STRING_
193
204
  if ( hash )
194
205
  send_response_hash(init_response(status,"Server error",body))
@@ -200,47 +211,23 @@ module Rho
200
211
 
201
212
  # Generic configuration class which accepts hashes with unique keys
202
213
  class RhoConfig
214
+
203
215
  @@sources = {}
204
- @@start_path = '/'
205
- @@options_path = '/'
206
- @@rhobundle_zip_url = nil
207
- @@rhobundle_zip_pwd = nil
216
+ @@config = {'start_path' => '/app',
217
+ 'options_path' => '/app/Settings'}
208
218
 
209
219
  class << self
210
- def sources
211
- @@sources
220
+ def method_missing(name, *args)
221
+ varname = name.to_s.sub(/=/,'')
222
+ @@config[varname]
212
223
  end
213
224
 
214
- def options_path
215
- @@options_path
216
- end
217
-
218
- def options_path=(path=nil)
219
- @@options_path = path if path
220
- end
221
-
222
- def start_path
223
- @@start_path
224
- end
225
-
226
- def start_path=(path=nil)
227
- @@start_path = path if path
228
- end
229
-
230
- def rhobundle_zip_url
231
- @@rhobundle_zip_url
232
- end
233
-
234
- def rhobundle_zip_url=(url=nil)
235
- @@rhobundle_zip_url = url
225
+ def sources
226
+ @@sources
236
227
  end
237
228
 
238
- def rhobundle_zip_pwd
239
- @@rhobundle_zip_pwd
240
- end
241
-
242
- def rhobundle_zip_pwd=(pwd=nil)
243
- @@rhobundle_zip_pwd = pwd
229
+ def config
230
+ @@config
244
231
  end
245
232
 
246
233
  def add_source(modelname, new_source=nil)