bulkrax 1.0.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 (133) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +205 -0
  3. data/README.md +202 -0
  4. data/Rakefile +42 -0
  5. data/app/assets/config/bulkrax_manifest.js +2 -0
  6. data/app/assets/javascripts/bulkrax/application.js +14 -0
  7. data/app/assets/javascripts/bulkrax/bulkrax.js +11 -0
  8. data/app/assets/javascripts/bulkrax/entries.js +15 -0
  9. data/app/assets/javascripts/bulkrax/exporters.js +60 -0
  10. data/app/assets/javascripts/bulkrax/importers.js.erb +166 -0
  11. data/app/assets/stylesheets/bulkrax/accordion.scss +40 -0
  12. data/app/assets/stylesheets/bulkrax/application.css +15 -0
  13. data/app/assets/stylesheets/bulkrax/coderay.scss +264 -0
  14. data/app/assets/stylesheets/bulkrax/import_export.scss +37 -0
  15. data/app/controllers/bulkrax/application_controller.rb +8 -0
  16. data/app/controllers/bulkrax/entries_controller.rb +44 -0
  17. data/app/controllers/bulkrax/exporters_controller.rb +125 -0
  18. data/app/controllers/bulkrax/importers_controller.rb +315 -0
  19. data/app/controllers/concerns/bulkrax/api.rb +29 -0
  20. data/app/factories/bulkrax/object_factory.rb +230 -0
  21. data/app/helpers/bulkrax/application_helper.rb +15 -0
  22. data/app/helpers/bulkrax/exporters_helper.rb +6 -0
  23. data/app/helpers/bulkrax/importers_helper.rb +13 -0
  24. data/app/helpers/bulkrax/validation_helper.rb +153 -0
  25. data/app/jobs/bulkrax/application_job.rb +6 -0
  26. data/app/jobs/bulkrax/child_relationships_job.rb +128 -0
  27. data/app/jobs/bulkrax/delete_work_job.rb +16 -0
  28. data/app/jobs/bulkrax/download_cloud_file_job.rb +18 -0
  29. data/app/jobs/bulkrax/export_work_job.rb +37 -0
  30. data/app/jobs/bulkrax/exporter_job.rb +14 -0
  31. data/app/jobs/bulkrax/import_work_collection_job.rb +41 -0
  32. data/app/jobs/bulkrax/import_work_job.rb +32 -0
  33. data/app/jobs/bulkrax/importer_job.rb +26 -0
  34. data/app/mailers/bulkrax/application_mailer.rb +8 -0
  35. data/app/matchers/bulkrax/application_matcher.rb +113 -0
  36. data/app/matchers/bulkrax/bagit_matcher.rb +6 -0
  37. data/app/matchers/bulkrax/csv_matcher.rb +6 -0
  38. data/app/matchers/bulkrax/oai_matcher.rb +6 -0
  39. data/app/models/bulkrax/application_record.rb +7 -0
  40. data/app/models/bulkrax/csv_collection_entry.rb +19 -0
  41. data/app/models/bulkrax/csv_entry.rb +163 -0
  42. data/app/models/bulkrax/entry.rb +104 -0
  43. data/app/models/bulkrax/exporter.rb +122 -0
  44. data/app/models/bulkrax/exporter_run.rb +7 -0
  45. data/app/models/bulkrax/import_failed.rb +13 -0
  46. data/app/models/bulkrax/importer.rb +155 -0
  47. data/app/models/bulkrax/importer_run.rb +8 -0
  48. data/app/models/bulkrax/oai_dc_entry.rb +6 -0
  49. data/app/models/bulkrax/oai_entry.rb +74 -0
  50. data/app/models/bulkrax/oai_qualified_dc_entry.rb +6 -0
  51. data/app/models/bulkrax/oai_set_entry.rb +19 -0
  52. data/app/models/bulkrax/rdf_collection_entry.rb +19 -0
  53. data/app/models/bulkrax/rdf_entry.rb +90 -0
  54. data/app/models/bulkrax/status.rb +25 -0
  55. data/app/models/bulkrax/xml_entry.rb +73 -0
  56. data/app/models/concerns/bulkrax/download_behavior.rb +61 -0
  57. data/app/models/concerns/bulkrax/errored_entries.rb +45 -0
  58. data/app/models/concerns/bulkrax/export_behavior.rb +58 -0
  59. data/app/models/concerns/bulkrax/file_factory.rb +140 -0
  60. data/app/models/concerns/bulkrax/has_local_processing.rb +7 -0
  61. data/app/models/concerns/bulkrax/has_matchers.rb +155 -0
  62. data/app/models/concerns/bulkrax/import_behavior.rb +90 -0
  63. data/app/models/concerns/bulkrax/importer_exporter_behavior.rb +34 -0
  64. data/app/models/concerns/bulkrax/status_info.rb +56 -0
  65. data/app/parsers/bulkrax/application_parser.rb +299 -0
  66. data/app/parsers/bulkrax/bagit_parser.rb +157 -0
  67. data/app/parsers/bulkrax/csv_parser.rb +266 -0
  68. data/app/parsers/bulkrax/oai_dc_parser.rb +130 -0
  69. data/app/parsers/bulkrax/oai_qualified_dc_parser.rb +9 -0
  70. data/app/parsers/bulkrax/xml_parser.rb +103 -0
  71. data/app/views/bulkrax/entries/_parsed_metadata.html.erb +19 -0
  72. data/app/views/bulkrax/entries/_raw_metadata.html.erb +19 -0
  73. data/app/views/bulkrax/entries/show.html.erb +63 -0
  74. data/app/views/bulkrax/exporters/_form.html.erb +120 -0
  75. data/app/views/bulkrax/exporters/edit.html.erb +23 -0
  76. data/app/views/bulkrax/exporters/index.html.erb +67 -0
  77. data/app/views/bulkrax/exporters/new.html.erb +23 -0
  78. data/app/views/bulkrax/exporters/show.html.erb +124 -0
  79. data/app/views/bulkrax/importers/_bagit_fields.html.erb +54 -0
  80. data/app/views/bulkrax/importers/_browse_everything.html.erb +12 -0
  81. data/app/views/bulkrax/importers/_csv_fields.html.erb +39 -0
  82. data/app/views/bulkrax/importers/_edit_form_buttons.html.erb +16 -0
  83. data/app/views/bulkrax/importers/_form.html.erb +35 -0
  84. data/app/views/bulkrax/importers/_oai_fields.html.erb +42 -0
  85. data/app/views/bulkrax/importers/_xml_fields.html.erb +60 -0
  86. data/app/views/bulkrax/importers/edit.html.erb +20 -0
  87. data/app/views/bulkrax/importers/index.html.erb +77 -0
  88. data/app/views/bulkrax/importers/new.html.erb +25 -0
  89. data/app/views/bulkrax/importers/show.html.erb +175 -0
  90. data/app/views/bulkrax/importers/upload_corrected_entries.html.erb +37 -0
  91. data/app/views/bulkrax/shared/_bulkrax_errors.html.erb +52 -0
  92. data/app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb +39 -0
  93. data/app/views/hyrax/dashboard/sidebar/_bulkrax_sidebar_additions.html.erb +6 -0
  94. data/app/views/hyrax/dashboard/sidebar/_repository_content.html.erb +19 -0
  95. data/app/views/layouts/bulkrax/application.html.erb +14 -0
  96. data/config/locales/bulkrax.en.yml +36 -0
  97. data/config/routes.rb +18 -0
  98. data/db/migrate/20181011230201_create_bulkrax_importers.rb +18 -0
  99. data/db/migrate/20181011230228_create_bulkrax_importer_runs.rb +16 -0
  100. data/db/migrate/20190325183136_create_bulkrax_entries.rb +16 -0
  101. data/db/migrate/20190601221109_add_status_to_entry.rb +9 -0
  102. data/db/migrate/20190715161939_add_collections_to_importer_runs.rb +6 -0
  103. data/db/migrate/20190715162044_change_collection_ids_on_entries.rb +5 -0
  104. data/db/migrate/20190729124607_create_bulkrax_exporters.rb +19 -0
  105. data/db/migrate/20190729134158_create_bulkrax_exporter_runs.rb +14 -0
  106. data/db/migrate/20190731114016_change_importer_and_exporter_to_polymorphic.rb +12 -0
  107. data/db/migrate/20191203225129_add_total_collection_records_to_importer_runs.rb +5 -0
  108. data/db/migrate/20191204191623_add_children_to_importer_runs.rb +6 -0
  109. data/db/migrate/20191204223857_change_total_records_to_total_work_entries.rb +6 -0
  110. data/db/migrate/20191212155530_change_entry_last_error.rb +19 -0
  111. data/db/migrate/20200108194557_add_validate_only_to_bulkrax_importers.rb +5 -0
  112. data/db/migrate/20200301232856_add_status_to_importers.rb +9 -0
  113. data/db/migrate/20200312190638_remove_foreign_key_from_bulkrax_entries.rb +5 -0
  114. data/db/migrate/20200326235838_add_status_to_exporters.rb +7 -0
  115. data/db/migrate/20200601204556_add_invalid_record_to_importer_run.rb +5 -0
  116. data/db/migrate/20200818055819_create_bulkrax_statuses.rb +18 -0
  117. data/db/migrate/20200819054016_move_to_statuses.rb +30 -0
  118. data/db/migrate/20201106014204_add_date_filter_and_status_to_bulkrax_exporters.rb +7 -0
  119. data/db/migrate/20201117220007_add_workflow_status_to_bulkrax_exporter.rb +5 -0
  120. data/db/migrate/20210806044408_remove_unused_last_error.rb +7 -0
  121. data/db/migrate/20210806065737_increase_text_sizes.rb +12 -0
  122. data/lib/bulkrax.rb +161 -0
  123. data/lib/bulkrax/engine.rb +37 -0
  124. data/lib/bulkrax/version.rb +5 -0
  125. data/lib/generators/bulkrax/install_generator.rb +80 -0
  126. data/lib/generators/bulkrax/templates/README +3 -0
  127. data/lib/generators/bulkrax/templates/app/assets/images/bulkrax/removed.png +0 -0
  128. data/lib/generators/bulkrax/templates/app/models/concerns/bulkrax/has_local_processing.rb +8 -0
  129. data/lib/generators/bulkrax/templates/bin/importer +140 -0
  130. data/lib/generators/bulkrax/templates/config/bulkrax_api.yml +84 -0
  131. data/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb +72 -0
  132. data/lib/tasks/bulkrax_tasks.rake +6 -0
  133. metadata +388 -0
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'oai'
4
+
5
+ module Bulkrax
6
+ class Engine < ::Rails::Engine
7
+ isolate_namespace Bulkrax
8
+ initializer :append_migrations do |app|
9
+ if !app.root.to_s.match(root.to_s) && app.root.join('db/migrate').children.none? { |path| path.fnmatch?("*.bulkrax.rb") }
10
+ config.paths["db/migrate"].expanded.each do |expanded_path|
11
+ app.config.paths["db/migrate"] << expanded_path
12
+ end
13
+ end
14
+ end
15
+
16
+ config.generators do |g|
17
+ g.test_framework :rspec
18
+ begin
19
+ g.fixture_replacement :factory_bot, dir: 'spec/factories'
20
+ rescue
21
+ nil
22
+ end
23
+ end
24
+
25
+ config.after_initialize do
26
+ my_engine_root = Bulkrax::Engine.root.to_s
27
+ paths = ActionController::Base.view_paths.collect(&:to_s)
28
+ hyrax_path = paths.detect { |path| path.match('/hyrax-') }
29
+ paths = if hyrax_path
30
+ paths.insert(paths.index(hyrax_path), my_engine_root + '/app/views')
31
+ else
32
+ paths.insert(0, my_engine_root + '/app/views')
33
+ end
34
+ ActionController::Base.view_paths = paths
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulkrax
4
+ VERSION = '1.0.0'
5
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Bulkrax::InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ desc 'This generator installs Bulkrax.'
7
+
8
+ def banner
9
+ say_status("info", "Generating Bulkrax installation", :blue)
10
+ end
11
+
12
+ def add_to_gemfile
13
+ gem 'willow_sword', github: 'notch8/willow_sword'
14
+
15
+ Bundler.with_clean_env do
16
+ run "bundle install"
17
+ end
18
+ end
19
+
20
+ def mount_route
21
+ route "mount Bulkrax::Engine, at: '/'"
22
+ end
23
+
24
+ def create_config
25
+ copy_file 'config/initializers/bulkrax.rb', 'config/initializers/bulkrax.rb'
26
+
27
+ hyrax = "\n# set bulkrax default work type to first curation_concern if it isn't already set\nif Bulkrax.default_work_type.blank?\n Bulkrax.default_work_type = Hyrax.config.curation_concerns.first.to_s\nend\n"
28
+
29
+ return if File.read('config/initializers/hyrax.rb').include?(hyrax)
30
+ append_to_file 'config/initializers/hyrax.rb' do
31
+ hyrax
32
+ end
33
+ end
34
+
35
+ def create_bulkrax_api
36
+ copy_file 'config/bulkrax_api.yml', 'config/bulkrax_api.yml'
37
+ end
38
+
39
+ def create_cmd_script
40
+ copy_file 'bin/importer', 'bin/importer'
41
+ end
42
+
43
+ def create_local_processing
44
+ copy_file 'app/models/concerns/bulkrax/has_local_processing.rb', 'app/models/concerns/bulkrax/has_local_processing.rb'
45
+ end
46
+
47
+ def add_javascripts
48
+ file = 'app/assets/javascripts/application.js'
49
+ file_text = File.read(file)
50
+ js = '//= require bulkrax/application'
51
+
52
+ return if file_text.include?(js)
53
+ insert_into_file file, before: /\/\/= require_tree ./ do
54
+ "#{js}\n"
55
+ end
56
+ end
57
+
58
+ def add_css
59
+ ['css', 'scss', 'sass'].map do |ext|
60
+ file = "app/assets/stylesheets/application.#{ext}"
61
+ next unless File.exist?(file)
62
+
63
+ file_text = File.read(file)
64
+ css = "*= require 'bulkrax/application'"
65
+ next if file_text.include?(css)
66
+
67
+ insert_into_file file, before: /\s\*= require_self/ do
68
+ "\s#{css}\n"
69
+ end
70
+ end
71
+ end
72
+
73
+ def display_readme
74
+ readme 'README'
75
+ end
76
+
77
+ def add_removed_image
78
+ copy_file 'app/assets/images/bulkrax/removed.png', 'app/assets/images/bulkrax/removed.png'
79
+ end
80
+ end
@@ -0,0 +1,3 @@
1
+ Please ensure you have queues for import and export setup.
2
+
3
+ For example, if using Sidekiq add the queues in config/sidekiq.yml
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bulkrax::HasLocalProcessing
4
+ # This method is called during build_metadata
5
+ # add any special processing here, for example to reset a metadata property
6
+ # to add a custom property from outside of the import data
7
+ def add_local; end
8
+ end
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../config/environment'
5
+
6
+ require 'slop'
7
+
8
+ def main(opts = {})
9
+ if opts[:importer_id].blank? && invalid?(opts)
10
+ puts 'Missing required parameters'
11
+ help
12
+ end
13
+
14
+ if opts[:auth_token].blank?
15
+ puts 'Missing Authentication Token --auth_token'
16
+ exit
17
+ end
18
+
19
+ update = opts[:importer_id].present?
20
+ url = build_url(opts.delete(:importer_id), opts.delete(:url))
21
+
22
+ headers = { 'Content-Type' => 'application/json' }
23
+ headers['Authorization'] = "Token: #{opts.delete(:auth_token)}"
24
+ params = build_params(opts)
25
+
26
+ logger.info("POST to #{url} - PARAMS #{params}")
27
+
28
+ conn = Faraday.new(
29
+ url: url,
30
+ headers: headers
31
+ )
32
+
33
+ response = if update
34
+ conn.put do |request|
35
+ request.body = params.to_json
36
+ end
37
+ else
38
+ conn.post do |request|
39
+ request.body = params.to_json
40
+ end
41
+ end
42
+
43
+ puts "#{response.status} - #{response.body.truncate(200)}"
44
+ end
45
+
46
+ def invalid?(opts)
47
+ required_params.each do |p|
48
+ return true if opts[p.to_sym].blank?
49
+ end
50
+ return false
51
+ end
52
+
53
+ def required_params
54
+ Bulkrax.api_definition['bulkrax']['importer'].map { |key, value| key if value['required'] == true }.compact
55
+ end
56
+
57
+ def build_params(opts = {})
58
+ params = {}
59
+ params[:commit] = opts.delete(:commit)
60
+ parser_fields = {
61
+ metadata_file_name: opts.delete(:metadata_file_name),
62
+ metadata_format: opts.delete(:metadata_format),
63
+ rights_statement: opts.delete(:rights_statement),
64
+ override_rights_statement: opts.delete(:override_rights_statement),
65
+ import_file_path: opts.delete(:import_file_path),
66
+ metadata_prefix: opts.delete(:metadata_prefix),
67
+ set: opts.delete(:set),
68
+ collection_name: opts.delete(:collection_name)
69
+ }.compact
70
+ params[:importer] = opts.compact
71
+ params[:importer][:user_id] = opts.delete(:user_id)
72
+ params[:importer][:admin_set_id] = opts.delete(:admin_set_id)
73
+ params[:importer][:parser_fields] = parser_fields || {}
74
+ return params.compact
75
+ end
76
+
77
+ def build_url(importer_id, url)
78
+ if url.nil?
79
+ protocol = Rails.application.config.force_ssl ? 'https://' : 'http://'
80
+ host = Rails.application.config.action_mailer.default_url_options[:host]
81
+ url = "#{protocol}#{host}"
82
+ end
83
+ path = Bulkrax::Engine.routes.url_helpers.polymorphic_path(Bulkrax::Importer)
84
+ url = File.join(url, path)
85
+ url = File.join(url, importer_id) if importer_id
86
+ return url
87
+ end
88
+
89
+ def logger
90
+ Rails.logger
91
+ end
92
+
93
+ def version
94
+ puts "Bulkrax #{Bulkrax::VERSION}"
95
+ puts "Slop #{Slop::VERSION}"
96
+ end
97
+
98
+ # Format the help for the CLI
99
+ def help
100
+ puts 'CREATE:'
101
+ puts ' bin/importer --name "My Import" --parser_klass Bulkrax::CsvParser --commit "Create and Import" --import_file_path /data/tmp/import.csv --auth_token 12345'
102
+ puts 'UPDATE:'
103
+ puts ' bin/importer --importer_id 1 --commit "Update and Re-Import (update metadata only)" --import_file_path /data/tmp/import.csv --auth_token 12345'
104
+ puts 'PARAMETERS:'
105
+ Bulkrax.api_definition['bulkrax']['importer'].each_pair do |key, value|
106
+ next if key == 'parser_fields'
107
+ puts " --#{key}"
108
+ value.each_pair do |k, v|
109
+ next if k == 'contained_in'
110
+ puts " #{k}: #{v}"
111
+ end
112
+ end
113
+ puts ' --url'
114
+ puts " Repository URL"
115
+ exit
116
+ end
117
+
118
+ # Setup the options
119
+ options = Slop.parse do |o|
120
+ o.on '--version', 'Print the version' do
121
+ version
122
+ exit
123
+ end
124
+
125
+ o.on '--help', 'Print help' do
126
+ help
127
+ exit
128
+ end
129
+
130
+ Bulkrax.api_definition['bulkrax']['importer'].each_pair do |key, value|
131
+ if value['required'].blank?
132
+ o.string "--#{key}", value['definition'], default: nil
133
+ else
134
+ o.string "--#{key}", value['definition']
135
+ end
136
+ end
137
+ o.string '--url', 'Repository URL'
138
+ end
139
+
140
+ main(options.to_hash)
@@ -0,0 +1,84 @@
1
+ bulkrax:
2
+ importer:
3
+ importer_id:
4
+ definition: 'The ID of the Importer. Used for Update only. CLI only.'
5
+ name:
6
+ definition: 'Name for the Importer'
7
+ required: true
8
+ admin_set_id:
9
+ definition: 'AdminSet ID. If not supplied the default AdminSet is used.'
10
+ parser_fields:
11
+ definition: 'Contains additional information which varies depending on the parser. Some is required.'
12
+ type: container
13
+ rights_statement:
14
+ definition: 'Supply a URI from the application rights statements'
15
+ valid_values: <%= Hyrax.config.rights_statement_service_class.new.select_active_options.map(&:last) %>
16
+ contained_in: parser_fields
17
+ override_rights_statement:
18
+ definition: 'Override any existing rights statements: 1 for yes | 0 for no'
19
+ valid_values:
20
+ - 0
21
+ - 1
22
+ contained_in: parser_fields
23
+ import_file_path:
24
+ definition: 'Path to the import file - required for CSV and BagIt only'
25
+ required:
26
+ - 'Bulkrax::BagitParser'
27
+ - 'Bulkrax::CsvParser'
28
+ contained_in: parser_fields
29
+ selected_files:
30
+ definition: 'Used by browse everything to retrieve files from cloud URLs'
31
+ metadata_file_name:
32
+ definition: 'Filename used for metadata files - required for BagIt only'
33
+ required:
34
+ - 'Bulkrax::BagitParser'
35
+ contained_in: parser_fields
36
+ metadata_format:
37
+ definition: 'RDF or CSV - required for BagIt only'
38
+ required:
39
+ - 'Bulkrax::BagitParser'
40
+ valid_values:
41
+ - 'Bulkrax::RdfEntry'
42
+ - 'Bulkrax::CsvEntry'
43
+ contained_in: parser_fields
44
+ set:
45
+ definition: 'The OAI setSpec - required for OAI only'
46
+ required:
47
+ - 'Bulkrax::OaiParser'
48
+ contained_in: parser_fields
49
+ collection_name:
50
+ definition: 'The OAI setName - required for required for OAI only'
51
+ required:
52
+ - 'Bulkrax::OaiParser'
53
+ contained_in: parser_fields
54
+ parser_klass:
55
+ definition: 'Parser name eg. Bulkrax::CsvParser'
56
+ required: true
57
+ valid_values: <%= Bulkrax.parsers.map {|p|p[:class_name]} %>
58
+ limit:
59
+ definition: 'Number of records to import; blank for all'
60
+ frequency:
61
+ definition: ISO 8601 Durations <%= Bulkrax::Importer.frequency_enums.map(&:first).join('; ') %>
62
+ valid_values: <%= Bulkrax::Importer.frequency_enums.map(&:last) %>
63
+ field_mapping:
64
+ definition: 'See bulkrax/lib/bulkrax.rb for further information'
65
+ user_id:
66
+ definition: 'ID of the User creating the Importer. If not supplied, the batch_user will be used.'
67
+ base_url:
68
+ definition: 'Base URL for the Endpoint - required for OAI Only'
69
+ required:
70
+ - 'Bulkrax::OaiParser'
71
+ commit:
72
+ definition: 'Commit Message, Bulkrax uses commit messages to decide what action to take.'
73
+ required: true
74
+ valid_values:
75
+ - "Create"
76
+ - "Create and Import"
77
+ - "Update Importer"
78
+ - "Update and Re-Import (update metadata and replace files)"
79
+ - "Update and Harvest Updated Items', 'Update and Re-Harvest All Items"
80
+ - "Update and Re-Import (update metadata only)"
81
+ - "Update and Import (importer has not yet been run)"
82
+ auth_token:
83
+ definition: 'Authentication token. Required for JSON requests only.'
84
+ required: true
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ Bulkrax.setup do |config|
4
+ # Add local parsers
5
+ # config.parsers += [
6
+ # { name: 'MODS - My Local MODS parser', class_name: 'Bulkrax::ModsXmlParser', partial: 'mods_fields' },
7
+ # ]
8
+
9
+ # WorkType to use as the default if none is specified in the import
10
+ # Default is the first returned by Hyrax.config.curation_concerns
11
+ # config.default_work_type = MyWork
12
+
13
+ # Path to store pending imports
14
+ # config.import_path = 'tmp/imports'
15
+
16
+ # Path to store exports before download
17
+ # config.export_path = 'tmp/exports'
18
+
19
+ # Server name for oai request header
20
+ # config.server_name = 'my_server@name.com'
21
+
22
+ # Field_mapping for establishing a parent-child relationship (FROM parent TO child)
23
+ # This can be a Collection to Work, or Work to Work relationship
24
+ # This value IS NOT used for OAI, so setting the OAI Entries here will have no effect
25
+ # The mapping is supplied per Entry, provide the full class name as a string, eg. 'Bulkrax::CsvEntry'
26
+ # Example:
27
+ # {
28
+ # 'Bulkrax::RdfEntry' => 'http://opaquenamespace.org/ns/contents',
29
+ # 'Bulkrax::CsvEntry' => 'children'
30
+ # }
31
+ # By default no parent-child relationships are added
32
+ # config.parent_child_field_mapping = { }
33
+
34
+ # Field_mapping for establishing a collection relationship (FROM work TO collection)
35
+ # This value IS NOT used for OAI, so setting the OAI parser here will have no effect
36
+ # The mapping is supplied per Entry, provide the full class name as a string, eg. 'Bulkrax::CsvEntry'
37
+ # The default value for CSV is collection
38
+ # Add/replace parsers, for example:
39
+ # config.collection_field_mapping['Bulkrax::RdfEntry'] = 'http://opaquenamespace.org/ns/set'
40
+
41
+ # Field mappings
42
+ # Create a completely new set of mappings by replacing the whole set as follows
43
+ # config.field_mappings = {
44
+ # "Bulkrax::OaiDcParser" => { **individual field mappings go here*** }
45
+ # }
46
+
47
+ # Add to, or change existing mappings as follows
48
+ # e.g. to exclude date
49
+ # config.field_mappings["Bulkrax::OaiDcParser"]["date"] = { from: ["date"], excluded: true }
50
+ #
51
+ # # e.g. to add the required source_identifier field
52
+ # # config.field_mappings["Bulkrax::CsvParser"]["source_id"] = { from: ["old_source_id"], source_identifier: true }
53
+ # If you want Bulkrax to fill in source_identifiers for you, see below
54
+
55
+ # To duplicate a set of mappings from one parser to another
56
+ # config.field_mappings["Bulkrax::OaiOmekaParser"] = {}
57
+ # config.field_mappings["Bulkrax::OaiDcParser"].each {|key,value| config.field_mappings["Bulkrax::OaiOmekaParser"][key] = value }
58
+
59
+ # Should Bulkrax make up source identifiers for you? This allow round tripping
60
+ # and download errored entries to still work, but does mean if you upload the
61
+ # same source record in two different files you WILL get duplicates.
62
+ # It is given two aruguments, self at the time of call and the index of the reocrd
63
+ # config.fill_in_blank_source_identifiers = ->(parser, index) { "b-#{parser.importer.id}-#{index}"}
64
+ # or use a uuid
65
+ # config.fill_in_blank_source_identifiers = ->(parser, index) { SecureRandom.uuid }
66
+
67
+ # Properties that should not be used in imports/exports. They are reserved for use by Hyrax.
68
+ # config.reserved_properties += ['my_field']
69
+ end
70
+
71
+ # Sidebar for hyrax 3+ support
72
+ Hyrax::DashboardController.sidebar_partials[:repository_content] << "hyrax/dashboard/sidebar/bulkrax_sidebar_additions" if Object.const_defined?(:Hyrax) && ::Hyrax::DashboardController&.respond_to?(:sidebar_partials)
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ # desc "Explaining what the task does"
4
+ # task :bulkrax do
5
+ # # Task goes here
6
+ # end