Skip to content

Commit

Permalink
Implement changes for Valkyrie 2.0 RC1
Browse files Browse the repository at this point in the history
  • Loading branch information
tpendragon committed Feb 7, 2019
1 parent 58a99d1 commit c49ca0c
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gem "simple_form"
gem "sprockets", ">= 3.7.2"
gem "title"
gem "uglifier"
gem "valkyrie", "1.5.0"
gem "valkyrie", "2.0.0.RC1", github: "samvera-labs/valkyrie", branch: "update_dry_struct_again"
gem "valkyrie-derivatives", git: "https://github.com/samvera-labs/valkyrie-derivatives.git"
gem "webpacker", ">= 4.0.x"

Expand Down
58 changes: 32 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,29 @@ GIT
sequel_pg
valkyrie (~> 1.5.0.RC1)

GIT
remote: git://github.com/samvera-labs/valkyrie.git
revision: a3da11e9785c7628062935a7785ec40cb26fe4cf
branch: update_dry_struct_again
specs:
valkyrie (2.0.0.RC1)
active-triples
activemodel
activerecord
activesupport
draper
dry-struct
dry-types (~> 0.13.0)
json
json-ld
ldp
pg
railties
rdf
reform
reform-rails
rsolr

GIT
remote: git://github.com/yob/pdf-reader.git
revision: bb7747a3cb4279ecd963185f357dbd718f9d20f3
Expand Down Expand Up @@ -301,23 +324,23 @@ GEM
dry-core (0.4.7)
concurrent-ruby (~> 1.0)
dry-equalizer (0.2.1)
dry-logic (0.5.0)
dry-inflector (0.1.2)
dry-logic (0.4.2)
dry-container (~> 0.2, >= 0.2.6)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-struct (0.4.0)
dry-core (~> 0.4, >= 0.4.1)
dry-struct (0.6.0)
dry-core (~> 0.4, >= 0.4.3)
dry-equalizer (~> 0.2)
dry-types (~> 0.12, >= 0.12.2)
dry-types (~> 0.13)
ice_nine (~> 0.11)
dry-types (0.12.3)
dry-types (0.13.4)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1)
dry-container (~> 0.3)
dry-core (~> 0.2, >= 0.2.1)
dry-core (~> 0.4, >= 0.4.4)
dry-equalizer (~> 0.2)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 0.4, >= 0.4.2)
inflecto (~> 0.0.0, >= 0.0.2)
ebnf (1.1.1)
rdf (~> 2.2)
sxp (~> 1.0)
Expand Down Expand Up @@ -415,7 +438,6 @@ GEM
ice_nine (0.11.2)
iiif_manifest (0.5.0)
activesupport (>= 4)
inflecto (0.0.2)
io-like (0.3.0)
iso-639 (0.2.8)
jbuilder (2.7.0)
Expand Down Expand Up @@ -766,22 +788,6 @@ GEM
unf_ext (0.0.7.5)
unicode-display_width (1.3.0)
validatable (1.6.7)
valkyrie (1.5.0)
active-fedora
active-triples
activemodel
activerecord
activesupport
draper
dry-struct
dry-types (~> 0.12.0)
json
json-ld
pg
railties
rdf
reform
reform-rails
warden (1.2.7)
rack (>= 1.0)
web-console (3.5.1)
Expand Down Expand Up @@ -902,7 +908,7 @@ DEPENDENCIES
tiny_tds
title
uglifier
valkyrie (= 1.5.0)
valkyrie (= 2.0.0.RC1)!
valkyrie-derivatives!
valkyrie-sequel!
web-console
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/concerns/resource_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _prefixes
end

def resource_params
params[resource_class.to_s.underscore.to_sym]&.to_unsafe_h
params[resource_class.to_s.underscore.to_sym]&.to_unsafe_h&.deep_symbolize_keys
end

def find_resource(id)
Expand Down
2 changes: 1 addition & 1 deletion app/models/pending_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class PendingUpload < Valkyrie::Resource
attribute :auth_header

def original_filename
@file_name.first
file_name.first
end

def content_type
Expand Down
4 changes: 2 additions & 2 deletions app/resources/file_sets/file_sets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ def filtered_file_params(file_filter:)
filtered = resource_params
files = filtered.fetch(file_filter, [])
return {} if files.empty?
filtered["files"] = files
filtered[:files] = files
filtered.delete(file_filter)
filtered
end

def derivative_resource_params
@derivative_resource_params ||= filtered_file_params(file_filter: "derivative_files")
@derivative_resource_params ||= filtered_file_params(file_filter: :derivative_files)
end

def update_derivatives
Expand Down
2 changes: 1 addition & 1 deletion app/resources/media_resources/media_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def primary_imported_metadata
end

def title
primary_imported_metadata.title.present? ? primary_imported_metadata.title : @title
primary_imported_metadata.title.present? ? primary_imported_metadata.title : attributes[:title]
end

# Determines if this is a media resource
Expand Down
2 changes: 1 addition & 1 deletion app/resources/raster_resources/raster_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ def primary_imported_metadata

def title
imported_title = primary_imported_metadata.title.present? ? primary_imported_metadata.title : []
@title.present? ? @title : imported_title
attributes[:title].present? ? attributes[:title] : imported_title
end
end
2 changes: 1 addition & 1 deletion app/resources/scanned_maps/scanned_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ def geo_resource?

def title
imported_title = primary_imported_metadata.title.present? ? primary_imported_metadata.title : []
@title.present? ? @title : imported_title
attributes[:title].present? ? attributes[:title] : imported_title
end
end
2 changes: 1 addition & 1 deletion app/resources/scanned_resources/scanned_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def pdf_file
end

def title
primary_imported_metadata.title.present? ? primary_imported_metadata.title : @title
primary_imported_metadata.title.present? ? primary_imported_metadata.title : attributes[:title]
end

# Determines if this is an image resource
Expand Down
2 changes: 1 addition & 1 deletion app/resources/vector_resources/vector_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ def primary_imported_metadata

def title
imported_title = primary_imported_metadata.title.present? ? primary_imported_metadata.title : []
@title.present? ? @title : imported_title
attributes[:title].present? ? attributes[:title] : imported_title
end
end
2 changes: 1 addition & 1 deletion app/services/file_appender.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def append_to(resource)
# @return [Array<File>]
def update_files(resource)
updated = files.select { |file| file.is_a?(Hash) }.map do |file|
node = resource.file_metadata.select { |x| x.id.to_s == file.keys.first }.first
node = resource.file_metadata.select { |x| x.id.to_s == file.keys.first.to_s }.first
node.updated_at = Time.current
# Uses the UploadDecorator to abstract the interface for the File Object during persistence by the storage_adapter
file_wrapper = UploadDecorator.new(file.values.first, node.original_filename.first)
Expand Down

0 comments on commit c49ca0c

Please sign in to comment.