geo_works 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (336) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +34 -0
  3. data/.csslintrc +2 -0
  4. data/.engine_cart.yml +1 -0
  5. data/.eslintignore +1 -0
  6. data/.eslintrc +8 -0
  7. data/.fcrepo_wrapper +3 -0
  8. data/.gitignore +14 -0
  9. data/.rubocop.yml +105 -0
  10. data/.solr_wrapper +7 -0
  11. data/.travis.yml +33 -0
  12. data/CONTRIBUTING.md +159 -0
  13. data/Gemfile +48 -0
  14. data/LICENSE +202 -0
  15. data/README.md +143 -0
  16. data/Rakefile +25 -0
  17. data/app/assets/images/geo_works/.keep +0 -0
  18. data/app/assets/images/geo_works/images/geocoder.png +0 -0
  19. data/app/assets/images/geo_works/images/move-handle.png +0 -0
  20. data/app/assets/images/geo_works/images/resize-handle.png +0 -0
  21. data/app/assets/images/geo_works/images/throbber.gif +0 -0
  22. data/app/assets/javascripts/geo_works/Control.Geocoder.js +1056 -0
  23. data/app/assets/javascripts/geo_works/application.js +4 -0
  24. data/app/assets/javascripts/geo_works/bounding_box_selector.js +107 -0
  25. data/app/assets/javascripts/geo_works/es6-modules.js +7 -0
  26. data/app/assets/javascripts/geo_works/geo_works_boot.es6 +8 -0
  27. data/app/assets/javascripts/geo_works/leaflet-boundingbox.js +467 -0
  28. data/app/assets/javascripts/geo_works/relationships.js +3 -0
  29. data/app/assets/javascripts/geo_works/relationships/child_works.es6 +20 -0
  30. data/app/assets/javascripts/geo_works/relationships/parent_works.es6 +20 -0
  31. data/app/assets/javascripts/geo_works/relationships/related_works.es6 +187 -0
  32. data/app/assets/stylesheets/geo_works/Control.Geocoder.scss +104 -0
  33. data/app/assets/stylesheets/geo_works/application.css +18 -0
  34. data/app/assets/stylesheets/geo_works/bounding_box.scss +15 -0
  35. data/app/assets/stylesheets/geo_works/leaflet-boundingbox.scss +17 -0
  36. data/app/assets/stylesheets/geo_works/related_works.scss +29 -0
  37. data/app/assets/stylesheets/geo_works/thumbnails.scss +13 -0
  38. data/app/controllers/concerns/geo_works/events_behavior.rb +29 -0
  39. data/app/controllers/concerns/geo_works/file_sets_controller_behavior.rb +31 -0
  40. data/app/controllers/concerns/geo_works/geoblacklight_controller_behavior.rb +29 -0
  41. data/app/controllers/concerns/geo_works/image_works_controller_behavior.rb +9 -0
  42. data/app/controllers/concerns/geo_works/raster_works_controller_behavior.rb +9 -0
  43. data/app/controllers/concerns/geo_works/vector_works_controller_behavior.rb +9 -0
  44. data/app/forms/geo_works/basic_geo_metadata_form.rb +9 -0
  45. data/app/forms/geo_works/external_metadata_file_form.rb +8 -0
  46. data/app/forms/geo_works/georeferenced_form.rb +9 -0
  47. data/app/forms/hyrax/image_work_form.rb +7 -0
  48. data/app/forms/hyrax/raster_work_form.rb +8 -0
  49. data/app/forms/hyrax/vector_work_form.rb +8 -0
  50. data/app/helpers/geo_works/application_helper.rb +4 -0
  51. data/app/helpers/geo_works/bounding_box_helper.rb +73 -0
  52. data/app/helpers/geo_works/file_set_actions_helper.rb +31 -0
  53. data/app/helpers/geo_works/geo_works_helper.rb +22 -0
  54. data/app/helpers/geo_works/populate_metadata_helper.rb +7 -0
  55. data/app/jobs/geoblacklight_job.rb +10 -0
  56. data/app/jobs/geoserver_delivery_job.rb +36 -0
  57. data/app/models/concerns/geo_works/ability.rb +12 -0
  58. data/app/models/concerns/geo_works/basic_geo_metadata.rb +21 -0
  59. data/app/models/concerns/geo_works/external_metadata_file_behavior.rb +31 -0
  60. data/app/models/concerns/geo_works/extractors/fgdc_helper.rb +9 -0
  61. data/app/models/concerns/geo_works/extractors/fgdc_metadata_extractor.rb +114 -0
  62. data/app/models/concerns/geo_works/extractors/iso19139_helper.rb +50 -0
  63. data/app/models/concerns/geo_works/extractors/mods_helper.rb +15 -0
  64. data/app/models/concerns/geo_works/file_set_metadata.rb +15 -0
  65. data/app/models/concerns/geo_works/file_set_presenter_behavior.rb +7 -0
  66. data/app/models/concerns/geo_works/geo_file_format_behavior.rb +37 -0
  67. data/app/models/concerns/geo_works/geo_file_set_behavior.rb +11 -0
  68. data/app/models/concerns/geo_works/georeferenced_behavior.rb +18 -0
  69. data/app/models/concerns/geo_works/image_file_behavior.rb +14 -0
  70. data/app/models/concerns/geo_works/image_work_behavior.rb +69 -0
  71. data/app/models/concerns/geo_works/metadata_extraction_helper.rb +27 -0
  72. data/app/models/concerns/geo_works/raster_file_behavior.rb +14 -0
  73. data/app/models/concerns/geo_works/raster_work_behavior.rb +82 -0
  74. data/app/models/concerns/geo_works/solr_document_behavior.rb +46 -0
  75. data/app/models/concerns/geo_works/vector_file_behavior.rb +14 -0
  76. data/app/models/concerns/geo_works/vector_work_behavior.rb +78 -0
  77. data/app/presenters/geo_works/geo_works_show_presenter.rb +48 -0
  78. data/app/presenters/geo_works/image_work_show_presenter.rb +5 -0
  79. data/app/presenters/geo_works/raster_work_show_presenter.rb +5 -0
  80. data/app/presenters/geo_works/vector_work_show_presenter.rb +5 -0
  81. data/app/processors/geo_works/geoblacklight_event_processor.rb +29 -0
  82. data/app/processors/geo_works/geoblacklight_event_processor/delete_processor.rb +13 -0
  83. data/app/processors/geo_works/geoblacklight_event_processor/processor.rb +28 -0
  84. data/app/processors/geo_works/geoblacklight_event_processor/unknown_event.rb +15 -0
  85. data/app/processors/geo_works/geoblacklight_event_processor/update_processor.rb +15 -0
  86. data/app/processors/geo_works/processors/base_geo_processor.rb +81 -0
  87. data/app/processors/geo_works/processors/gdal.rb +49 -0
  88. data/app/processors/geo_works/processors/image.rb +66 -0
  89. data/app/processors/geo_works/processors/ogr.rb +19 -0
  90. data/app/processors/geo_works/processors/raster.rb +26 -0
  91. data/app/processors/geo_works/processors/raster/aig.rb +40 -0
  92. data/app/processors/geo_works/processors/raster/base.rb +41 -0
  93. data/app/processors/geo_works/processors/raster/dem.rb +29 -0
  94. data/app/processors/geo_works/processors/raster/info.rb +52 -0
  95. data/app/processors/geo_works/processors/rendering.rb +79 -0
  96. data/app/processors/geo_works/processors/vector.rb +24 -0
  97. data/app/processors/geo_works/processors/vector/base.rb +44 -0
  98. data/app/processors/geo_works/processors/vector/info.rb +84 -0
  99. data/app/processors/geo_works/processors/vector/shapefile.rb +20 -0
  100. data/app/processors/geo_works/processors/zip.rb +29 -0
  101. data/app/renderers/geo_works/coverage_renderer.rb +39 -0
  102. data/app/runners/geo_works/runners/raster_derivatives.rb +9 -0
  103. data/app/runners/geo_works/runners/vector_derivatives.rb +9 -0
  104. data/app/schemas/geo_works/basic_geo_metadata_optional.rb +40 -0
  105. data/app/schemas/geo_works/basic_geo_metadata_required.rb +25 -0
  106. data/app/schemas/geo_works/file_set_metadata_required.rb +5 -0
  107. data/app/services/geo_works/authority_service.rb +29 -0
  108. data/app/services/geo_works/delivery/geoserver.rb +118 -0
  109. data/app/services/geo_works/delivery_service.rb +11 -0
  110. data/app/services/geo_works/discovery.rb +4 -0
  111. data/app/services/geo_works/discovery/abstract_document.rb +37 -0
  112. data/app/services/geo_works/discovery/document_builder.rb +46 -0
  113. data/app/services/geo_works/discovery/document_builder/basic_metadata_builder.rb +71 -0
  114. data/app/services/geo_works/discovery/document_builder/composite_builder.rb +21 -0
  115. data/app/services/geo_works/discovery/document_builder/date_builder.rb +53 -0
  116. data/app/services/geo_works/discovery/document_builder/document_helper.rb +10 -0
  117. data/app/services/geo_works/discovery/document_builder/document_path.rb +91 -0
  118. data/app/services/geo_works/discovery/document_builder/layer_info_builder.rb +65 -0
  119. data/app/services/geo_works/discovery/document_builder/references_builder.rb +101 -0
  120. data/app/services/geo_works/discovery/document_builder/slug_builder.rb +24 -0
  121. data/app/services/geo_works/discovery/document_builder/spatial_builder.rb +37 -0
  122. data/app/services/geo_works/discovery/document_builder/wxs.rb +76 -0
  123. data/app/services/geo_works/discovery/geoblacklight_document.rb +152 -0
  124. data/app/services/geo_works/events_generator.rb +24 -0
  125. data/app/services/geo_works/events_generator/composite_generator.rb +18 -0
  126. data/app/services/geo_works/events_generator/geoblacklight_event_generator.rb +53 -0
  127. data/app/services/geo_works/events_generator/geoserver_event_generator.rb +33 -0
  128. data/app/services/geo_works/file_set_derivatives_service.rb +67 -0
  129. data/app/services/geo_works/image_format_service.rb +6 -0
  130. data/app/services/geo_works/metadata_format_service.rb +6 -0
  131. data/app/services/geo_works/raster_format_service.rb +6 -0
  132. data/app/services/geo_works/vector_format_service.rb +6 -0
  133. data/app/services/hyrax/curation_concern.rb +18 -0
  134. data/app/values/geo_works/coverage.rb +36 -0
  135. data/app/values/geo_works/time_period.rb +30 -0
  136. data/app/views/geo_works/_attribute_rows.html.erb +4 -0
  137. data/app/views/geo_works/_form_progress.html.erb +50 -0
  138. data/app/views/geo_works/_guts4form.html.erb +47 -0
  139. data/app/views/geo_works/_member.html.erb +11 -0
  140. data/app/views/geo_works/_metadata.html.erb +13 -0
  141. data/app/views/geo_works/_relationships.html.erb +12 -0
  142. data/app/views/geo_works/_representative_media.html.erb +5 -0
  143. data/app/views/geo_works/file_sets/_form.html.erb +48 -0
  144. data/app/views/geo_works/file_sets/actions/_default_actions.html.erb +16 -0
  145. data/app/views/geo_works/file_sets/actions/_image_actions.html.erb +22 -0
  146. data/app/views/geo_works/file_sets/actions/_metadata_actions.html.erb +16 -0
  147. data/app/views/geo_works/file_sets/actions/_raster_actions.html.erb +25 -0
  148. data/app/views/geo_works/file_sets/actions/_vector_actions.html.erb +25 -0
  149. data/app/views/geo_works/file_sets/media_display/_geo.html.erb +16 -0
  150. data/app/views/geo_works/file_sets/new.html.erb +12 -0
  151. data/app/views/geo_works/related/_child_member.html.erb +13 -0
  152. data/app/views/geo_works/related/_child_works.html.erb +24 -0
  153. data/app/views/geo_works/related/_external_metadata_file_member.html.erb +11 -0
  154. data/app/views/geo_works/related/_external_metadata_files.html.erb +24 -0
  155. data/app/views/geo_works/related/_geo_files.html.erb +24 -0
  156. data/app/views/geo_works/related/_new_child_member.html.erb +22 -0
  157. data/app/views/geo_works/related/_new_parent_member.html.erb +13 -0
  158. data/app/views/geo_works/related/_parent_member.html.erb +13 -0
  159. data/app/views/geo_works/related/_parent_works.html.erb +22 -0
  160. data/app/views/hyrax/image_works/_file_actions.html.erb +8 -0
  161. data/app/views/hyrax/image_works/_form.html.erb +16 -0
  162. data/app/views/hyrax/image_works/_image_actions.html.erb +11 -0
  163. data/app/views/hyrax/image_works/_image_work.html.erb +2 -0
  164. data/app/views/hyrax/image_works/_show_actions.html.erb +22 -0
  165. data/app/views/hyrax/image_works/show.html.erb +31 -0
  166. data/app/views/hyrax/raster_works/_file_actions.html.erb +8 -0
  167. data/app/views/hyrax/raster_works/_form.html.erb +16 -0
  168. data/app/views/hyrax/raster_works/_raster_actions.html.erb +11 -0
  169. data/app/views/hyrax/raster_works/_raster_work.html.erb +2 -0
  170. data/app/views/hyrax/raster_works/_show_actions.html.erb +22 -0
  171. data/app/views/hyrax/raster_works/show.html.erb +31 -0
  172. data/app/views/hyrax/vector_works/_file_actions.html.erb +8 -0
  173. data/app/views/hyrax/vector_works/_form.html.erb +16 -0
  174. data/app/views/hyrax/vector_works/_show_actions.html.erb +22 -0
  175. data/app/views/hyrax/vector_works/_vector_actions.html.erb +11 -0
  176. data/app/views/hyrax/vector_works/_vector_work.html.erb +2 -0
  177. data/app/views/hyrax/vector_works/show.html.erb +31 -0
  178. data/app/views/records/edit_fields/_coverage.html.erb +3 -0
  179. data/app/views/records/edit_fields/_should_populate_metadata.html.erb +10 -0
  180. data/app/vocabs/geo_works/geo_terms.rb +12 -0
  181. data/config/discovery/geoblacklight-schema.json +214 -0
  182. data/config/fcrepo_wrapper_test.yml +3 -0
  183. data/config/geoblacklight.yml +12 -0
  184. data/config/geoserver.yml +27 -0
  185. data/config/initializers/geo_server.rb +17 -0
  186. data/config/initializers/geoblacklight_config.rb +18 -0
  187. data/config/initializers/simpler_tiles.rb +65 -0
  188. data/config/locales/image_work.en.yml +8 -0
  189. data/config/locales/raster_work.en.yml +8 -0
  190. data/config/locales/vector_work.en.yml +8 -0
  191. data/config/routes.rb +24 -0
  192. data/config/simpler_tiles.yml +24 -0
  193. data/config/solr_wrapper_test.yml +7 -0
  194. data/docker-compose-full.yml +30 -0
  195. data/docker-compose.yml +9 -0
  196. data/geo_works.gemspec +44 -0
  197. data/lib/generators/geo_works/install_generator.rb +152 -0
  198. data/lib/generators/geo_works/templates/actors/hyrax/actors/image_work_actor.rb +6 -0
  199. data/lib/generators/geo_works/templates/actors/hyrax/actors/raster_work_actor.rb +6 -0
  200. data/lib/generators/geo_works/templates/actors/hyrax/actors/vector_work_actor.rb +6 -0
  201. data/lib/generators/geo_works/templates/config/authorities/image_formats.yml +7 -0
  202. data/lib/generators/geo_works/templates/config/authorities/metadata_formats.yml +7 -0
  203. data/lib/generators/geo_works/templates/config/authorities/raster_formats.yml +13 -0
  204. data/lib/generators/geo_works/templates/config/authorities/vector_formats.yml +7 -0
  205. data/lib/generators/geo_works/templates/config/initializers/hyrax_derivative_path_monkey_patch.rb +18 -0
  206. data/lib/generators/geo_works/templates/controllers/hyrax/file_sets_controller.rb +7 -0
  207. data/lib/generators/geo_works/templates/controllers/hyrax/image_works_controller.rb +7 -0
  208. data/lib/generators/geo_works/templates/controllers/hyrax/raster_works_controller.rb +8 -0
  209. data/lib/generators/geo_works/templates/controllers/hyrax/vector_works_controller.rb +8 -0
  210. data/lib/generators/geo_works/templates/geo_works.js +1 -0
  211. data/lib/generators/geo_works/templates/geo_works.scss +3 -0
  212. data/lib/generators/geo_works/templates/models/file_set.rb +4 -0
  213. data/lib/generators/geo_works/templates/models/image_work.rb +7 -0
  214. data/lib/generators/geo_works/templates/models/raster_work.rb +8 -0
  215. data/lib/generators/geo_works/templates/models/vector_work.rb +8 -0
  216. data/lib/generators/geo_works/templates/presenters/file_set_presenter.rb +3 -0
  217. data/lib/generators/geo_works/templates/spec/actor_spec.rb.erb +9 -0
  218. data/lib/generators/geo_works/templates/spec/controller_spec.rb.erb +9 -0
  219. data/lib/generators/geo_works/templates/spec/model_spec.rb.erb +9 -0
  220. data/lib/geo_works.rb +9 -0
  221. data/lib/geo_works/engine.rb +4 -0
  222. data/lib/geo_works/version.rb +3 -0
  223. data/lib/tasks/geo_works_tasks.rake +4 -0
  224. data/run-docker.sh +16 -0
  225. data/solr/config/_rest_managed.json +3 -0
  226. data/solr/config/admin-extra.html +31 -0
  227. data/solr/config/elevate.xml +36 -0
  228. data/solr/config/mapping-ISOLatin1Accent.txt +246 -0
  229. data/solr/config/protwords.txt +21 -0
  230. data/solr/config/schema.xml +372 -0
  231. data/solr/config/scripts.conf +24 -0
  232. data/solr/config/solrconfig.xml +321 -0
  233. data/solr/config/spellings.txt +2 -0
  234. data/solr/config/stopwords.txt +58 -0
  235. data/solr/config/stopwords_en.txt +58 -0
  236. data/solr/config/synonyms.txt +31 -0
  237. data/solr/config/xslt/example.xsl +132 -0
  238. data/solr/config/xslt/example_atom.xsl +67 -0
  239. data/solr/config/xslt/example_rss.xsl +66 -0
  240. data/solr/config/xslt/luke.xsl +337 -0
  241. data/spec/controllers/file_sets_controller_spec.rb +70 -0
  242. data/spec/controllers/image_works_controller_spec.rb +40 -0
  243. data/spec/controllers/raster_works_controller_spec.rb +36 -0
  244. data/spec/controllers/vector_works_controller_spec.rb +69 -0
  245. data/spec/factories/collections.rb +17 -0
  246. data/spec/factories/external_metadata_files.rb +20 -0
  247. data/spec/factories/image_files.rb +32 -0
  248. data/spec/factories/image_works.rb +69 -0
  249. data/spec/factories/permission_templates.rb +41 -0
  250. data/spec/factories/raster_files.rb +35 -0
  251. data/spec/factories/raster_works.rb +88 -0
  252. data/spec/factories/sipity_entities.rb +7 -0
  253. data/spec/factories/users.rb +26 -0
  254. data/spec/factories/vector_files.rb +31 -0
  255. data/spec/factories/vector_works.rb +84 -0
  256. data/spec/factories/workflow_states.rb +6 -0
  257. data/spec/factories/workflows.rb +6 -0
  258. data/spec/features/create_image_work_spec.rb +34 -0
  259. data/spec/features/create_raster_work_spec.rb +35 -0
  260. data/spec/features/create_vector_work_spec.rb +34 -0
  261. data/spec/features/image_work_show_spec.rb +62 -0
  262. data/spec/features/raster_work_show_spec.rb +62 -0
  263. data/spec/features/vector_work_show_spec.rb +61 -0
  264. data/spec/forms/geo_works/basic_geo_metadata_form_spec.rb +31 -0
  265. data/spec/forms/geo_works/external_metadata_file_form_spec.rb +30 -0
  266. data/spec/forms/geo_works/georeferenced_form_spec.rb +33 -0
  267. data/spec/forms/hyrax/image_work_form_spec.rb +11 -0
  268. data/spec/forms/hyrax/raster_work_form_spec.rb +17 -0
  269. data/spec/forms/hyrax/vector_work_form_spec.rb +17 -0
  270. data/spec/helpers/bounding_box_helper_spec.rb +39 -0
  271. data/spec/helpers/geo_works/file_set_actions_helper_spec.rb +70 -0
  272. data/spec/helpers/geo_works/populate_metadata_helper_spec.rb +31 -0
  273. data/spec/helpers/geo_works_helper_spec.rb +30 -0
  274. data/spec/jobs/geoblacklight_job_spec.rb +18 -0
  275. data/spec/jobs/geoserver_delivery_job_spec.rb +45 -0
  276. data/spec/models/concerns/basic_geo_metadata_spec.rb +21 -0
  277. data/spec/models/concerns/geo_works/file_set/derivatives_spec.rb +102 -0
  278. data/spec/models/concerns/geo_works/file_set/geo_file_format_behavior_spec.rb +56 -0
  279. data/spec/models/external_metadata_file_spec.rb +118 -0
  280. data/spec/models/file_set_spec.rb +9 -0
  281. data/spec/models/image_file_spec.rb +48 -0
  282. data/spec/models/image_work_spec.rb +71 -0
  283. data/spec/models/raster_file_spec.rb +48 -0
  284. data/spec/models/raster_work_spec.rb +122 -0
  285. data/spec/models/solr_document_spec.rb +41 -0
  286. data/spec/models/vector_file_spec.rb +48 -0
  287. data/spec/models/vector_work_spec.rb +109 -0
  288. data/spec/presenters/file_set_presenter_spec.rb +13 -0
  289. data/spec/presenters/geo_works_show_presenter_spec.rb +46 -0
  290. data/spec/presenters/image_work_show_presenter_spec.rb +51 -0
  291. data/spec/presenters/raster_work_show_presenter_spec.rb +74 -0
  292. data/spec/presenters/vector_work_show_presenter_spec.rb +41 -0
  293. data/spec/processors/geo_works/geoblacklight_event_processor_spec.rb +80 -0
  294. data/spec/processors/geo_works/processors/base_geo_processor_spec.rb +115 -0
  295. data/spec/processors/geo_works/processors/gdal_spec.rb +59 -0
  296. data/spec/processors/geo_works/processors/image_spec.rb +64 -0
  297. data/spec/processors/geo_works/processors/ogr_spec.rb +36 -0
  298. data/spec/processors/geo_works/processors/raster/aig_spec.rb +35 -0
  299. data/spec/processors/geo_works/processors/raster/base_spec.rb +54 -0
  300. data/spec/processors/geo_works/processors/raster/dem_spec.rb +30 -0
  301. data/spec/processors/geo_works/processors/raster/info_spec.rb +35 -0
  302. data/spec/processors/geo_works/processors/raster/processor_spec.rb +39 -0
  303. data/spec/processors/geo_works/processors/rendering_spec.rb +64 -0
  304. data/spec/processors/geo_works/processors/vector/base_spec.rb +54 -0
  305. data/spec/processors/geo_works/processors/vector/info_spec.rb +50 -0
  306. data/spec/processors/geo_works/processors/vector/processor_spec.rb +28 -0
  307. data/spec/processors/geo_works/processors/vector/shapefile_spec.rb +17 -0
  308. data/spec/processors/geo_works/processors/zip_spec.rb +39 -0
  309. data/spec/renderers/geo_works/coverage_renderer_spec.rb +21 -0
  310. data/spec/services/geo_works/delivery/geoserver_spec.rb +117 -0
  311. data/spec/services/geo_works/delivery_service_spec.rb +24 -0
  312. data/spec/services/geo_works/discovery/abstract_document_spec.rb +23 -0
  313. data/spec/services/geo_works/discovery/document_builder/basic_metadata_builder_spec.rb +35 -0
  314. data/spec/services/geo_works/discovery/document_builder/wxs_spec.rb +71 -0
  315. data/spec/services/geo_works/discovery/document_builder_spec.rb +220 -0
  316. data/spec/services/geo_works/discovery/geoblacklight_document_spec.rb +20 -0
  317. data/spec/services/geo_works/event_generator_spec.rb +18 -0
  318. data/spec/services/geo_works/events_generator/geoblacklight_event_generator_spec.rb +84 -0
  319. data/spec/services/geo_works/events_generator/geoserver_event_generator_spec.rb +22 -0
  320. data/spec/services/geo_works/raster_format_service_spec.rb +13 -0
  321. data/spec/services/hyrax/derivative_path_spec.rb +26 -0
  322. data/spec/spec_helper.rb +77 -0
  323. data/spec/support/backport_test.rb +14 -0
  324. data/spec/support/controllers/engine_helpers.rb +7 -0
  325. data/spec/support/database_cleaner.rb +18 -0
  326. data/spec/support/factory_girl.rb +3 -0
  327. data/spec/support/features.rb +14 -0
  328. data/spec/support/features/session_helpers.rb +40 -0
  329. data/spec/support/fixture_reader.rb +7 -0
  330. data/spec/support/helpers/controller_level_helpers.rb +27 -0
  331. data/spec/support/views/test_view_helpers.rb +10 -0
  332. data/spec/test_app_templates/lib/generators/test_app_generator.rb +24 -0
  333. data/spec/values/coverage_spec.rb +40 -0
  334. data/tasks/geo_works.rake +39 -0
  335. data/template.rb +10 -0
  336. metadata +789 -0
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe GeoWorks::Discovery::DocumentBuilder::BasicMetadataBuilder do
4
+ subject { described_class.new(geo_concern) }
5
+
6
+ let(:geo_concern) { FactoryGirl.build(:public_vector_work, id: 'geo-work-1') }
7
+ let(:id_string) { 'ark:/99999/fk4' }
8
+
9
+ describe '#identifier' do
10
+ context 'nil' do
11
+ it 'returns the geo_concern id' do
12
+ allow(geo_concern).to receive(:identifier).and_return(nil)
13
+ expect(subject.send(:identifier)).to eq 'geo-work-1'
14
+ end
15
+ end
16
+ context 'String' do
17
+ it 'returns the identifier string' do
18
+ allow(geo_concern).to receive(:identifier).and_return(id_string)
19
+ expect(subject.send(:identifier)).to eq id_string
20
+ end
21
+ end
22
+ context 'empty array' do
23
+ it 'returns the geo_concern id' do
24
+ allow(geo_concern).to receive(:identifier).and_return([])
25
+ expect(subject.send(:identifier)).to eq 'geo-work-1'
26
+ end
27
+ end
28
+ context 'array with String' do
29
+ it 'returns the identifier string' do
30
+ allow(geo_concern).to receive(:identifier).and_return([id_string])
31
+ expect(subject.send(:identifier)).to eq id_string
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+
3
+ describe GeoWorks::Discovery::DocumentBuilder::Wxs do
4
+ subject { described_class.new(geo_concern_presenter) }
5
+
6
+ let(:geo_concern) { FactoryGirl.build(:public_vector_work, id: 'geo-work-1') }
7
+ let(:geo_concern_presenter) { GeoWorks::VectorWorkShowPresenter.new(SolrDocument.new(geo_concern.to_solr), nil) }
8
+ let(:geo_file_mime_type) { 'application/zip; ogr-format="ESRI Shapefile"' }
9
+ let(:geo_file) { FileSet.new(id: 'geofile', geo_mime_type: geo_file_mime_type) }
10
+ let(:geo_file_presenter) { Hyrax::FileSetPresenter.new(SolrDocument.new(geo_file.to_solr), nil) }
11
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC }
12
+
13
+ before do
14
+ allow(geo_file_presenter.solr_document).to receive(:visibility).and_return(visibility)
15
+ allow(geo_concern_presenter).to receive(:member_presenters).and_return([geo_file_presenter])
16
+ allow(geo_concern_presenter).to receive(:file_set_presenters).and_return([geo_file_presenter])
17
+ end
18
+
19
+ describe '#identifier' do
20
+ context 'public document' do
21
+ it 'returns a public identifier' do
22
+ expect(subject.identifier).to eq 'public:geofile'
23
+ end
24
+ end
25
+
26
+ context 'private document' do
27
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE }
28
+ it 'returns a the fileset id' do
29
+ expect(subject.identifier).to eq 'geofile'
30
+ end
31
+ end
32
+ end
33
+
34
+ describe '#wms_path' do
35
+ context 'public document' do
36
+ it 'returns a public wms path' do
37
+ expect(subject.wms_path).to eq 'http://localhost:8181/geoserver/public/wms'
38
+ end
39
+ end
40
+
41
+ context 'restricted document' do
42
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED }
43
+ it 'returns a restricted value' do
44
+ expect(subject.wms_path).to eq 'http://localhost:8181/geoserver/restricted/wms'
45
+ end
46
+ end
47
+
48
+ context 'private document' do
49
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE }
50
+ it 'returns a nil value' do
51
+ expect(subject.wms_path).to be_nil
52
+ end
53
+ end
54
+ end
55
+
56
+ describe '#wfs_path' do
57
+ context 'public document' do
58
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC }
59
+ it 'returns a valid wms path' do
60
+ expect(subject.wfs_path).to eq 'http://localhost:8181/geoserver/public/wfs'
61
+ end
62
+ end
63
+
64
+ context 'private document' do
65
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE }
66
+ it 'returns a nil value' do
67
+ expect(subject.wfs_path).to be_nil
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,220 @@
1
+ require 'spec_helper'
2
+
3
+ # See https://github.com/geoblacklight/geoblacklight/wiki/Schema
4
+
5
+ describe GeoWorks::Discovery::DocumentBuilder do
6
+ subject { described_class.new(geo_concern_presenter, document_class) }
7
+
8
+ let(:geo_concern) { FactoryGirl.build(:public_vector_work, attributes) }
9
+ let(:geo_concern_presenter) { GeoWorks::VectorWorkShowPresenter.new(SolrDocument.new(geo_concern.to_solr), nil) }
10
+ let(:document_class) { GeoWorks::Discovery::GeoblacklightDocument.new }
11
+ let(:document) { JSON.parse(subject.to_json(nil)) }
12
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC }
13
+ let(:metadata__mime_type) { 'application/xml; schema=iso19139' }
14
+ let(:metadata_file) { FileSet.new(id: 'metadatafile', geo_mime_type: metadata__mime_type) }
15
+ let(:metadata_presenter) { Hyrax::FileSetPresenter.new(SolrDocument.new(metadata_file.to_solr), nil) }
16
+ let(:geo_file_mime_type) { 'application/zip; ogr-format="ESRI Shapefile"' }
17
+ let(:geo_file) { FileSet.new(id: 'geofile', geo_mime_type: geo_file_mime_type) }
18
+ let(:geo_file_presenter) { Hyrax::FileSetPresenter.new(SolrDocument.new(geo_file.to_solr), nil) }
19
+ let(:coverage) { GeoWorks::Coverage.new(43.039, -69.856, 42.943, -71.032) }
20
+ let(:issued) { '01/02/2013' }
21
+ let(:issued_xmlschema) { '2013-02-01T00:00:00Z' }
22
+ let(:attributes) { { id: 'geo-work-1',
23
+ title: ['Geo Work'],
24
+ coverage: coverage.to_s,
25
+ description: ['This is a Geo Work'],
26
+ creator: ['Yosiwo George'],
27
+ publisher: ['National Geographic'],
28
+ issued: issued,
29
+ spatial: ['Micronesia'],
30
+ temporal: ['2011'],
31
+ subject: ['Human settlements'],
32
+ language: ['Esperanto'],
33
+ identifier: ['ark:/99999/fk4'] }
34
+ }
35
+
36
+ before do
37
+ allow(geo_concern_presenter.solr_document).to receive(:visibility).and_return(visibility)
38
+ allow(geo_concern_presenter.solr_document).to receive(:representative_id).and_return(geo_file_presenter.id)
39
+ allow(geo_concern_presenter).to receive(:file_set_presenters).and_return([geo_file_presenter, metadata_presenter])
40
+ allow(geo_concern_presenter).to receive(:member_presenters).and_return([geo_file_presenter, metadata_presenter])
41
+ allow(geo_file_presenter.request).to receive_messages(host_with_port: 'localhost:3000', protocol: 'http://')
42
+ end
43
+
44
+ describe 'vector work' do
45
+ context 'required' do
46
+ it 'has all metadata' do
47
+ expect(document['dc_identifier_s']).to eq('ark:/99999/fk4')
48
+ expect(document['layer_slug_s']).to eq('institution-geo-work-1')
49
+ expect(document['dc_title_s']).to eq('Geo Work')
50
+ expect(document['solr_geom']).to eq('ENVELOPE(-71.032, -69.856, 43.039, 42.943)')
51
+ expect(document['dct_provenance_s']).to eq('Institution')
52
+ expect(document['dc_rights_s']).to eq('Public')
53
+ expect(document['geoblacklight_version']).to eq('1.0')
54
+ end
55
+ end
56
+
57
+ context 'optional' do
58
+ it 'has metadata' do
59
+ expect(document['dc_description_s']).to eq('This is a Geo Work')
60
+ expect(document['dc_creator_sm']).to eq(['Yosiwo George'])
61
+ expect(document['dc_subject_sm']).to eq(['Human settlements'])
62
+ expect(document['dct_spatial_sm']).to eq(['Micronesia'])
63
+ expect(document['dct_temporal_sm']).to eq(['2011'])
64
+ expect(document['dc_language_s']).to eq('Esperanto')
65
+ expect(document['dc_publisher_s']).to eq('National Geographic')
66
+ end
67
+
68
+ it 'has modified date' do
69
+ expect(document).to include('layer_modified_dt')
70
+ # TODO: Rails 4 puts +00:00 rather than Z for `xmlschema` format
71
+ expect(document['layer_modified_dt']).to match(/\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(Z|\+00:00)/)
72
+ end
73
+
74
+ context 'issued date' do
75
+ it 'works with valid date' do
76
+ expect(document).to include('dct_issued_dt')
77
+ expect(document['dct_issued_dt']).to eq(issued_xmlschema)
78
+ end
79
+ end
80
+
81
+ it 'has date field' do
82
+ expect(document['solr_year_i']).to eq(2011)
83
+ end
84
+
85
+ it 'has layer info fields' do
86
+ expect(document['layer_geom_type_s']).to eq('Mixed')
87
+ expect(document['dc_format_s']).to eq('Shapefile')
88
+ end
89
+
90
+ it 'has references' do
91
+ refs = JSON.parse(document['dct_references_s'])
92
+ expect(refs['http://schema.org/url']).to eq('http://localhost:3000/concern/vector_works/geo-work-1')
93
+ expect(refs['http://www.isotc211.org/schemas/2005/gmd/']).to eq('http://localhost:3000/downloads/metadatafile')
94
+ expect(refs['http://schema.org/downloadUrl']).to eq('http://localhost:3000/downloads/geofile')
95
+ expect(refs['http://schema.org/thumbnailUrl']).to eq('http://localhost:3000/downloads/geofile?file=thumbnail')
96
+ end
97
+ end
98
+ end
99
+
100
+ describe 'raster work' do
101
+ let(:geo_concern_presenter) { GeoWorks::RasterWorkShowPresenter.new(SolrDocument.new(geo_concern.to_solr), nil) }
102
+
103
+ context 'with a GeoTIFF file and a FGDC metadata file' do
104
+ let(:geo_file_mime_type) { 'image/tiff; gdal-format=GTiff' }
105
+ let(:metadata__mime_type) { 'application/xml; schema=fgdc' }
106
+
107
+ it 'has layer info fields' do
108
+ expect(document['layer_geom_type_s']).to eq('Raster')
109
+ expect(document['dc_format_s']).to eq('GeoTIFF')
110
+ end
111
+
112
+ it 'has references' do
113
+ refs = JSON.parse(document['dct_references_s'])
114
+ expect(refs['http://www.opengis.net/cat/csw/csdgm']).to eq('http://localhost:3000/downloads/metadatafile')
115
+ end
116
+ end
117
+
118
+ context 'with an ArcGRID file and a MODS metadata file' do
119
+ let(:geo_file_mime_type) { 'application/octet-stream; gdal-format=AIG' }
120
+ let(:metadata__mime_type) { 'application/mods+xml' }
121
+
122
+ it 'has layer info fields' do
123
+ expect(document['dc_format_s']).to eq('ArcGRID')
124
+ end
125
+
126
+ it 'has references' do
127
+ refs = JSON.parse(document['dct_references_s'])
128
+ expect(refs['http://www.loc.gov/mods/v3']).to eq('http://localhost:3000/downloads/metadatafile')
129
+ end
130
+ end
131
+ end
132
+
133
+ describe 'image work' do
134
+ let(:geo_concern_presenter) { GeoWorks::ImageWorkShowPresenter.new(SolrDocument.new(geo_concern.to_solr), nil) }
135
+
136
+ context 'with a tiff file and no decription' do
137
+ let(:geo_file_mime_type) { 'image/tiff' }
138
+
139
+ before do
140
+ allow(geo_concern_presenter).to receive(:description).and_return([])
141
+ end
142
+
143
+ it 'uses a default description' do
144
+ expect(document['dc_description_s']).to eq('A vector work object.')
145
+ end
146
+
147
+ it 'has layer info fields' do
148
+ expect(document['layer_geom_type_s']).to eq('Scanned Map')
149
+ expect(document['dc_format_s']).to eq('TIFF')
150
+ end
151
+ end
152
+ end
153
+
154
+ context 'with a missing required metadata field' do
155
+ before do
156
+ allow(geo_concern_presenter).to receive(:coverage).and_return(nil)
157
+ end
158
+
159
+ it 'returns an error document' do
160
+ expect(document['error'][0]).to include('solr_geom')
161
+ expect(document['error'].size).to eq(1)
162
+ end
163
+ end
164
+
165
+ context 'with a missing non-required metadata field' do
166
+ before do
167
+ allow(geo_concern_presenter).to receive(:language).and_return([])
168
+ end
169
+
170
+ it 'returns a document without the field but valid' do
171
+ expect(document['dc_language_s']).to be_nil
172
+ end
173
+ end
174
+
175
+ context 'with a missing temporal field' do
176
+ before do
177
+ allow(geo_concern_presenter).to receive(:temporal).and_return([])
178
+ end
179
+
180
+ it 'returns a document without the field but valid' do
181
+ expect(document['dct_temporal_sm']).to be_nil
182
+ end
183
+ end
184
+
185
+ context 'with a missing issued field' do
186
+ before do
187
+ allow(geo_concern_presenter).to receive(:issued).and_return(nil)
188
+ end
189
+
190
+ it 'returns a document without the field but valid' do
191
+ expect(document['dct_issued_dt']).to be_nil
192
+ end
193
+ end
194
+
195
+ context 'with an authenticated visibility' do
196
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED }
197
+
198
+ it 'returns a restricted rights field value' do
199
+ expect(document['dc_rights_s']).to eq('Restricted')
200
+ end
201
+ end
202
+
203
+ context 'with a private visibility' do
204
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE }
205
+
206
+ it 'returns an empty document' do
207
+ expect(document).to eq({})
208
+ end
209
+ end
210
+
211
+ context 'with ssl enabled' do
212
+ before do
213
+ allow(geo_file_presenter.request).to receive_messages(host_with_port: 'localhost:3000', protocol: 'https://')
214
+ end
215
+ it 'returns https reference urls' do
216
+ refs = JSON.parse(document['dct_references_s'])
217
+ expect(refs['http://schema.org/url']).to eq('https://localhost:3000/concern/vector_works/geo-work-1')
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe GeoWorks::Discovery::GeoblacklightDocument do
4
+ subject { described_class.new }
5
+
6
+ describe '#to_hash' do
7
+ before do
8
+ allow(subject).to receive(:rights).and_return('Public')
9
+ allow(subject).to receive(:document_hash).and_return(document_hash)
10
+ end
11
+ context 'incomplete data' do
12
+ let(:document_hash) { Hash.new }
13
+
14
+ it 'fails to validate the document hash' do
15
+ expect(subject.to_hash).to include(:error)
16
+ expect(subject.to_hash[:error].size).to eq(6)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe GeoWorks::EventsGenerator do
4
+ subject { described_class.new }
5
+ let(:file_set) { instance_double(FileSet) }
6
+ let(:generator) { instance_double(GeoWorks::EventsGenerator::GeoserverEventGenerator) }
7
+
8
+ before do
9
+ allow(GeoWorks::EventsGenerator::GeoserverEventGenerator).to receive(:new).and_return(generator)
10
+ end
11
+
12
+ describe "#derivatives_created" do
13
+ it 'delegates to the geoserver event generator' do
14
+ expect(generator).to receive(:derivatives_created).with(file_set)
15
+ subject.derivatives_created(file_set)
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe GeoWorks::EventsGenerator::GeoblacklightEventGenerator do
4
+ subject { described_class.new }
5
+ let(:geo_concern) { FactoryGirl.build(:public_vector_work, attributes) }
6
+ let(:record) { GeoWorks::VectorWorkShowPresenter.new(SolrDocument.new(geo_concern.to_solr), nil) }
7
+ let(:visibility) { Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC }
8
+ let(:coverage) { GeoWorks::Coverage.new(43, -69, 42, -71) }
9
+ let(:attributes) { { id: 'geo-work-1',
10
+ title: ['Geo Work'],
11
+ coverage: coverage.to_s,
12
+ description: ['geo work'],
13
+ temporal: ['2011'] }
14
+ }
15
+ let(:refs) { { "http://schema.org/url" => "http://localhost:3000/concern/vector_works/geo-work-1" } }
16
+ let(:layer_modified) do
17
+ datetime = record.solr_document[:system_modified_dtsi]
18
+ DateTime.parse(datetime.to_s).utc.xmlschema
19
+ end
20
+ let(:discovery_doc) { { geoblacklight_version: "1.0",
21
+ dc_identifier_s: "geo-work-1",
22
+ layer_slug_s: "institution-geo-work-1",
23
+ uuid: "institution-geo-work-1",
24
+ dc_title_s: record.title.first,
25
+ solr_geom: "ENVELOPE(-71.0, -69.0, 43.0, 42.0)",
26
+ dct_provenance_s: "Institution",
27
+ dc_rights_s: "Public",
28
+ dc_description_s: "geo work",
29
+ dct_temporal_sm: ["2011"],
30
+ solr_year_i: 2011,
31
+ layer_id_s: 'geo-work-1',
32
+ layer_modified_dt: layer_modified,
33
+ dct_references_s: refs.to_json,
34
+ layer_geom_type_s: "Mixed" }
35
+ }
36
+
37
+ before do
38
+ allow(record.solr_document).to receive(:visibility).and_return(visibility)
39
+ allow(record.request).to receive_messages(host_with_port: 'localhost:3000', protocol: 'http://')
40
+ allow(GeoblacklightJob).to receive(:perform_later)
41
+ end
42
+
43
+ describe "#record_created" do
44
+ it "publishes a persistent JSON message" do
45
+ geo_concern.save
46
+ expected_result = {
47
+ "id" => record.id,
48
+ "event" => "CREATED",
49
+ "doc" => discovery_doc
50
+ }
51
+ subject.record_created(record)
52
+ expect(GeoblacklightJob).to have_received(:perform_later).with(expected_result)
53
+ end
54
+ end
55
+
56
+ describe "#record_deleted" do
57
+ it "publishes a persistent JSON message" do
58
+ geo_concern.save
59
+ geo_concern.destroy
60
+ expected_result = {
61
+ "id" => "institution-geo-work-1",
62
+ "event" => "DELETED"
63
+ }
64
+
65
+ subject.record_deleted(record)
66
+ expect(GeoblacklightJob).to have_received(:perform_later).with(expected_result)
67
+ end
68
+ end
69
+
70
+ describe "#record_updated" do
71
+ let(:title) { ['New Geo Work'] }
72
+ it "publishes a persistent JSON message with new title" do
73
+ geo_concern.title = ["New Geo Work"]
74
+ geo_concern.save!
75
+ expected_result = {
76
+ "id" => record.id,
77
+ "event" => "UPDATED",
78
+ "doc" => discovery_doc
79
+ }
80
+ subject.record_updated(record)
81
+ expect(GeoblacklightJob).to have_received(:perform_later).with(expected_result)
82
+ end
83
+ end
84
+ end