Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Merge ab63222 into aad046b
Browse files Browse the repository at this point in the history
  • Loading branch information
awead committed May 8, 2019
2 parents aad046b + ab63222 commit d9384ab
Show file tree
Hide file tree
Showing 56 changed files with 170 additions and 126 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inherit_from:
- .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.4.1
TargetRubyVersion: 2.6.3
Exclude:
- 'db/**/*'
- 'script/**/*'
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.1
2.6.3
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ cache:
directories:
- dep_cache
- node_modules
before_install:
- gem update --system
- gem install bundler
- travis_retry nvm install 11.8.0
- node -v
- travis_retry npm i -g yarn
- travis_retry yarn
- yarn
bundler_args: --without development debug
sudo: false
addons:
postgresql: "9.6"
chrome: stable
rvm:
- 2.4.1
- 2.6.3
jdk:
- oraclejdk8
env:
Expand Down
37 changes: 19 additions & 18 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ GEM
coderay (>= 1.0.0)
erubi (>= 1.0.0)
rack (>= 0.9.0)
better_html (1.0.11)
better_html (1.0.13)
actionview (>= 4.0)
activesupport (>= 4.0)
ast (~> 2.0)
Expand Down Expand Up @@ -309,6 +309,7 @@ GEM
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
inflecto (0.0.2)
jaro_winkler (1.5.2)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -379,25 +380,24 @@ GEM
net-ssh (5.2.0)
net_http_ssl_fix (0.0.10)
newrelic_rpm (6.1.0.352)
niftany (0.3.0)
niftany (0.4.0)
colorize (~> 0.8.1)
erb_lint (~> 0.0.22)
rubocop (~> 0.51, <= 0.52.1)
rubocop-rspec (~> 1.22, <= 1.22.2)
rubocop (~> 0.61)
rubocop-rspec (~> 1.3)
scss_lint (~> 0.55)
nio4r (2.3.1)
nokogiri (1.10.1)
nokogiri (1.10.3)
mini_portile2 (~> 2.4.0)
openseadragon (0.5.0)
rails (> 3.2.0)
orm_adapter (0.5.0)
parallel (1.12.1)
parser (2.5.3.0)
parallel (1.17.0)
parser (2.6.3.0)
ast (~> 2.4.0)
path_expander (1.0.3)
pg (1.1.4)
popper_js (1.14.5)
powerpack (0.1.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
Expand Down Expand Up @@ -520,22 +520,22 @@ GEM
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.52.1)
rubocop (0.68.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
parser (>= 2.5, != 2.5.1.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.22.2)
rubocop (>= 0.52.1)
unicode-display_width (>= 1.4.0, < 1.6)
rubocop-rspec (1.32.0)
rubocop (>= 0.60.0)
ruby-progressbar (1.10.0)
ruby_parser (3.12.0)
sexp_processor (~> 4.9)
rubyzip (1.2.2)
rufus-scheduler (3.5.2)
fugit (~> 1.1, >= 1.1.5)
sass (3.7.3)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
Expand All @@ -555,7 +555,7 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
scss_lint (0.57.1)
scss_lint (0.58.0)
rake (>= 0.9, < 13)
sass (~> 3.5, >= 3.5.5)
selenium-webdriver (3.141.0)
Expand Down Expand Up @@ -634,7 +634,7 @@ GEM
uber (0.1.0)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.4.1)
unicode-display_width (1.5.0)
validatable (1.6.7)
valkyrie (1.4.0)
active-fedora
Expand Down Expand Up @@ -734,6 +734,7 @@ DEPENDENCIES
rsolr (>= 1.0)
rspec-its
rspec-rails
rubocop (~> 0.62)
rubyzip
sass-rails (~> 5.0)
selenium-webdriver
Expand All @@ -754,4 +755,4 @@ DEPENDENCIES
xray-rails

BUNDLED WITH
1.17.2
2.0.1
1 change: 1 addition & 0 deletions app/blacklight/metadata_field_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def content

def paragraphs
return [] if blank?

content.join("\n").split(/\n+/)
end
end
1 change: 1 addition & 0 deletions app/blacklight/solr_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def file_sets
# @ return Work::File or nil
def representative_file_set
return unless id = self['representative_file_set_id_ss'].presence

Work::FileSet.find(Valkyrie::ID.new(id.sub(/^id-/, '')))
end

Expand Down
2 changes: 2 additions & 0 deletions app/cho/agent/change_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def to_s

def unique_name(_attribute)
return if resource.to_s == to_s

Agent::Resource.all.map do |agent|
unique_agent_error(agent)
end
Expand All @@ -26,6 +27,7 @@ def unique_name(_attribute)
def unique_agent_error(agent)
message = "#{agent} already exists"
return if errors[:base].include?(message)

errors.add(:base, message) if agent.to_s == to_s
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/cho/agent/import/csv_dry_run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def initialize(csv_file_name, update: false)
def results
@results ||= reader.map do |work_hash|
Csv::HashValidator.new(work_hash,
resource_class: Agent::Resource,
change_set_class: Agent::ChangeSet).change_set
resource_class: Agent::Resource,
change_set_class: Agent::ChangeSet).change_set
end
end

