ccls-ccls_engine 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. data/README.rdoc +182 -0
  2. data/app/models/abstract.rb +181 -0
  3. data/app/models/abstract_search.rb +50 -0
  4. data/app/models/abstract_validations.rb +324 -0
  5. data/app/models/address.rb +70 -0
  6. data/app/models/address_type.rb +15 -0
  7. data/app/models/addressing.rb +147 -0
  8. data/app/models/aliquot.rb +44 -0
  9. data/app/models/aliquot_sample_format.rb +13 -0
  10. data/app/models/analysis.rb +14 -0
  11. data/app/models/bc_request.rb +20 -0
  12. data/app/models/candidate_control.rb +101 -0
  13. data/app/models/context.rb +23 -0
  14. data/app/models/context_data_source.rb +4 -0
  15. data/app/models/county.rb +16 -0
  16. data/app/models/data_source.rb +24 -0
  17. data/app/models/diagnosis.rb +23 -0
  18. data/app/models/document_type.rb +16 -0
  19. data/app/models/document_version.rb +27 -0
  20. data/app/models/enrollment.rb +78 -0
  21. data/app/models/enrollment_validations.rb +167 -0
  22. data/app/models/follow_up.rb +16 -0
  23. data/app/models/follow_up_type.rb +18 -0
  24. data/app/models/gift_card.rb +22 -0
  25. data/app/models/gift_card_search.rb +137 -0
  26. data/app/models/home_exposure_response.rb +24 -0
  27. data/app/models/homex_outcome.rb +75 -0
  28. data/app/models/hospital.rb +22 -0
  29. data/app/models/icf_master_id.rb +30 -0
  30. data/app/models/icf_master_tracker.rb +217 -0
  31. data/app/models/icf_master_tracker_change.rb +9 -0
  32. data/app/models/icf_master_tracker_update.rb +50 -0
  33. data/app/models/ineligible_reason.rb +26 -0
  34. data/app/models/instrument.rb +26 -0
  35. data/app/models/instrument_type.rb +17 -0
  36. data/app/models/instrument_version.rb +28 -0
  37. data/app/models/interview.rb +122 -0
  38. data/app/models/interview_method.rb +17 -0
  39. data/app/models/interview_outcome.rb +16 -0
  40. data/app/models/language.rb +28 -0
  41. data/app/models/live_birth_data_update.rb +142 -0
  42. data/app/models/operational_event.rb +99 -0
  43. data/app/models/operational_event_type.rb +31 -0
  44. data/app/models/organization.rb +28 -0
  45. data/app/models/patient.rb +63 -0
  46. data/app/models/patient_validations.rb +118 -0
  47. data/app/models/person.rb +28 -0
  48. data/app/models/phone_number.rb +105 -0
  49. data/app/models/phone_type.rb +15 -0
  50. data/app/models/project.rb +39 -0
  51. data/app/models/project_outcome.rb +19 -0
  52. data/app/models/race.rb +31 -0
  53. data/app/models/refusal_reason.rb +23 -0
  54. data/app/models/sample.rb +168 -0
  55. data/app/models/sample_kit.rb +14 -0
  56. data/app/models/sample_outcome.rb +16 -0
  57. data/app/models/sample_temperature.rb +14 -0
  58. data/app/models/sample_type.rb +37 -0
  59. data/app/models/search.rb +195 -0
  60. data/app/models/section.rb +18 -0
  61. data/app/models/state.rb +25 -0
  62. data/app/models/study_subject.rb +237 -0
  63. data/app/models/study_subject_abstracts.rb +47 -0
  64. data/app/models/study_subject_addresses.rb +34 -0
  65. data/app/models/study_subject_associations.rb +38 -0
  66. data/app/models/study_subject_duplicates.rb +111 -0
  67. data/app/models/study_subject_enrollments.rb +17 -0
  68. data/app/models/study_subject_homex_outcome.rb +22 -0
  69. data/app/models/study_subject_identifier.rb +153 -0
  70. data/app/models/study_subject_interviews.rb +25 -0
  71. data/app/models/study_subject_languages.rb +21 -0
  72. data/app/models/study_subject_operational_events.rb +66 -0
  73. data/app/models/study_subject_patient.rb +177 -0
  74. data/app/models/study_subject_pii.rb +74 -0
  75. data/app/models/study_subject_races.rb +25 -0
  76. data/app/models/study_subject_search.rb +260 -0
  77. data/app/models/study_subject_validations.rb +116 -0
  78. data/app/models/subject_language.rb +11 -0
  79. data/app/models/subject_race.rb +11 -0
  80. data/app/models/subject_relationship.rb +21 -0
  81. data/app/models/subject_type.rb +22 -0
  82. data/app/models/tracing_status.rb +20 -0
  83. data/app/models/transfer.rb +40 -0
  84. data/app/models/unit.rb +14 -0
  85. data/app/models/vital_status.rb +19 -0
  86. data/app/models/zip_code.rb +36 -0
  87. data/config/abstract_fields.yml +1038 -0
  88. data/config/abstract_sections.yml +77 -0
  89. data/config/home_exposure_response_fields.yml +583 -0
  90. data/config/icf_master_tracker_update.yml +56 -0
  91. data/config/live_birth_data_update.yml +56 -0
  92. data/config/shared_use_db.yml +4 -0
  93. data/generators/ccls_engine/USAGE +2 -0
  94. data/generators/ccls_engine/ccls_engine_generator.rb +123 -0
  95. data/generators/ccls_engine/templates/autotest_ccls_engine.rb +3 -0
  96. data/generators/ccls_engine/templates/ccls_engine.rake +12 -0
  97. data/generators/ccls_engine/templates/fixtures/address_types.yml +30 -0
  98. data/generators/ccls_engine/templates/fixtures/context_data_sources.yml +54 -0
  99. data/generators/ccls_engine/templates/fixtures/contexts.yml +19 -0
  100. data/generators/ccls_engine/templates/fixtures/data_sources.yml +40 -0
  101. data/generators/ccls_engine/templates/fixtures/diagnoses.yml +40 -0
  102. data/generators/ccls_engine/templates/fixtures/document_types.yml +65 -0
  103. data/generators/ccls_engine/templates/fixtures/document_versions.csv +155 -0
  104. data/generators/ccls_engine/templates/fixtures/follow_up_types.yml +16 -0
  105. data/generators/ccls_engine/templates/fixtures/hospitals.yml +114 -0
  106. data/generators/ccls_engine/templates/fixtures/ineligible_reasons.yml +35 -0
  107. data/generators/ccls_engine/templates/fixtures/instrument_types.yml +26 -0
  108. data/generators/ccls_engine/templates/fixtures/instrument_versions.yml +22 -0
  109. data/generators/ccls_engine/templates/fixtures/instruments.yml +22 -0
  110. data/generators/ccls_engine/templates/fixtures/interview_methods.yml +30 -0
  111. data/generators/ccls_engine/templates/fixtures/interview_outcomes.yml +31 -0
  112. data/generators/ccls_engine/templates/fixtures/languages.yml +34 -0
  113. data/generators/ccls_engine/templates/fixtures/operational_event_types.yml +141 -0
  114. data/generators/ccls_engine/templates/fixtures/organizations.yml +198 -0
  115. data/generators/ccls_engine/templates/fixtures/people.yml +130 -0
  116. data/generators/ccls_engine/templates/fixtures/phone_types.yml +30 -0
  117. data/generators/ccls_engine/templates/fixtures/project_outcomes.yml +25 -0
  118. data/generators/ccls_engine/templates/fixtures/projects.yml +59 -0
  119. data/generators/ccls_engine/templates/fixtures/races.yml +52 -0
  120. data/generators/ccls_engine/templates/fixtures/refusal_reasons.yml +55 -0
  121. data/generators/ccls_engine/templates/fixtures/sample_outcomes.yml +36 -0
  122. data/generators/ccls_engine/templates/fixtures/sample_temperatures.yml +16 -0
  123. data/generators/ccls_engine/templates/fixtures/sample_types.yml +147 -0
  124. data/generators/ccls_engine/templates/fixtures/sections.yml +31 -0
  125. data/generators/ccls_engine/templates/fixtures/states.yml +363 -0
  126. data/generators/ccls_engine/templates/fixtures/subject_relationships.yml +46 -0
  127. data/generators/ccls_engine/templates/fixtures/subject_types.yml +30 -0
  128. data/generators/ccls_engine/templates/fixtures/tracing_statuses.yml +30 -0
  129. data/generators/ccls_engine/templates/fixtures/units.yml +13 -0
  130. data/generators/ccls_engine/templates/fixtures/vital_statuses.yml +28 -0
  131. data/generators/ccls_engine/templates/functional/roles_controller_test.rb +142 -0
  132. data/generators/ccls_engine/templates/functional/sessions_controller_test.rb +19 -0
  133. data/generators/ccls_engine/templates/functional/users_controller_test.rb +94 -0
  134. data/generators/ccls_engine/templates/images/sort_down.png +0 -0
  135. data/generators/ccls_engine/templates/images/sort_up.png +0 -0
  136. data/generators/ccls_engine/templates/initializer.rb +28 -0
  137. data/generators/ccls_engine/templates/javascripts/ccls_engine.js +24 -0
  138. data/generators/ccls_engine/templates/javascripts/jquery-ui.js +763 -0
  139. data/generators/ccls_engine/templates/javascripts/jquery.js +154 -0
  140. data/generators/ccls_engine/templates/javascripts/jrails.js +1 -0
  141. data/generators/ccls_engine/templates/migrations/create_user_invitations.rb +18 -0
  142. data/generators/ccls_engine/templates/migrations/create_users.rb +33 -0
  143. data/generators/ccls_engine/templates/migrations/drop_user_invitations.rb +18 -0
  144. data/generators/ccls_engine/templates/stylesheets/ccls_engine.css +180 -0
  145. data/generators/ccls_engine/templates/stylesheets/user.css +35 -0
  146. data/generators/ccls_engine/templates/stylesheets/users.css +23 -0
  147. data/generators/ccls_engine/templates/unit/core_extension_test.rb +18 -0
  148. data/generators/ccls_engine/templates/unit/role_test.rb +30 -0
  149. data/generators/ccls_engine/templates/unit/user_test.rb +321 -0
  150. data/lib/ccls-ccls_engine.rb +1 -0
  151. data/lib/ccls_engine.rb +135 -0
  152. data/lib/ccls_engine/action_view_extension.rb +3 -0
  153. data/lib/ccls_engine/action_view_extension/base.rb +53 -0
  154. data/lib/ccls_engine/action_view_extension/form_builder.rb +39 -0
  155. data/lib/ccls_engine/active_record_extension.rb +2 -0
  156. data/lib/ccls_engine/active_record_extension/base.rb +70 -0
  157. data/lib/ccls_engine/active_record_shared.rb +8 -0
  158. data/lib/ccls_engine/assertions.rb +69 -0
  159. data/lib/ccls_engine/autotest.rb +54 -0
  160. data/lib/ccls_engine/ccls_user.rb +117 -0
  161. data/lib/ccls_engine/core_extension.rb +14 -0
  162. data/lib/ccls_engine/date_and_time_formats.rb +30 -0
  163. data/lib/ccls_engine/factories.rb +880 -0
  164. data/lib/ccls_engine/factory_test_helper.rb +276 -0
  165. data/lib/ccls_engine/helper.rb +112 -0
  166. data/lib/ccls_engine/icf_master_tracker_update_test_helper.rb +121 -0
  167. data/lib/ccls_engine/live_birth_data_update_test_helper.rb +110 -0
  168. data/lib/ccls_engine/package_test_helper.rb +49 -0
  169. data/lib/ccls_engine/shared_database.rb +20 -0
  170. data/lib/ccls_engine/tasks.rb +1 -0
  171. data/lib/ccls_engine/test_tasks.rb +52 -0
  172. data/lib/ccls_engine/translation_table.rb +86 -0
  173. data/lib/shared_migration.rb +5 -0
  174. data/lib/surveyor/survey_extensions.rb +125 -0
  175. data/lib/tasks/application.rake +286 -0
  176. data/lib/tasks/calnet_authenticated.rake +6 -0
  177. data/lib/tasks/common_lib.rake +7 -0
  178. data/lib/tasks/database.rake +288 -0
  179. data/lib/tasks/documentation.rake +71 -0
  180. data/lib/tasks/homex_import.rake +723 -0
  181. data/lib/tasks/odms_import.rake +1116 -0
  182. data/lib/tasks/simply_authorized.rake +6 -0
  183. data/lib/tasks/ucb_ccls_engine_tasks.rake +4 -0
  184. data/lib/tasks/use_db.rake +4 -0
  185. data/rails/init.rb +4 -0
  186. data/test/unit/ccls/abstract_search_test.rb +150 -0
  187. data/test/unit/ccls/abstract_test.rb +674 -0
  188. data/test/unit/ccls/address_test.rb +155 -0
  189. data/test/unit/ccls/address_type_test.rb +25 -0
  190. data/test/unit/ccls/addressing_test.rb +466 -0
  191. data/test/unit/ccls/aliquot_sample_format_test.rb +20 -0
  192. data/test/unit/ccls/aliquot_test.rb +156 -0
  193. data/test/unit/ccls/analysis_test.rb +31 -0
  194. data/test/unit/ccls/bc_request_test.rb +43 -0
  195. data/test/unit/ccls/candidate_control_test.rb +712 -0
  196. data/test/unit/ccls/context_data_source_test.rb +26 -0
  197. data/test/unit/ccls/context_test.rb +40 -0
  198. data/test/unit/ccls/core_extension_test.rb +17 -0
  199. data/test/unit/ccls/county_test.rb +34 -0
  200. data/test/unit/ccls/data_source_test.rb +41 -0
  201. data/test/unit/ccls/diagnosis_test.rb +51 -0
  202. data/test/unit/ccls/document_type_test.rb +35 -0
  203. data/test/unit/ccls/document_version_test.rb +68 -0
  204. data/test/unit/ccls/enrollment_test.rb +575 -0
  205. data/test/unit/ccls/follow_up_test.rb +23 -0
  206. data/test/unit/ccls/follow_up_type_test.rb +34 -0
  207. data/test/unit/ccls/gift_card_search_test.rb +153 -0
  208. data/test/unit/ccls/gift_card_test.rb +40 -0
  209. data/test/unit/ccls/home_exposure_response_test.rb +83 -0
  210. data/test/unit/ccls/homex_outcome_test.rb +199 -0
  211. data/test/unit/ccls/hospital_test.rb +102 -0
  212. data/test/unit/ccls/icf_master_id_test.rb +30 -0
  213. data/test/unit/ccls/icf_master_tracker_change_test.rb +14 -0
  214. data/test/unit/ccls/icf_master_tracker_test.rb +132 -0
  215. data/test/unit/ccls/icf_master_tracker_update_test.rb +176 -0
  216. data/test/unit/ccls/ineligible_reason_test.rb +48 -0
  217. data/test/unit/ccls/instrument_test.rb +62 -0
  218. data/test/unit/ccls/instrument_type_test.rb +39 -0
  219. data/test/unit/ccls/instrument_version_test.rb +71 -0
  220. data/test/unit/ccls/interview_method_test.rb +44 -0
  221. data/test/unit/ccls/interview_outcome_test.rb +34 -0
  222. data/test/unit/ccls/interview_test.rb +298 -0
  223. data/test/unit/ccls/language_test.rb +47 -0
  224. data/test/unit/ccls/live_birth_data_update_test.rb +358 -0
  225. data/test/unit/ccls/operational_event_test.rb +187 -0
  226. data/test/unit/ccls/operational_event_type_test.rb +51 -0
  227. data/test/unit/ccls/organization_test.rb +64 -0
  228. data/test/unit/ccls/patient_test.rb +538 -0
  229. data/test/unit/ccls/person_test.rb +55 -0
  230. data/test/unit/ccls/phone_number_test.rb +244 -0
  231. data/test/unit/ccls/phone_type_test.rb +32 -0
  232. data/test/unit/ccls/project_outcome_test.rb +34 -0
  233. data/test/unit/ccls/project_test.rb +60 -0
  234. data/test/unit/ccls/race_test.rb +37 -0
  235. data/test/unit/ccls/refusal_reason_test.rb +52 -0
  236. data/test/unit/ccls/role_test.rb +26 -0
  237. data/test/unit/ccls/sample_kit_test.rb +35 -0
  238. data/test/unit/ccls/sample_outcome_test.rb +34 -0
  239. data/test/unit/ccls/sample_temperature_test.rb +25 -0
  240. data/test/unit/ccls/sample_test.rb +363 -0
  241. data/test/unit/ccls/sample_type_test.rb +58 -0
  242. data/test/unit/ccls/section_test.rb +34 -0
  243. data/test/unit/ccls/state_test.rb +31 -0
  244. data/test/unit/ccls/study_subject_abstracts_test.rb +115 -0
  245. data/test/unit/ccls/study_subject_addresses_test.rb +93 -0
  246. data/test/unit/ccls/study_subject_duplicates_test.rb +407 -0
  247. data/test/unit/ccls/study_subject_enrollments_test.rb +65 -0
  248. data/test/unit/ccls/study_subject_homex_outcome_test.rb +64 -0
  249. data/test/unit/ccls/study_subject_identifier_test.rb +439 -0
  250. data/test/unit/ccls/study_subject_interviews_test.rb +26 -0
  251. data/test/unit/ccls/study_subject_languages_test.rb +142 -0
  252. data/test/unit/ccls/study_subject_operational_events_test.rb +53 -0
  253. data/test/unit/ccls/study_subject_patient_test.rb +249 -0
  254. data/test/unit/ccls/study_subject_pii_test.rb +278 -0
  255. data/test/unit/ccls/study_subject_races_test.rb +203 -0
  256. data/test/unit/ccls/study_subject_search_test.rb +704 -0
  257. data/test/unit/ccls/study_subject_test.rb +770 -0
  258. data/test/unit/ccls/subject_language_test.rb +43 -0
  259. data/test/unit/ccls/subject_race_test.rb +35 -0
  260. data/test/unit/ccls/subject_relationship_test.rb +43 -0
  261. data/test/unit/ccls/subject_type_test.rb +40 -0
  262. data/test/unit/ccls/tracing_status_test.rb +32 -0
  263. data/test/unit/ccls/transfer_test.rb +81 -0
  264. data/test/unit/ccls/translation_table_test.rb +40 -0
  265. data/test/unit/ccls/unit_test.rb +21 -0
  266. data/test/unit/ccls/user_test.rb +156 -0
  267. data/test/unit/ccls/vital_status_test.rb +36 -0
  268. data/test/unit/ccls/zip_code_test.rb +55 -0
  269. metadata +633 -0
