Skip to content

Commit

Permalink
Set licence_url from licence using licences service
Browse files Browse the repository at this point in the history
Set the licence_url from the licence if the licence_url
is not set (and if the licence_url can be mapped). Uses
the Hyrax Licences service and the configuration used
to power to front end webform.

Required by CottageLabs#2
  • Loading branch information
tomwrobel committed Apr 14, 2021
1 parent bc349fa commit 4690481
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
# WillowSword
A Ruby on Rails engine for the Sword V2 server. The Sword server is currently integrated with Hyrax V2.

This code is derived from the original Willow Sword gem, via a fork maintained at https://github.com/tomwrobel/willow_sword

On that branch, the equivalent of master here is feature/ora_customizations

## Important note for ORA users

This project uses git flow conventions for code management, with a major wrinkle:
the production/master branch of this code is feature/ora_customizations
This project uses git flow conventions for code management.

The development branch is still develop, and the release branches are tagged release/ as normal.

The major/minor version numbers of releases will follow the Hyrax/ora.reviewinterface version
number that corresponds to the release cycle under which they were released, e.g. release v3.4.0 will correspond
to ora4.reviewinteface's v3.4.0 release. If no updates to the Sword gem are being released at the time of
an ora4.reviewinterface release, then that version will be skipped in Sword, e.g. if a new version of the Sword gem is being released with
ora4.reviewinterface v3.7.0, then the Sword gem version will be v3.7.0, even if there was no v3.6.0.

This means that release numbers will not necessarily be sequential, as the number does not have
to be updated unless code has been updated.

Hotfix/bugfix version numbers may not directly correspond (e.g. v3.4.1 vs v3.4.2).
New versions will be tagged from v5.0.0

## Deployment to ORA4 QA

At present, we have no way to configure that branch used in the ora4.reviewinterface gemfile. Therefore a release
into QA should be followed by an update to the ora4-qa-symp gemfile from

```ruby
gem 'willow_sword', git: 'https://github.com/tomwrobel/willow_sword', branch: 'feature/ora_customizations'
gem 'willow_sword', git: 'https://gitlab.bodleian.ox.ac.uk/ORA4/willow_sword', branch: 'develop'
```

To

```ruby
gem 'willow_sword', git: 'https://github.com/tomwrobel/willow_sword', branch: 'develop'
gem 'willow_sword', git: 'https://gitlab.bodleian.ox.ac.uk/ORA4/willow_sword', branch: 'working_branch'
```

(amend develop to release/v{release number} as appropriate). And a bundle update and apache reboot should be run.
(amend 'working_branch' to release/v{release number} as appropriate). And a bundle update and apache reboot should be run.

## Installation
Add this line to your application's Gemfile:
Expand All @@ -58,7 +52,6 @@ Mount the engine. Add this line to config/routes.rb
```ruby
mount WillowSword::Engine => '/sword'
```

## Configuration
The plugin has a few configuration options. To view the current default options and override these, see [configuration options](https://github.com/CottageLabs/willow_sword/wiki/Configuring-willow-sword)

Expand Down
9 changes: 9 additions & 0 deletions app/services/willow_sword/assign_mets_to_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ def assign_access_condition
admin_attrs[key] = Array(vals)[0] if Array(vals).any?
end
end
if WillowSword.config.set_license_url_from_license.present?
# Set the licence url from the licence if there is no licence set
licences_and_urls = LicencesService.licences_and_urls
if li_attrs['licence'].present? and li_attrs['licence_url'].blank?
if licences_and_urls[li_attrs['licence']].present?
li_attrs['licence_url'] = licences_and_urls[li_attrs['licence']]
end
end
end
assign_nested_hash('licence_and_rights_information', li_attrs) if li_attrs.any?
assign_nested_hash('admin_information', admin_attrs) if admin_attrs.any?
end
Expand Down
2 changes: 2 additions & 0 deletions config/initializers/willow_sword.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@
config.display_name_as_family_name_initials = true
# tmp directory location for request metadata and binary files
config.tmp_directory_location = 'tmp/data'
# Used for automatically writing license url from license
config.set_license_url_from_license = true
end

0 comments on commit 4690481

Please sign in to comment.