Skip to content

Commit

Permalink
Merge branch 'main' into hyrax-4-valkyrie-support
Browse files Browse the repository at this point in the history
* main: (24 commits)
  Retry and delete take 2 (#894)
  🎁 Add `Bulkrax.persistence_adapter` (#895)
  πŸ’Έ Mint v6.0.1 (#892)
  πŸ› Fix #work_identifier_search_field logic (#891)
  πŸ’Έ Bump to v6.0.0 (#889)
  make search string used to look up objects configurable (#884)
  πŸ’Έ v5.5.0 (#888)
  unpin dry-monads. its not a dependency of bulkrax (#885)
  fix syntax error in ERB (#883)
  add support for Rails 6, Hyrax 4, and Blacklight 7 (#782)
  Reduce SQL calls when incrementing/decrementing run counters (#881)
  Update readme to remove references to samvera-labs (#880)
  add Compatibility section to readme (#879)
  πŸ› Fix tabs for Hydra application (#875)
  Nav-tabs event scoping (#874)
  πŸ“š Update docs in preparation for best practices seminar (#873)
  use the `GlobalID` library tooling to determine global id (#869)
  Avoid NoMethodError in Bulkrax::Importers::Controller#create. (#870)
  preparing to deploy v5.4.1 (#868)
  5.4.0-bug-fixes (#865)
  ...
  • Loading branch information
jeremyf committed Jan 24, 2024
2 parents c2ee9bc + 3ae6402 commit 2f65930
Show file tree
Hide file tree
Showing 72 changed files with 773 additions and 453 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
uses: actions/[email protected]
with:
path: vendor/bundle
key: 2.6.5
key: 2.7.2

- name: Setup Ruby
uses: ruby/setup-ruby@v1.59.1
uses: ruby/setup-ruby@v1.159.0
with:
ruby-version: 2.6.5
ruby-version: 2.7.2

- name: Install dependencies
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['2.6', '2.7'] # TODO add 3.0 compat , '3.0']
ruby: ['2.7', '3.0']
name: Run specs with ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v2
Expand All @@ -24,7 +24,7 @@ jobs:
key: ${{ matrix.ruby }}

- name: Setup Ruby
uses: ruby/setup-ruby@v1.59.1
uses: ruby/setup-ruby@v1.159.0
with:
ruby-version: ${{ matrix.ruby }}

Expand All @@ -37,10 +37,10 @@ jobs:
bundle install
- name: Migrate test database
run: bin/rails db:migrate RAILS_ENV=test
run: bundle exec rake db:migrate db:test:prepare

- name: Run rspec
run: bin/rspec
run: bundle exec rake

- name: Upload coverage results
uses: actions/upload-artifact@v2
Expand Down
4 changes: 3 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Bixby coding conventions
require: rubocop-factory_bot

# Added AllCops config for further modification
AllCops:
TargetRubyVersion: 2.6
TargetRubyVersion: 2.7
DisabledByDefault: true
DisplayCopNames: true
Exclude:
Expand Down
98 changes: 8 additions & 90 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,73 +6,13 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
Layout/EmptyLineBetweenDefs:
Exclude:
- 'app/jobs/bulkrax/import_file_set_job.rb'
- 'app/models/bulkrax/entry.rb'

# Offense count: 2
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'spec/rails_helper.rb'

# Offense count: 3
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/HashAlignment:
Exclude:
- 'app/parsers/bulkrax/csv_parser.rb'
- 'spec/models/bulkrax/rdf_entry_spec.rb'
- 'spec/models/bulkrax/xml_entry_spec.rb'

# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
Layout/IndentationWidth:
Exclude:
- 'spec/rails_helper.rb'

# Offense count: 8
# Offense count: 5
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 301

# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: symmetrical, new_line, same_line
Layout/MultilineMethodCallBraceLayout:
Exclude:
- 'app/parsers/bulkrax/csv_parser.rb'

# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
Layout/RescueEnsureAlignment:
Exclude:
- 'spec/rails_helper.rb'

# Offense count: 7
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'app/models/bulkrax/csv_entry.rb'
- 'app/parsers/bulkrax/csv_parser.rb'
- 'spec/models/bulkrax/rdf_entry_spec.rb'
- 'spec/models/bulkrax/xml_entry_spec.rb'
- 'spec/rails_helper.rb'

# Offense count: 16
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Expand All @@ -81,24 +21,24 @@ Metrics/AbcSize:
# Offense count: 4
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 201
Max: 140

# Offense count: 13
# Offense count: 12
# Configuration parameters: IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 19

# Offense count: 32
# Offense count: 28
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
Metrics/MethodLength:
Max: 26

# Offense count: 2
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 131
Max: 130

# Offense count: 9
# Offense count: 10
# Configuration parameters: IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 19
Expand All @@ -110,30 +50,8 @@ Rails/HasManyOrHasOneDependent:
Exclude:
- 'app/models/concerns/bulkrax/status_info.rb'

# Offense count: 2
# This cop supports safe auto-correction (--auto-correct).
# Configuration parameters: Keywords, RequireColon.
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE
Style/CommentAnnotation:
Exclude:
- 'app/models/bulkrax/xml_entry.rb'
- 'spec/models/bulkrax/oai_entry_spec.rb'

# Offense count: 2
# This cop supports safe auto-correction (--auto-correct).
Style/IfUnlessModifier:
Exclude:
- 'app/models/bulkrax/csv_entry.rb'
- 'lib/generators/bulkrax/templates/config/initializers/bulkrax.rb'

# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
Style/MultilineIfModifier:
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
Style/GuardClause:
Exclude:
- 'app/models/bulkrax/csv_entry.rb'

# Offense count: 1
# This cop supports safe auto-correction (--auto-correct).
Style/RedundantBegin:
Exclude:
- 'spec/rails_helper.rb'
6 changes: 4 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ gemspec
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.

gem 'blacklight', '~> 6.25.0'
gem 'blacklight'
gem 'bootstrap-sass', '~> 3.4.1'
gem 'coderay'
gem 'factory_bot_rails'
gem 'hyrax', '>= 2.3'
gem 'hyrax', '>= 2.3', '< 4.999'
gem 'oai'
gem 'rsolr', '>= 1.0'
gem 'rspec-rails'
Expand All @@ -29,8 +29,10 @@ group :development, :test do
gem 'pry-byebug'
gem 'solargraph'
gem 'solr_wrapper', '>= 0.3'
gem 'sqlite3', '~> 1.4'
end

group :lint do
gem 'bixby'
gem 'rubocop-factory_bot', require: false
end
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![Test Suite](https://github.com/samvera/bulkrax/actions/workflows/test.yml/badge.svg)
![Test Suite](https://github.com/samvera/bulkrax/actions/workflows/lint.yml/badge.svg)
# Bulkrax
Bulkrax is a batteries included importer for Samvera applications. It currently includes support for OAI-PMH (DC and Qualified DC) and CSV out of the box. It is also designed to be extensible, allowing you to easily add new importers in to your application or to include them with other gems. Bulkrax provides a full admin interface including creating, editing, scheduling and reviewing imports.

Expand All @@ -10,7 +12,7 @@ Add this line to your application's Gemfile:
```ruby
gem 'bulkrax'
# or if using from github
gem 'bulkrax', git: 'https://github.com/samvera-labs/bulkrax.git', branch: 'main'
gem 'bulkrax', git: 'https://github.com/samvera/bulkrax.git', branch: 'main'
```

And then execute:
Expand Down Expand Up @@ -72,7 +74,7 @@ Bulkrax.setup do |config|
end
```

The [configuration guide](https://github.com/samvera-labs/bulkrax/wiki/Configuring-Bulkrax) provides detailed instructions on the various available configurations.
The [configuration guide](https://github.com/samvera/bulkrax/wiki/Configuring-Bulkrax) provides detailed instructions on the various available configurations.

Example:

Expand Down Expand Up @@ -122,7 +124,7 @@ It's unlikely that the incoming import data has fields that exactly match those

By default, a mapping for the OAI parser has been added to map standard oai_dc fields to Hyrax basic_metadata. The other parsers have no default mapping, and will map any incoming fields to Hyrax properties with the same name. Configurations can be added in `config/initializers/bulkrax.rb`

Configuring field mappings is documented in the [Bulkrax Configuration Guide](https://github.com/samvera-labs/bulkrax/wiki/Configuring-Bulkrax).
Configuring field mappings is documented in the [Bulkrax Configuration Guide](https://github.com/samvera/bulkrax/wiki/Configuring-Bulkrax).

## Importing Files

Expand Down Expand Up @@ -153,7 +155,7 @@ end

## Customizing Bulkrax

For further information on how to extend and customize Bulkrax, please see the [Bulkrax Customization Guide](https://github.com/samvera-labs/bulkrax/wiki/Customizing-Bulkrax).
For further information on how to extend and customize Bulkrax, please see the [Bulkrax Customization Guide](https://github.com/samvera/bulkrax/wiki/Customizing-Bulkrax).

## How it Works
Once you have Bulkrax installed, you will have access to an easy to use interface with which you are able to create, edit, delete, run, and re-run imports and exports.
Expand All @@ -180,16 +182,21 @@ To delete an importer or exporter, select the delete (x) icon.
### Downloading an export
Once your the exporter has run, a download icon will appear on the exporters menu page.

## Compatibility

* Ruby 2.7 or newer is required
* Hyrax 2.3 or newer is required

## Contributing
If you're working on a PR for this project, create a feature branch off of `main`.

This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct) and [language recommendations](https://github.com/samvera/maintenance/blob/master/templates/CONTRIBUTING.md#language). Please ***do not*** create a branch called `master` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.

See
[CONTRIBUTING.md](https://github.com/samvera-labs/bulkrax/blob/main/CONTRIBUTING.md)
[CONTRIBUTING.md](https://github.com/samvera/bulkrax/blob/main/CONTRIBUTING.md)
for contributing guidelines.

We encourage everyone to help improve this project. Bug reports and pull requests are welcome on GitHub at https://github.com/samvera-labs/bulkrax.
We encourage everyone to help improve this project. Bug reports and pull requests are welcome on GitHub at https://github.com/samvera/bulkrax.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://contributor-covenant.org) code of conduct.

Expand Down
11 changes: 11 additions & 0 deletions app/assets/javascripts/bulkrax/bulkrax.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,15 @@ $(document).on('turbolinks:load ready', function() {
$('button#fm_toggle').click(function() {
$('#field_mapping').toggle();
});
$('#bulkraxItemModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('entry-id') // Extract info from data-* attributes
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
var modal = $(this)
modal.find('a').each(function() {
this.href = this.href.replace(/\d+\?/, recipient + '?')
})
return true
})
});
10 changes: 5 additions & 5 deletions app/assets/javascripts/bulkrax/exporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function hideUnhide(field) {
}
};

function addRequired(selectedSource) {
function addRequired(selectedSource) {
selectedSource.addClass('required').attr('required', 'required');
selectedSource.parent().addClass('required');
}
Expand All @@ -26,14 +26,14 @@ function removeRequired(allSources) {

// hide all export_source
function hide(allSources) {
allSources.addClass('hidden');
allSources.find('#exporter_export_source').addClass('hidden').attr('type', 'hidden');
allSources.addClass('d-none');
allSources.find('#exporter_export_source').addClass('.d-none').attr('type', 'd-none');
}

// unhide selected export_source
function unhideSelected(selectedSource) {
selectedSource.removeClass('hidden').removeAttr('type');
selectedSource.parent().removeClass('hidden').removeAttr('type');
selectedSource.removeClass('d-none').removeAttr('type');
selectedSource.parent().removeClass('d-none').removeAttr('type');
};

// add the autocomplete javascript
Expand Down
21 changes: 19 additions & 2 deletions app/assets/javascripts/bulkrax/navtabs.js.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
<% unless defined?(::Hyku) %>
// enables the tabs in the importers/exporters pages.
$(document).ready(function() {
$('.nav-tabs a').click(function (e) {
$('.bulkrax-nav-tab-top-margin.nav-tabs a').click(function(e) {
e.preventDefault();
$(this).tab('show');

// Remove active class from all tabs and hide all tab content
$('.bulkrax-nav-tab-top-margin.nav-tabs a').parent().removeClass('active');
$('.tab-content .tab-pane').removeClass('active');

// Add active class to clicked tab and show its content
$(this).parent().addClass('active');
$($(this).attr('href')).addClass('active');
});

$('#full-errors-tab, #full-errors-tab a').click(function(e) {
$('#raw-errors-tab, #bulkrax-raw-toggle-1').removeClass('active');
$('#full-errors-tab, #bulkrax-full-toggle-1').addClass('active');
})

$('#raw-errors-tab, #raw-errors-tab a').click(function(e) {
$('#full-errors-tab, #bulkrax-full-toggle-1').removeClass('active');
$('#raw-errors-tab, #bulkrax-raw-toggle-1').addClass('active');
})
});
<% end %>
Loading

0 comments on commit 2f65930

Please sign in to comment.