@@ -0,0 +1,56 @@
1
+ #
2
+ # This is an erb.yml file containing the environment specific options for
3
+ # a Paperclip#has_attached_file call.
4
+ # The main purpose for putting these in a separate file was for coverage testing.
5
+ # If all of this were left in the model, not all of it would be tested.
6
+ # It has become my preferred convention to use erb.yml files for this.
7
+ #
8
+ # If the attachment is not to have direct access from the browser,
9
+ # like the document's and group_document's document attachment,
10
+ # there is no url set. As these two models both have an attachment
11
+ # of the same name, but do not have explicit urls set, Paperclip
12
+ # will show the following warnings ..
13
+ # [paperclip] Saving attachments.
14
+ # [paperclip] Duplicate URL for document with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Document class
15
+ # [paperclip] Duplicate URL for document with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in GroupDocument class
16
+ #
17
+ # As they aren't accessed directly, this has not created any problems.
18
+ # May want to include the url in these options to quell the following errors
19
+ # even though it is never actually used. (no direct access to these files)
20
+ #
21
+ #DEFAULTS: &DEFAULTS
22
+ # :styles:
23
+ # :full: '900'
24
+ # :large: '800'
25
+ # :medium: '600'
26
+ # :small: '150x50'
27
+ #
28
+ # A trailing '>' after a size means DO NOT enlarge, only shrink
29
+ # See the documentation for ImageMagick for other size conversion information.
30
+ #
31
+ # In the url definition, ...
32
+ # :attachment is the attachment name NOT the model name
33
+ # ( for document they are the same )
34
+ #
35
+ # The url or path definitions are parsed and anything that begins with a ':' will be
36
+ # treated special, ie. :id, :attachment, :style, :filename. Take care to not
37
+ # accidentally include any ':' characters.
38
+ #
39
+
40
+ # url is set just to avoid the "Duplicate URL" message
41
+ DEFAULTS: &DEFAULTS
42
+ :url: /system/icf_master_tracker_update/:attachment/:id/:filename
43
+
44
+ <% common = "icf_master_tracker_update/:id/:filename" %>
45
+
46
+ development:
47
+ :path: <%= "#{Rails.root}/development/#{common}" %>
48
+ <<: *DEFAULTS
49
+
50
+ test:
51
+ :path: <%= "#{Rails.root}/test/#{common}" %>
52
+ <<: *DEFAULTS
53
+
54
+ production:
55
+ :path: <%= "/my/ruby/#{common}" %>
56
+ <<: *DEFAULTS
@@ -0,0 +1,56 @@
1
+ #
2
+ # This is an erb.yml file containing the environment specific options for
3
+ # a Paperclip#has_attached_file call.
4
+ # The main purpose for putting these in a separate file was for coverage testing.
5
+ # If all of this were left in the model, not all of it would be tested.
6
+ # It has become my preferred convention to use erb.yml files for this.
7
+ #
8
+ # If the attachment is not to have direct access from the browser,
9
+ # like the document's and group_document's document attachment,
10
+ # there is no url set. As these two models both have an attachment
11
+ # of the same name, but do not have explicit urls set, Paperclip
12
+ # will show the following warnings ..
13
+ # [paperclip] Saving attachments.
14
+ # [paperclip] Duplicate URL for document with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in Document class
15
+ # [paperclip] Duplicate URL for document with /system/:attachment/:id/:style/:filename. This will clash with attachment defined in GroupDocument class
16
+ #
17
+ # As they aren't accessed directly, this has not created any problems.
18
+ # May want to include the url in these options to quell the following errors
19
+ # even though it is never actually used. (no direct access to these files)
20
+ #
21
+ #DEFAULTS: &DEFAULTS
22
+ # :styles:
23
+ # :full: '900'
24
+ # :large: '800'
25
+ # :medium: '600'
26
+ # :small: '150x50'
27
+ #
28
+ # A trailing '>' after a size means DO NOT enlarge, only shrink
29
+ # See the documentation for ImageMagick for other size conversion information.
30
+ #
31
+ # In the url definition, ...
32
+ # :attachment is the attachment name NOT the model name
33
+ # ( for document they are the same )
34
+ #
35
+ # The url or path definitions are parsed and anything that begins with a ':' will be
36
+ # treated special, ie. :id, :attachment, :style, :filename. Take care to not
37
+ # accidentally include any ':' characters.
38
+ #
39
+
40
+ # url is set just to avoid the "Duplicate URL" message
41
+ DEFAULTS: &DEFAULTS
42
+ :url: /system/live_birth_data_update/:attachment/:id/:filename
43
+
44
+ <% common = "live_birth_data_update/:id/:filename" %>
45
+
46
+ development:
47
+ :path: <%= "#{Rails.root}/development/#{common}" %>
48
+ <<: *DEFAULTS
49
+
50
+ test:
51
+ :path: <%= "#{Rails.root}/test/#{common}" %>
52
+ <<: *DEFAULTS
53
+
54
+ production:
55
+ :path: <%= "/my/ruby/#{common}" %>
56
+ <<: *DEFAULTS
@@ -0,0 +1,4 @@
1
+
2
+ shared:
3
+ prefix: shared_
4
+
@@ -0,0 +1,2 @@
1
+ script/generate ccls_engine
2
+
@@ -0,0 +1,123 @@
1
+ #class CclsEngineGenerator < Rails::Generator::NamedBase
2
+ # Using NamedBase required a user model parameter like so ...
3
+ # script/generate ccls_engine User
4
+ # which created a variable called "class_name" available to the templates.
5
+ # As it is no longer used, changing to just Base so it can be used like so ...
6
+ # script/generate ccls_engine
7
+ class CclsEngineGenerator < Rails::Generator::Base
8
+
9
+ def manifest
10
+ # See Rails::Generator::Commands::Create
11
+ # rails-2.3.10/lib/rails_generator/commands.rb
12
+ # for code methods for record (Manifest)
13
+ record do |m|
14
+
15
+ # The autotest file will require that the app actually
16
+ # looks for autotest files.
17
+ m.directory('config/autotest')
18
+ m.file('autotest_ccls_engine.rb', 'config/autotest/ccls_engine.rb')
19
+
20
+ # *.rake files in the lib/tasks/ directory are automatically
21
+ # loaded so nothing is required to include this.
22
+ m.directory('lib/tasks')
23
+ m.file('ccls_engine.rake', 'lib/tasks/ccls_engine.rake')
24
+
25
+ # no longer seems to be needed, but keeping for now
26
+ # until included calnet_authentication
27
+ # it is entirely commented out now so
28
+ # m.directory('config/initializers')
29
+ # m.template('initializer.rb', 'config/initializers/ccls_engine.rb')
30
+
31
+ # %w( create_users create_user_invitations ).each do |migration|
32
+ # UserInvitations are NOT used for any app which uses the ccls engine.
33
+ %w( create_users create_user_invitations drop_user_invitations ).each do |migration|
34
+ m.migration_template "migrations/#{migration}.rb",
35
+ 'db/migrate', :migration_file_name => migration
36
+ end
37
+
38
+ dot = File.dirname(__FILE__)
39
+
40
+ m.directory('public/images')
41
+ Dir["#{dot}/templates/images/*"].each{|file|
42
+ f = file.split('/').slice(-2,2).join('/')
43
+ m.file(f, "public/images/#{File.basename(file)}")
44
+ }
45
+ m.directory('public/javascripts')
46
+ Dir["#{dot}/templates/javascripts/*js"].each{|file|
47
+ f = file.split('/').slice(-2,2).join('/')
48
+ m.file(f, "public/javascripts/#{File.basename(file)}")
49
+ }
50
+ m.directory('public/stylesheets')
51
+ Dir["#{dot}/templates/stylesheets/*css"].each{|file|
52
+ f = file.split('/').slice(-2,2).join('/')
53
+ m.file(f, "public/stylesheets/#{File.basename(file)}")
54
+ }
55
+
56
+ # Dir["#{dot}/templates/views/*/**/"].each do |dir|
57
+ # last_dir = dir.split('/').last
58
+ # m.directory("app/views/#{last_dir}")
59
+ # Dir["#{dot}/templates/views/#{last_dir}/*rb"].each do |file|
60
+ # f = file.split('/').slice(-3,3).join('/')
61
+ # m.file(f, "app/views/#{last_dir}/#{File.basename(file)}")
62
+ # end
63
+ # end
64
+ # m.directory('app/controllers')
65
+ # Dir["#{dot}/templates/controllers/*rb"].each{|file|
66
+ # f = file.split('/').slice(-2,2).join('/')
67
+ # m.file(f, "app/controllers/#{File.basename(file)}")
68
+ # }
69
+ #
70
+ # m.directory('test/functional/ccls')
71
+ # Dir["#{dot}/templates/functional/*rb"].each{|file|
72
+ # f = file.split('/').slice(-2,2).join('/')
73
+ # m.file(f, "test/functional/ccls/#{File.basename(file)}")
74
+ # }
75
+
76
+ m.directory('test/fixtures')
77
+ Dir["#{dot}/templates/fixtures/*{yml,csv}"].each{|file|
78
+ f = file.split('/').slice(-2,2).join('/')
79
+ m.file(f, "test/fixtures/#{File.basename(file)}")
80
+ }
81
+ # Dir["#{dot}/templates/fixtures/*csv"].each{|file|
82
+ # f = file.split('/').slice(-2,2).join('/')
83
+ # m.file(f, "test/fixtures/#{File.basename(file)}")
84
+ # }
85
+
86
+ # m.directory('test/unit/ccls')
87
+ # Dir["#{File.dirname(__FILE__)}/templates/unit/*rb"].each{|file|
88
+ # f = file.split('/').slice(-2,2).join('/')
89
+ # m.file(f, "test/unit/ccls/#{File.basename(file)}")
90
+ # }
91
+ end
92
+ end
93
+
94
+ end
95
+ module Rails::Generator::Commands
96
+ class Create
97
+ def migration_template(relative_source,
98
+ relative_destination, template_options = {})
99
+ migration_directory relative_destination
100
+ migration_file_name = template_options[
101
+ :migration_file_name] || file_name
102
+ if migration_exists?(migration_file_name)
103
+ puts "Another migration is already named #{migration_file_name}: #{existing_migrations(migration_file_name).first}: Skipping"
104
+ else
105
+ template(relative_source, "#{relative_destination}/#{next_migration_string}_#{migration_file_name}.rb", template_options)
106
+ end
107
+ end
108
+ end # Create
109
+ class Base
110
+ protected
111
+ # the loop through migrations happens so fast
112
+ # that they all have the same timestamp which
113
+ # won't work when you actually try to migrate.
114
+ # All the timestamps MUST be unique.
115
+ def next_migration_string(padding = 3)
116
+ @s = (!@s.nil?)? @s.to_i + 1 : if ActiveRecord::Base.timestamped_migrations
117
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
118
+ else
119
+ "%.#{padding}d" % next_migration_number
120
+ end
121
+ end
122
+ end # Base
123
+ end
@@ -0,0 +1,3 @@
1
+ # From `script/generate ccls_engine` ...
2
+ gem 'ccls-ccls_engine'
3
+ require 'ccls_engine/autotest'
@@ -0,0 +1,12 @@
1
+ # From `script/generate ccls_engine` ...
2
+ # condition added to allow clean 'rake gems:install'
3
+ unless Gem.source_index.find_name('ccls-ccls_engine').empty?
4
+ gem 'ccls-ccls_engine'
5
+
6
+ RAILS_DEFAULT_LOGGER = nil unless defined? RAILS_DEFAULT_LOGGER
7
+ # gems/rubycas-client-2.2.1/lib/casclient/frameworks/rails/filter.rb:141:in `configure'
8
+ # gems/ccls-calnet_authenticated-0.4.1/lib/calnet_authenticated/controller.rb:18:in `included'
9
+ require 'ccls_engine'
10
+ require 'ccls_engine/tasks'
11
+ require 'ccls_engine/test_tasks'
12
+ end
@@ -0,0 +1,30 @@
1
+ #
2
+ # Do not change id or key
3
+ # 'id' could be referenced by existing data
4
+ # 'key' is used in the rails code for searching
5
+ #
6
+ # Be Advised. Yaml fixture labels MUST BE UNIQUE.
7
+ # If a label is repeated, only the last one will exist.
8
+ #
9
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
10
+ #
11
+ residence:
12
+ id: 1
13
+ key: residence
14
+ description: home address
15
+ mailing:
16
+ id: 2
17
+ key: mailing
18
+ description: mailing address (PO Box, APO, etc.)
19
+ business:
20
+ id: 3
21
+ key: business
22
+ description: business address
23
+ other:
24
+ id: 4
25
+ key: other
26
+ description: some other address type
27
+ dk:
28
+ id: 5
29
+ key: unknown
30
+ description: address type unknown
@@ -0,0 +1,54 @@
1
+ #
2
+ # Do not change id or key
3
+ # 'id' could be referenced by existing data
4
+ # 'key' is used in the rails code for searching
5
+ #
6
+ # Be Advised. Yaml fixture labels MUST BE UNIQUE.
7
+ # If a label is repeated, only the last one will exist.
8
+ #
9
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
10
+ #
11
+
12
+ 1:
13
+ id: 1
14
+ context_id: 1
15
+ data_source_id: 1
16
+ 2:
17
+ id: 2
18
+ context_id: 1
19
+ data_source_id: 2
20
+ 3:
21
+ id: 3
22
+ context_id: 1
23
+ data_source_id: 3
24
+ 4:
25
+ id: 4
26
+ context_id: 1
27
+ data_source_id: 4
28
+ 5:
29
+ id: 5
30
+ context_id: 2
31
+ data_source_id: 1
32
+ 6:
33
+ id: 6
34
+ context_id: 2
35
+ data_source_id: 2
36
+ 7:
37
+ id: 7
38
+ context_id: 2
39
+ data_source_id: 3
40
+ 8:
41
+ id: 8
42
+ context_id: 2
43
+ data_source_id: 4
44
+
45
+
46
+ # Other Source
47
+ 9:
48
+ id: 9
49
+ context_id: 1
50
+ data_source_id: 5
51
+ 10:
52
+ id: 10
53
+ context_id: 2
54
+ data_source_id: 5
@@ -0,0 +1,19 @@
1
+ #
2
+ # Do not change id or key
3
+ # 'id' could be referenced by existing data
4
+ # 'key' is used in the rails code for searching
5
+ #
6
+ # Be Advised. Yaml fixture labels MUST BE UNIQUE.
7
+ # If a label is repeated, only the last one will exist.
8
+ #
9
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
10
+ #
11
+
12
+ addresses:
13
+ id: 1
14
+ key: addresses
15
+ description: address combo boxes in ODMS
16
+ phones:
17
+ id: 2
18
+ key: phones
19
+ description: phone number combo boxes in ODMS
@@ -0,0 +1,40 @@
1
+ #
2
+ # Do not change id, key or description
3
+ # 'id' could be referenced by existing data
4
+ # 'key' is used in the rails code for searching
5
+ # 'description' is used in javascript ( changing it here will require a corresponding change there )
6
+ #
7
+ # Be Advised. Yaml fixture labels MUST BE UNIQUE.
8
+ # If a label is repeated, only the last one will exist.
9
+ #
10
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
11
+ #
12
+
13
+ raf:
14
+ id: 1
15
+ key: raf
16
+ description: RAF (CCLS Rapid Ascertainment Form)
17
+ consent:
18
+ id: 2
19
+ key: consent
20
+ description: Study Consent Form
21
+ interview:
22
+ id: 3
23
+ key: interview
24
+ description: Interview with Subject
25
+ usps:
26
+ id: 4
27
+ key: usps
28
+ description: USPS Address Service
29
+ other:
30
+ id: 5
31
+ key: other
32
+ description: Other Source
33
+ t2k:
34
+ id: 6
35
+ key: tracking2k
36
+ description: Migrated from CCLS Legacy Tracking2k database
37
+ src:
38
+ id: 7
39
+ key: src
40
+ description: Provided to CCLS by Survey Research Center ("SRC")
@@ -0,0 +1,40 @@
1
+ #
2
+ # Do not change id or key
3
+ # 'id' could be referenced by existing data
4
+ # 'key' is used in the rails code for searching
5
+ #
6
+ # Be Advised. Yaml fixture labels MUST BE UNIQUE.
7
+ # If a label is repeated, only the last one will exist.
8
+ #
9
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
10
+ #
11
+ all:
12
+ id: 1
13
+ position: 1
14
+ code: 1
15
+ key: ALL
16
+ description: ALL
17
+ aml:
18
+ id: 2
19
+ position: 2
20
+ code: 2
21
+ key: AML
22
+ description: AML
23
+ other:
24
+ id: 3
25
+ position: 3
26
+ code: 3
27
+ key: other
28
+ description: other
29
+ legacy:
30
+ id: 4
31
+ code: 777
32
+ position: 4
33
+ key: unspec
34
+ description: missing data (eg. legacy nulls)
35
+ dk:
36
+ id: 5
37
+ code: 999
38
+ position: 5
39
+ key: dk
40
+ description: don't know