Expand Down
1 change: 1 addition & 0 deletions app/cho/batch/delete_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def titles_for(type)

def contained_resources(type)
return [] unless resource.try(type)

resource.send(type)
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/cho/csv/dry_run_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class DryRunTransaction

def create_dry_run(csv_dry_run:, path:, update:)
result = csv_dry_run.new(path, update: update)
return Success(result)
rescue StandardError => error
return Failure(error.message)
Success(result)
rescue StandardError => e
Failure(e.message)
end
end
end
2 changes: 2 additions & 0 deletions app/cho/import/work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ def must_have_valid_file_sets

def validate_representative_file_set(file_set)
return if file_set.access.present?

errors.add(:file_sets, 'representative does not have an access file')
end

def validate_file_set(file_set)
return if file_set.preservation.present? || file_set.service.present?

errors.add(:file_sets, "#{file_set} does not have a service or preservation file")
end

Expand Down
4 changes: 4 additions & 0 deletions app/cho/indexing/creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ def initialize(arg)
# @return [String]
def role
return if role_id.blank?

RDF::Vocab::MARCRelators.to_a.select { |relator| relator.to_uri == role_id }.first.label.to_s
end

# @return [String]
def agent
return if agent_id.blank?

Agent::Resource.find(Valkyrie::ID.new(agent_id))
end

def agent_display
return if blank?

agent.to_s
end

Expand All @@ -53,6 +56,7 @@ def blank?

def display_name
return if blank?

[agent.display_name, role].compact.join(', ')
end
end
Expand Down
4 changes: 4 additions & 0 deletions app/cho/repository/config_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,27 @@ def validate

def check_requirement(property:, setting:)
return if keys.include?(property) || !setting.required

raise Configuration::Error, "#{property} is a required key in #{name}"
end

def check_directory(property:, setting:)
return unless setting.directory

directory_exists(property)
directory_writable(property: property, setting: setting)
end

def directory_exists(value)
path = Pathname.new(config.fetch(value))
return if path.exist? && path.readable?

raise Configuration::Error, "#{config.fetch(value)} must be present and readable in #{name}"
end

def directory_writable(property:, setting:)
return if Pathname.new(config.fetch(property)).writable? || !setting.directory.writable

raise Configuration::Error, "#{config.fetch(property)} must be writable in #{name}"
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/cho/repository/download.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def available?
def file
@file ||= begin
return if file_set.nil?

select_file
end
end
Expand All @@ -27,6 +28,7 @@ def file
def select_file
get_method = FileUse.new(use).get_method
return default_file unless get_method

file_set.send(get_method)
end

Expand Down
3 changes: 3 additions & 0 deletions app/cho/repository/file_use.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ def initialize(fragment)

def get_method
return unless uri

NAME[uri].to_sym
end

def set_method
return unless uri

"#{NAME[uri]}!".to_sym
end

def ask_method
return unless uri

"#{NAME[uri]}?".to_sym
end

Expand Down
3 changes: 3 additions & 0 deletions app/cho/schema/input_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ def partial

def multiple_class
return 'ff-multiple' if multiple?

'ff-single'
end

def values
return empty_values if value_set.empty?

value_set
end

Expand Down Expand Up @@ -61,6 +63,7 @@ def value_set

def empty_values
return [{}] if linked_field?

['']
end
end
Expand Down
20 changes: 10 additions & 10 deletions app/cho/schema/metadata_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ def initialize_from_data_dictionary_field(data_dictionary_field, schema_field_co
field
end

private
private

def merge_attributes(data_dictionary_attributes, schema_field_config)
return data_dictionary_attributes if schema_field_config.blank?
def merge_attributes(data_dictionary_attributes, schema_field_config)
return data_dictionary_attributes if schema_field_config.blank?

safe_schema_field_config = schema_field_config.symbolize_keys
.reject { |key, _value| reserved_keys.include?(key) }
data_dictionary_attributes.merge(safe_schema_field_config)
end
safe_schema_field_config = schema_field_config.symbolize_keys
.reject { |key, _value| reserved_keys.include?(key) }
data_dictionary_attributes.merge(safe_schema_field_config)
end

def reserved_keys
[:label, :requirement_designation, :core_field]
end
def reserved_keys
[:label, :requirement_designation, :core_field]
end
end
end
end
4 changes: 2 additions & 2 deletions app/cho/transaction/operations/file/characterize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def call(change_set)
change_set.validate(fits_output: xml_string)

Success(change_set)
rescue StandardError => exception
Failure(Transaction::Rejection.new("Error characterizing file: #{exception.message}"))
rescue StandardError => e
Failure(Transaction::Rejection.new("Error characterizing file: #{e.message}"))
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/cho/transaction/operations/file/create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Create
def call(file_change_set, temp_file:)
saved_work_file = metadata_adapter.persister.save(resource: work_file(file_change_set, temp_file: temp_file))
Success(file_change_set.class.new(saved_work_file))
rescue StandardError => exception
Failure(Transaction::Rejection.new("Error persisting file: #{exception.message}"))
rescue StandardError => e
Failure(Transaction::Rejection.new("Error persisting file: #{e.message}"))
end

private
Expand Down

0 comments on commit d9384ab

Please sign in to comment.