sufia 6.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -5
  3. data/CONTRIBUTING.md +4 -4
  4. data/Gemfile +2 -1
  5. data/History.md +69 -0
  6. data/README.md +84 -4
  7. data/SUFIA_VERSION +1 -1
  8. data/app/assets/images/zotero.png +0 -0
  9. data/app/assets/javascripts/sufia/featured_works.js +20 -3
  10. data/app/assets/stylesheets/generic_files.css.erb +2 -2
  11. data/app/assets/stylesheets/sufia.css.scss +2 -2
  12. data/app/assets/stylesheets/sufia/_buttons.scss +2 -2
  13. data/app/assets/stylesheets/sufia/_collections.scss +4 -4
  14. data/app/assets/stylesheets/sufia/_dashboard.scss +1 -1
  15. data/app/assets/stylesheets/sufia/_file-listing.scss +3 -0
  16. data/app/assets/stylesheets/sufia/_modal.scss +4 -0
  17. data/app/assets/stylesheets/sufia/_settings.scss +4 -3
  18. data/app/assets/stylesheets/sufia/_styles.scss +4 -0
  19. data/app/controllers/admin/stats_controller.rb +68 -0
  20. data/app/controllers/api/items_controller.rb +78 -0
  21. data/app/controllers/api/zotero_controller.rb +70 -0
  22. data/app/controllers/authorities_controller.rb +6 -5
  23. data/app/controllers/concerns/sufia/batch_edits_controller_behavior.rb +2 -1
  24. data/app/controllers/concerns/sufia/breadcrumbs.rb +1 -1
  25. data/app/controllers/concerns/sufia/depositors_controller_behavior.rb +11 -0
  26. data/app/controllers/concerns/sufia/files_controller/browse_everything.rb +1 -1
  27. data/app/controllers/concerns/sufia/files_controller/local_ingest_behavior.rb +1 -1
  28. data/app/controllers/concerns/sufia/files_controller_behavior.rb +23 -11
  29. data/app/controllers/concerns/sufia/my_controller_behavior.rb +1 -7
  30. data/app/controllers/concerns/sufia/users_controller_behavior.rb +1 -2
  31. data/app/controllers/my/collections_controller.rb +1 -0
  32. data/app/controllers/my/files_controller.rb +1 -1
  33. data/app/helpers/sufia/sufia_helper_behavior.rb +28 -16
  34. data/app/models/my_search_builder.rb +4 -0
  35. data/app/search_builders/sufia/my_search_builder_behavior.rb +20 -0
  36. data/app/search_builders/sufia/search_builder.rb +1 -1
  37. data/app/views/admin/stats/index.html.erb +68 -0
  38. data/app/views/collections/_action_menu.html.erb +22 -20
  39. data/app/views/collections/_collection.html.erb +1 -1
  40. data/app/views/collections/_form_for_select_collection.html.erb +5 -3
  41. data/app/views/generic_files/_show_actions.html.erb +4 -2
  42. data/app/views/generic_files/show.html.erb +1 -1
  43. data/app/views/layouts/sufia-dashboard.html.erb +5 -4
  44. data/app/views/layouts/sufia-one-column.html.erb +2 -0
  45. data/app/views/layouts/sufia-two-column.html.erb +6 -4
  46. data/app/views/my/_facet_layout.html.erb +2 -2
  47. data/app/views/my/_facets.html.erb +4 -6
  48. data/app/views/my/index.html.erb +4 -3
  49. data/app/views/users/_edit_primary.html.erb +18 -17
  50. data/app/views/users/_follower_modal.html.erb +5 -1
  51. data/app/views/users/_following_modal.html.erb +5 -1
  52. data/app/views/users/_user_info.html.erb +6 -1
  53. data/app/views/users/_zotero.html.erb +12 -0
  54. data/config/locales/sufia.en.yml +10 -1
  55. data/config/routes.rb +23 -1
  56. data/lib/generators/sufia/admin_stat_generator.rb +17 -0
  57. data/lib/generators/sufia/install_generator.rb +8 -3
  58. data/{sufia-models/lib/generators/sufia/models/templates/config/resque_admin.rb → lib/generators/sufia/templates/sufia/stats_admin.rb} +3 -3
  59. data/lib/generators/sufia/upgrade400_generator.rb +2 -2
  60. data/lib/sufia.rb +3 -0
  61. data/lib/sufia/arkivo.rb +11 -0
  62. data/lib/sufia/arkivo/actor.rb +95 -0
  63. data/lib/sufia/arkivo/config.rb +11 -0
  64. data/lib/sufia/arkivo/create_subscription_job.rb +67 -0
  65. data/lib/sufia/arkivo/metadata_munger.rb +51 -0
  66. data/lib/sufia/arkivo/schema_validator.rb +55 -0
  67. data/lib/sufia/form_builder.rb +1 -1
  68. data/lib/sufia/inflections.rb +3 -0
  69. data/lib/sufia/version.rb +1 -1
  70. data/lib/sufia/zotero.rb +6 -0
  71. data/lib/sufia/zotero/config.rb +15 -0
  72. data/solr_conf/conf/solrconfig.xml +11 -0
  73. data/spec/controllers/admin_stats_controller_spec.rb +73 -0
  74. data/spec/controllers/api/items_controller_spec.rb +476 -0
  75. data/spec/controllers/api/zotero_controller_spec.rb +178 -0
  76. data/spec/controllers/batch_edits_controller_spec.rb +7 -0
  77. data/spec/controllers/collections_controller_spec.rb +1 -1
  78. data/spec/controllers/dashboard_controller_spec.rb +1 -1
  79. data/spec/controllers/depositors_controller_spec.rb +9 -5
  80. data/spec/controllers/generic_files_controller_spec.rb +5 -4
  81. data/spec/controllers/mailbox_controller_spec.rb +2 -2
  82. data/spec/controllers/my/collections_controller_spec.rb +1 -2
  83. data/spec/controllers/my/files_controller_spec.rb +5 -5
  84. data/spec/controllers/my/shares_controller_spec.rb +15 -3
  85. data/spec/controllers/pages_controller_spec.rb +1 -1
  86. data/spec/controllers/users_controller_spec.rb +10 -9
  87. data/spec/factories/api_items.rb +91 -0
  88. data/spec/factories/generic_files.rb +4 -0
  89. data/spec/factories/users.rb +4 -4
  90. data/spec/features/featured_item_spec.rb +26 -0
  91. data/spec/features/ingest_upload_files_spec.rb +2 -3
  92. data/spec/features/proxy_spec.rb +0 -1
  93. data/spec/helpers/permissions_helper_spec.rb +2 -2
  94. data/spec/helpers/sufia_helper_spec.rb +11 -5
  95. data/spec/inputs/select_with_help_input_spec.rb +2 -2
  96. data/spec/javascripts/helpers/.gitkeep +0 -0
  97. data/spec/javascripts/helpers/jasmine-jquery.js +832 -0
  98. data/spec/javascripts/jasmine_spec.rb +31 -0
  99. data/spec/javascripts/notify_update_link_spec.js +8 -0
  100. data/spec/javascripts/single_use_link_spec.js.coffee +23 -0
  101. data/spec/javascripts/support/jasmine.yml +124 -0
  102. data/spec/javascripts/support/jasmine_helper.rb +15 -0
  103. data/spec/javascripts/terms_of_service_spec.js.coffee +32 -0
  104. data/spec/javascripts/toggle_icon_spec.js +11 -0
  105. data/spec/jobs/active_fedora_id_based_job_spec.rb +3 -3
  106. data/spec/jobs/import_url_job_spec.rb +0 -2
  107. data/spec/lib/sufia/arkivo/actor_spec.rb +139 -0
  108. data/spec/lib/sufia/arkivo/create_subscription_job_spec.rb +54 -0
  109. data/spec/lib/sufia/arkivo/metadata_munger_spec.rb +48 -0
  110. data/spec/lib/sufia/arkivo/schema_validator_spec.rb +65 -0
  111. data/spec/lib/sufia/upload_complete_behavior_spec.rb +1 -1
  112. data/spec/lib/sufia/user_stat_importer_spec.rb +60 -0
  113. data/spec/lib/sufia/zotero/config_spec.rb +30 -0
  114. data/spec/models/collection_spec.rb +36 -7
  115. data/spec/models/file_download_stat_spec.rb +5 -5
  116. data/spec/models/file_usage_spec.rb +23 -0
  117. data/spec/models/file_view_stat_spec.rb +6 -6
  118. data/spec/models/fits_datastream_spec.rb +0 -5
  119. data/spec/models/generic_file_spec.rb +49 -14
  120. data/spec/models/local_authority_spec.rb +1 -1
  121. data/spec/models/proxy_deposit_request_spec.rb +1 -1
  122. data/spec/models/trophy_spec.rb +8 -8
  123. data/spec/models/user_spec.rb +33 -0
  124. data/spec/presenters/sufia/collection_presenter_spec.rb +1 -1
  125. data/spec/routing/api_route_spec.rb +91 -0
  126. data/spec/routing/route_spec.rb +1 -1
  127. data/spec/services/generic_file_audit_service_spec.rb +44 -8
  128. data/spec/spec_helper.rb +18 -3
  129. data/spec/support/features.rb +0 -2
  130. data/spec/support/locations.rb +0 -21
  131. data/spec/support/rake.rb +41 -0
  132. data/spec/support/selectors.rb +0 -50
  133. data/spec/tasks/rake_spec.rb +33 -12
  134. data/spec/test_app_templates/lib/generators/test_app_generator.rb +12 -0
  135. data/spec/views/admin/stats/index.html.erb_spec.rb +45 -0
  136. data/spec/views/catalog/sort_and_per_page.html.erb_spec.rb +0 -1
  137. data/spec/views/dashboard/index_spec.rb +1 -1
  138. data/spec/views/generic_file/edit.html.erb_spec.rb +1 -1
  139. data/spec/views/generic_file/show.html.erb_spec.rb +1 -3
  140. data/spec/views/users/_follower_modal.html.erb_spec.rb +44 -7
  141. data/spec/views/users/_following_modal.html.erb_spec.rb +49 -7
  142. data/spec/views/users/edit.html.erb_spec.rb +72 -0
  143. data/spec/views/users/show.html.erb_spec.rb +1 -1
  144. data/sufia.gemspec +6 -2
  145. data/tasks/sufia-user.rake +14 -0
  146. metadata +130 -156
  147. data/spec/lib/sufia/id_service_spec.rb +0 -32
  148. data/spec/services/noid_spec.rb +0 -9
  149. data/spec/support/poltergeist.rb +0 -11
  150. data/spec/support/rake_output.rb +0 -20
  151. data/sufia-models/.gitignore +0 -17
  152. data/sufia-models/Gemfile +0 -4
  153. data/sufia-models/LICENSE.md +0 -177
  154. data/sufia-models/README.md +0 -39
  155. data/sufia-models/Rakefile +0 -1
  156. data/sufia-models/app/actors/sufia/generic_file/actor.rb +0 -137
  157. data/sufia-models/app/jobs/active_fedora_id_based_job.rb +0 -22
  158. data/sufia-models/app/jobs/active_fedora_pid_based_job.rb +0 -7
  159. data/sufia-models/app/jobs/audit_job.rb +0 -62
  160. data/sufia-models/app/jobs/batch_update_job.rb +0 -72
  161. data/sufia-models/app/jobs/characterize_job.rb +0 -10
  162. data/sufia-models/app/jobs/create_derivatives_job.rb +0 -14
  163. data/sufia-models/app/jobs/import_url_job.rb +0 -52
  164. data/sufia-models/app/jobs/ingest_local_file_job.rb +0 -46
  165. data/sufia-models/app/jobs/resolrize_job.rb +0 -9
  166. data/sufia-models/app/models/batch.rb +0 -36
  167. data/sufia-models/app/models/checksum_audit_log.rb +0 -21
  168. data/sufia-models/app/models/concerns/sufia/ability.rb +0 -61
  169. data/sufia-models/app/models/concerns/sufia/collection_behavior.rb +0 -24
  170. data/sufia-models/app/models/concerns/sufia/file_stat_utils.rb +0 -35
  171. data/sufia-models/app/models/concerns/sufia/generic_file.rb +0 -25
  172. data/sufia-models/app/models/concerns/sufia/generic_file/batches.rb +0 -28
  173. data/sufia-models/app/models/concerns/sufia/generic_file/characterization.rb +0 -89
  174. data/sufia-models/app/models/concerns/sufia/generic_file/content.rb +0 -13
  175. data/sufia-models/app/models/concerns/sufia/generic_file/derivatives.rb +0 -26
  176. data/sufia-models/app/models/concerns/sufia/generic_file/export.rb +0 -343
  177. data/sufia-models/app/models/concerns/sufia/generic_file/featured.rb +0 -11
  178. data/sufia-models/app/models/concerns/sufia/generic_file/full_text_indexing.rb +0 -43
  179. data/sufia-models/app/models/concerns/sufia/generic_file/indexing.rb +0 -14
  180. data/sufia-models/app/models/concerns/sufia/generic_file/metadata.rb +0 -98
  181. data/sufia-models/app/models/concerns/sufia/generic_file/mime_types.rb +0 -69
  182. data/sufia-models/app/models/concerns/sufia/generic_file/permissions.rb +0 -11
  183. data/sufia-models/app/models/concerns/sufia/generic_file/proxy_deposit.rb +0 -31
  184. data/sufia-models/app/models/concerns/sufia/generic_file/trophies.rb +0 -14
  185. data/sufia-models/app/models/concerns/sufia/generic_file/versions.rb +0 -16
  186. data/sufia-models/app/models/concerns/sufia/generic_file/virus_check.rb +0 -37
  187. data/sufia-models/app/models/concerns/sufia/model_methods.rb +0 -20
  188. data/sufia-models/app/models/concerns/sufia/user.rb +0 -137
  189. data/sufia-models/app/models/concerns/sufia/user_usage_stats.rb +0 -15
  190. data/sufia-models/app/models/datastreams/file_content_datastream.rb +0 -4
  191. data/sufia-models/app/models/datastreams/fits_datastream.rb +0 -152
  192. data/sufia-models/app/models/domain_term.rb +0 -5
  193. data/sufia-models/app/models/featured_work.rb +0 -22
  194. data/sufia-models/app/models/file_download_stat.rb +0 -18
  195. data/sufia-models/app/models/file_usage.rb +0 -34
  196. data/sufia-models/app/models/file_view_stat.rb +0 -18
  197. data/sufia-models/app/models/follow.rb +0 -12
  198. data/sufia-models/app/models/generic_file.rb +0 -3
  199. data/sufia-models/app/models/geo_names_resource.rb +0 -18
  200. data/sufia-models/app/models/group.rb +0 -8
  201. data/sufia-models/app/models/local_authority.rb +0 -86
  202. data/sufia-models/app/models/local_authority_entry.rb +0 -3
  203. data/sufia-models/app/models/proxy_deposit_request.rb +0 -85
  204. data/sufia-models/app/models/proxy_deposit_rights.rb +0 -4
  205. data/sufia-models/app/models/single_use_link.rb +0 -42
  206. data/sufia-models/app/models/subject_local_authority_entry.rb +0 -2
  207. data/sufia-models/app/models/sufia/avatar_uploader.rb +0 -20
  208. data/sufia-models/app/models/sufia/avatar_validator.rb +0 -8
  209. data/sufia-models/app/models/sufia/collection.rb +0 -5
  210. data/sufia-models/app/models/sufia/download.rb +0 -9
  211. data/sufia-models/app/models/sufia/orcid_validator.rb +0 -12
  212. data/sufia-models/app/models/sufia/pageview.rb +0 -9
  213. data/sufia-models/app/models/trophy.rb +0 -10
  214. data/sufia-models/app/models/user_stat.rb +0 -2
  215. data/sufia-models/app/models/version_committer.rb +0 -2
  216. data/sufia-models/app/services/sufia/analytics.rb +0 -50
  217. data/sufia-models/app/services/sufia/generic_file_audit_service.rb +0 -83
  218. data/sufia-models/app/services/sufia/generic_file_indexing_service.rb +0 -12
  219. data/sufia-models/app/services/sufia/id_service.rb +0 -45
  220. data/sufia-models/app/services/sufia/noid.rb +0 -22
  221. data/sufia-models/app/services/sufia/repository_audit_service.rb +0 -9
  222. data/sufia-models/config/locales/sufia.en.yml +0 -6
  223. data/sufia-models/lib/generators/sufia/models/abstract_migration_generator.rb +0 -30
  224. data/sufia-models/lib/generators/sufia/models/cached_stats_generator.rb +0 -24
  225. data/sufia-models/lib/generators/sufia/models/fulltext_generator.rb +0 -27
  226. data/sufia-models/lib/generators/sufia/models/install_generator.rb +0 -106
  227. data/sufia-models/lib/generators/sufia/models/orcid_field_generator.rb +0 -19
  228. data/sufia-models/lib/generators/sufia/models/proxies_generator.rb +0 -24
  229. data/sufia-models/lib/generators/sufia/models/templates/app/models/collection.rb +0 -2
  230. data/sufia-models/lib/generators/sufia/models/templates/config/analytics.yml +0 -9
  231. data/sufia-models/lib/generators/sufia/models/templates/config/clamav.rb +0 -1
  232. data/sufia-models/lib/generators/sufia/models/templates/config/mailboxer.rb +0 -17
  233. data/sufia-models/lib/generators/sufia/models/templates/config/mime_types.rb +0 -6
  234. data/sufia-models/lib/generators/sufia/models/templates/config/redis.yml +0 -9
  235. data/sufia-models/lib/generators/sufia/models/templates/config/redis_config.rb +0 -32
  236. data/sufia-models/lib/generators/sufia/models/templates/config/resque-pool.yml +0 -1
  237. data/sufia-models/lib/generators/sufia/models/templates/config/resque_config.rb +0 -5
  238. data/sufia-models/lib/generators/sufia/models/templates/config/setup_mail.rb +0 -3
  239. data/sufia-models/lib/generators/sufia/models/templates/config/solrconfig.xml +0 -223
  240. data/sufia-models/lib/generators/sufia/models/templates/config/sufia.rb +0 -144
  241. data/sufia-models/lib/generators/sufia/models/templates/migrations/acts_as_follower_migration.rb +0 -17
  242. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_avatars_to_users.rb +0 -15
  243. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_external_key_to_content_blocks.rb +0 -6
  244. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_groups_to_users.rb +0 -11
  245. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_ldap_attrs_to_user.rb +0 -27
  246. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_linkedin_to_users.rb +0 -5
  247. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_orcid_to_users.rb +0 -5
  248. data/sufia-models/lib/generators/sufia/models/templates/migrations/add_social_to_users.rb +0 -13
  249. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_audit_log_pid_to_generic_file_id.rb +0 -5
  250. data/sufia-models/lib/generators/sufia/models/templates/migrations/change_proxy_deposit_request_pid_to_generic_file_id.rb +0 -5
  251. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_checksum_audit_logs.rb +0 -19
  252. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_content_blocks.rb +0 -10
  253. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_featured_works.rb +0 -12
  254. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_download_stats.rb +0 -12
  255. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_file_view_stats.rb +0 -12
  256. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_local_authorities.rb +0 -50
  257. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_requests.rb +0 -16
  258. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_proxy_deposit_rights.rb +0 -11
  259. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_single_use_links.rb +0 -12
  260. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_tinymce_assets.rb +0 -8
  261. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_trophies.rb +0 -10
  262. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_user_stats.rb +0 -19
  263. data/sufia-models/lib/generators/sufia/models/templates/migrations/create_version_committers.rb +0 -15
  264. data/sufia-models/lib/generators/sufia/models/update_content_blocks_generator.rb +0 -18
  265. data/sufia-models/lib/generators/sufia/models/upgrade400_generator.rb +0 -54
  266. data/sufia-models/lib/generators/sufia/models/upgrade600_generator.rb +0 -21
  267. data/sufia-models/lib/generators/sufia/models/usagestats_generator.rb +0 -19
  268. data/sufia-models/lib/generators/sufia/models/user_stats_generator.rb +0 -31
  269. data/sufia-models/lib/sufia/messages.rb +0 -66
  270. data/sufia-models/lib/sufia/models.rb +0 -34
  271. data/sufia-models/lib/sufia/models/active_fedora/redis.rb +0 -43
  272. data/sufia-models/lib/sufia/models/active_record/redis.rb +0 -56
  273. data/sufia-models/lib/sufia/models/engine.rb +0 -79
  274. data/sufia-models/lib/sufia/models/file_content.rb +0 -6
  275. data/sufia-models/lib/sufia/models/file_content/versions.rb +0 -21
  276. data/sufia-models/lib/sufia/models/resque.rb +0 -36
  277. data/sufia-models/lib/sufia/models/stats/user_stat_importer.rb +0 -108
  278. data/sufia-models/lib/sufia/models/user_local_directory_behavior.rb +0 -29
  279. data/sufia-models/lib/sufia/models/utils.rb +0 -22
  280. data/sufia-models/lib/sufia/models/version.rb +0 -5
  281. data/sufia-models/lib/sufia/models/virus_found_error.rb +0 -4
  282. data/sufia-models/lib/sufia/permissions.rb +0 -9
  283. data/sufia-models/lib/sufia/permissions/readable.rb +0 -20
  284. data/sufia-models/lib/sufia/permissions/writable.rb +0 -74
  285. data/sufia-models/lib/tasks/batch_cleanup.rake +0 -19
  286. data/sufia-models/lib/tasks/migrate.rake +0 -21
  287. data/sufia-models/lib/tasks/resque.rake +0 -13
  288. data/sufia-models/lib/tasks/stats_tasks.rake +0 -12
  289. data/sufia-models/lib/tasks/sufia-models_tasks.rake +0 -80
  290. data/sufia-models/sufia-models.gemspec +0 -52
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Sufia::IdService do
4
- describe "mint" do
5
- subject { Sufia::IdService.mint }
6
-
7
- it { is_expected.not_to be_empty }
8
-
9
- it "should not mint the same id twice in a row" do
10
- expect(Sufia::IdService.mint).to_not eq subject
11
- end
12
-
13
- it "should be valid" do
14
- expect(Sufia::IdService.valid?(subject)).to be true
15
- end
16
-
17
- context "when the id already exists in Fedora" do
18
- let(:mock_id) { 'ef12ef12f' }
19
- let(:unique_id) { 'bb22bb22b' }
20
-
21
- before do
22
- allow(Sufia::IdService).to receive(:next_id).and_return(mock_id, unique_id)
23
- expect(ActiveFedora::Base).to receive(:exists?).with(mock_id).and_return(true)
24
- expect(ActiveFedora::Base).to receive(:exists?).with(unique_id).and_return(false)
25
- end
26
-
27
- it "should not assign that id again" do
28
- expect(subject).to eq unique_id
29
- end
30
- end
31
- end
32
- end
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Sufia::Noid do
4
- describe "#treeify" do
5
- subject { Sufia::Noid.treeify(id) }
6
- let(:id) { 'abc123def45' }
7
- it { is_expected.to eq 'ab/c1/23/de/abc123def45' }
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- # This file causes capybara to use the phantomjs browser, which is fully
2
- # compatible with ajax
3
- require 'capybara/poltergeist'
4
-
5
- # Register driver and tell it not to print javascript
6
- Capybara.register_driver :poltergeist do |app|
7
- Capybara::Poltergeist::Driver.new(app, js_errors: true, timeout: 90)
8
- end
9
-
10
- Capybara.default_driver = :poltergeist
11
- Capybara.javascript_driver = :poltergeist
@@ -1,20 +0,0 @@
1
- module RakeOutput
2
-
3
- # saves original $stdout in variable
4
- # set $stdout as local instance of StringIO
5
- # yields to code execution
6
- # returns the local instance of StringIO
7
- # resets $stdout to original value
8
- def capture_stdout
9
- out = StringIO.new
10
- $stdout = out
11
- yield
12
- return out.string
13
- ensure
14
- $stdout = STDOUT
15
- end
16
-
17
- RSpec.configure do |config|
18
- config.include RakeOutput
19
- end
20
- end
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in sufia-models.gemspec
4
- gemspec
@@ -1,177 +0,0 @@
1
-
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
@@ -1,39 +0,0 @@
1
- # Sufia::Models
2
-
3
- An ongoing project to extract Sufia models.
4
-
5
- ## Why
6
-
7
- Sufia is a Rails engine that is an opinionated -- in a good way -- self-deposit application built from [Project Hydra components](https://github.com/projecthydra) that is mostly "turn-key ready".
8
- And while the turn-key solution is greatly appreciated, there are use cases, namely ours, where its opinions don't quite work;
9
- Namely the views and controllers. We want a different work flow through our application and a notably different UI.
10
-
11
- Enter the **sufia-models** gem.
12
- The goal of **sufia-models** is to provide a common foundation for the Sufia engine as well as a common foundation for other engines -- [Curate](https://github.com/ndlib/curate).
13
-
14
- ## Installation
15
-
16
- Add this line to your application's Gemfile:
17
-
18
- gem 'sufia-models'
19
-
20
- And then execute:
21
-
22
- $ bundle
23
-
24
- Or install it yourself as:
25
-
26
- $ gem install sufia-models
27
-
28
- ## Usage
29
-
30
- This project is closely tied to [Sufia](https://github.com/projecthydra/sufia).
31
- Presently this gems tests are found in the sufia gem (I'm working on it).
32
-
33
- ## Contributing
34
-
35
- 1. Fork it
36
- 2. Create your feature branch (`git checkout -b my-new-feature`)
37
- 3. Commit your changes (`git commit -am 'Add some feature'`)
38
- 4. Push to the branch (`git push origin my-new-feature`)
39
- 5. Create new Pull Request
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,137 +0,0 @@
1
- module Sufia::GenericFile
2
- # Actions are decoupled from controller logic so that they may be called from a controller or a background job.
3
- class Actor
4
-
5
- attr_reader :generic_file, :user
6
-
7
- def initialize(generic_file, user)
8
- @generic_file = generic_file
9
- @user = user
10
- end
11
-
12
- # in order to avoid two saves in a row, create_metadata does not save the file by default.
13
- # it is typically used in conjunction with create_content, which does do a save.
14
- # If you want to save when using create_metadata, you can do this:
15
- # create_metadata(batch_id) { |gf| gf.save }
16
- def create_metadata(batch_id)
17
- generic_file.apply_depositor_metadata(user)
18
- time_in_utc = DateTime.now.new_offset(0)
19
- generic_file.date_uploaded = time_in_utc
20
- generic_file.date_modified = time_in_utc
21
- generic_file.creator = [user.name]
22
-
23
- if batch_id
24
- generic_file.batch_id = batch_id
25
- else
26
- ActiveFedora::Base.logger.warn "unable to find batch to attach to"
27
- end
28
- yield(generic_file) if block_given?
29
- end
30
-
31
- def create_content(file, file_name, path, mime_type)
32
- generic_file.add_file(file, path: path, original_name: file_name, mime_type: mime_type)
33
- generic_file.label ||= file_name
34
- generic_file.title = [generic_file.label] if generic_file.title.blank?
35
- save_characterize_and_record_committer do
36
- if Sufia.config.respond_to?(:after_create_content)
37
- Sufia.config.after_create_content.call(generic_file, user)
38
- end
39
- end
40
- end
41
-
42
- def revert_content(revision_id)
43
- generic_file.content.restore_version(revision_id)
44
- generic_file.content.create_version
45
- save_characterize_and_record_committer do
46
- if Sufia.config.respond_to?(:after_revert_content)
47
- Sufia.config.after_revert_content.call(generic_file, user, revision_id)
48
- end
49
- end
50
- end
51
-
52
- def update_content(file, path)
53
- generic_file.add_file(file, path: path, original_name: file.original_filename, mime_type: file.content_type)
54
- save_characterize_and_record_committer do
55
- if Sufia.config.respond_to?(:after_update_content)
56
- Sufia.config.after_update_content.call(generic_file, user)
57
- end
58
- end
59
- end
60
-
61
- def update_metadata(attributes, visibility)
62
- generic_file.attributes = attributes
63
- update_visibility(visibility)
64
- generic_file.date_modified = DateTime.now
65
- remove_from_feature_works if generic_file.visibility_changed? && !generic_file.public?
66
- save_and_record_committer do
67
- if Sufia.config.respond_to?(:after_update_metadata)
68
- Sufia.config.after_update_metadata.call(generic_file, user)
69
- end
70
- end
71
- end
72
-
73
- def destroy
74
- generic_file.destroy
75
- FeaturedWork.where(generic_file_id: generic_file.id).destroy_all
76
- if Sufia.config.respond_to?(:after_destroy)
77
- Sufia.config.after_destroy.call(generic_file.id, user)
78
- end
79
- end
80
-
81
- # Takes an optional block and executes the block if the save was successful.
82
- def save_characterize_and_record_committer
83
- save_and_record_committer { push_characterize_job }.tap do |val|
84
- yield if block_given? && val
85
- end
86
- end
87
-
88
- # Takes an optional block and executes the block if the save was successful.
89
- # returns false if the save was unsuccessful
90
- def save_and_record_committer
91
- save_tries = 0
92
- begin
93
- return false unless generic_file.save
94
- rescue RSolr::Error::Http => error
95
- ActiveFedora::Base.logger.warn "Sufia::GenericFile::Actor::save_and_record_committer Caught RSOLR error #{error.inspect}"
96
- save_tries+=1
97
- # fail for good if the tries is greater than 3
98
- raise error if save_tries >=3
99
- sleep 0.01
100
- retry
101
- end
102
- yield if block_given?
103
- generic_file.record_version_committer(user)
104
- true
105
- end
106
-
107
- def push_characterize_job
108
- Sufia.queue.push(CharacterizeJob.new(@generic_file.id))
109
- end
110
-
111
- class << self
112
- def virus_check(file)
113
- path = file.is_a?(String) ? file : file.path
114
- unless defined?(ClamAV)
115
- ActiveFedora::Base.logger.warn "Virus checking disabled, #{path} not checked"
116
- return
117
- end
118
- scan_result = ClamAV.instance.scanfile(path)
119
- raise Sufia::VirusFoundError.new("A virus was found in #{path}: #{scan_result}") unless scan_result == 0
120
- end
121
- end
122
-
123
- protected
124
-
125
- # This method can be overridden in case there is a custom approach for visibility (e.g. embargo)
126
- def update_visibility(visibility)
127
- generic_file.visibility = visibility
128
- end
129
-
130
- private
131
-
132
- def remove_from_feature_works
133
- featured_work = FeaturedWork.find_by_generic_file_id(generic_file.id)
134
- featured_work.destroy unless featured_work.nil?
135
- end
136
- end
137
- end