Skip to content

Commit b82be3b

Browse files
authored
Merge pull request #1804 from psu-libraries/niftany-upgrade
Niftany Upgrade to 0.12.1
2 parents 404fb34 + d870e0e commit b82be3b

27 files changed

+86
-66
lines changed

.rubocop.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Metrics/CyclomaticComplexity:
4545
Metrics/ClassLength:
4646
Exclude:
4747
- 'app/models/work_version.rb'
48+
- 'app/services/merge_collection.rb'
4849

4950
Rails/DynamicFindBy:
5051
Exclude:
@@ -161,3 +162,9 @@ Layout/LineLength:
161162
RSpec/ReceiveMessages:
162163
Exclude:
163164
- 'spec/decorators/resource_decorator_spec.rb'
165+
166+
Naming/PredicateMethod:
167+
Enabled: false
168+
169+
Capybara/NegationMatcherAfterVisit:
170+
Enabled: false

Gemfile.lock

Lines changed: 38 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ GEM
9494
faraday (>= 1.0, < 3.0)
9595
faraday-net_http_persistent
9696
net-http-persistent
97-
ast (2.4.2)
97+
ast (2.4.3)
9898
aws-eventstream (1.3.1)
9999
aws-partitions (1.1050.0)
100100
aws-sdk-core (3.218.1)
@@ -231,14 +231,14 @@ GEM
231231
faraday-net_http_persistent (2.0.2)
232232
faraday-net_http (< 3)
233233
net-http-persistent (~> 4.0)
234-
ffi (1.17.1-aarch64-linux-gnu)
235-
ffi (1.17.1-aarch64-linux-musl)
236-
ffi (1.17.1-arm-linux-gnu)
237-
ffi (1.17.1-arm-linux-musl)
238-
ffi (1.17.1-arm64-darwin)
239-
ffi (1.17.1-x86_64-darwin)
240-
ffi (1.17.1-x86_64-linux-gnu)
241-
ffi (1.17.1-x86_64-linux-musl)
234+
ffi (1.17.2-aarch64-linux-gnu)
235+
ffi (1.17.2-aarch64-linux-musl)
236+
ffi (1.17.2-arm-linux-gnu)
237+
ffi (1.17.2-arm-linux-musl)
238+
ffi (1.17.2-arm64-darwin)
239+
ffi (1.17.2-x86_64-darwin)
240+
ffi (1.17.2-x86_64-linux-gnu)
241+
ffi (1.17.2-x86_64-linux-musl)
242242
ffi-compiler (1.3.2)
243243
ffi (>= 1.15.5)
244244
rake
@@ -284,7 +284,7 @@ GEM
284284
rails-dom-testing (>= 1, < 3)
285285
railties (>= 4.2.0)
286286
thor (>= 0.14, < 2.0)
287-
json (2.12.2)
287+
json (2.13.2)
288288
jsonb_accessor (1.3.10)
289289
activerecord (>= 5.0)
290290
activesupport (>= 5.0)
@@ -303,7 +303,7 @@ GEM
303303
activerecord
304304
kaminari-core (= 1.2.2)
305305
kaminari-core (1.2.2)
306-
language_server-protocol (3.17.0.4)
306+
language_server-protocol (3.17.0.5)
307307
launchy (3.1.0)
308308
addressable (~> 2.8)
309309
childprocess (~> 5.0)
@@ -366,7 +366,7 @@ GEM
366366
timeout
367367
net-smtp (0.5.1)
368368
net-protocol
369-
niftany (0.12.0)
369+
niftany (0.12.1)
370370
colorize (~> 1.1.0)
371371
erb_lint (~> 0.9.0)
372372
rubocop (~> 1.72)
@@ -422,8 +422,8 @@ GEM
422422
paper_trail (16.0.0)
423423
activerecord (>= 6.1)
424424
request_store (~> 1.4)
425-
parallel (1.26.3)
426-
parser (3.3.7.1)
425+
parallel (1.27.0)
426+
parser (3.3.9.0)
427427
ast (~> 2.4.1)
428428
racc
429429
parslet (2.0.0)
@@ -432,6 +432,7 @@ GEM
432432
pp (0.6.2)
433433
prettyprint
434434
prettyprint (0.2.0)
435+
prism (1.4.0)
435436
pry (0.14.2)
436437
coderay (~> 1.1)
437438
method_source (~> 1.0)
@@ -526,7 +527,7 @@ GEM
526527
recaptcha (5.19.0)
527528
redcarpet (3.6.0)
528529
redis (4.8.1)
529-
regexp_parser (2.10.0)
530+
regexp_parser (2.11.2)
530531
reline (0.6.2)
531532
io-console (~> 0.5)
532533
request_store (1.7.0)
@@ -566,39 +567,43 @@ GEM
566567
rspec-mocks (~> 3.13)
567568
rspec-support (~> 3.13)
568569
rspec-support (3.13.2)
569-
rubocop (1.72.2)
570+
rubocop (1.80.2)
570571
json (~> 2.3)
571572
language_server-protocol (~> 3.17.0.2)
572573
lint_roller (~> 1.1.0)
573574
parallel (~> 1.10)
574575
parser (>= 3.3.0.2)
575576
rainbow (>= 2.2.2, < 4.0)
576577
regexp_parser (>= 2.9.3, < 3.0)
577-
rubocop-ast (>= 1.38.0, < 2.0)
578+
rubocop-ast (>= 1.46.0, < 2.0)
578579
ruby-progressbar (~> 1.7)
579580
unicode-display_width (>= 2.4.0, < 4.0)
580-
rubocop-ast (1.38.0)
581-
parser (>= 3.3.1.0)
582-
rubocop-capybara (2.21.0)
583-
rubocop (~> 1.41)
584-
rubocop-factory_bot (2.26.1)
585-
rubocop (~> 1.61)
586-
rubocop-performance (1.24.0)
581+
rubocop-ast (1.46.0)
582+
parser (>= 3.3.7.2)
583+
prism (~> 1.4)
584+
rubocop-capybara (2.22.1)
585+
lint_roller (~> 1.1)
586+
rubocop (~> 1.72, >= 1.72.1)
587+
rubocop-factory_bot (2.27.1)
588+
lint_roller (~> 1.1)
589+
rubocop (~> 1.72, >= 1.72.1)
590+
rubocop-performance (1.25.0)
587591
lint_roller (~> 1.1)
588-
rubocop (>= 1.72.1, < 2.0)
592+
rubocop (>= 1.75.0, < 2.0)
589593
rubocop-ast (>= 1.38.0, < 2.0)
590-
rubocop-rails (2.30.2)
594+
rubocop-rails (2.33.3)
591595
activesupport (>= 4.2.0)
592596
lint_roller (~> 1.1)
593597
rack (>= 1.1)
594-
rubocop (>= 1.72.1, < 2.0)
595-
rubocop-ast (>= 1.38.0, < 2.0)
596-
rubocop-rspec (3.5.0)
598+
rubocop (>= 1.75.0, < 2.0)
599+
rubocop-ast (>= 1.44.0, < 2.0)
600+
rubocop-rspec (3.7.0)
601+
lint_roller (~> 1.1)
602+
rubocop (~> 1.72, >= 1.72.1)
603+
rubocop-rspec_rails (2.31.0)
597604
lint_roller (~> 1.1)
598605
rubocop (~> 1.72, >= 1.72.1)
599-
rubocop-rspec_rails (2.30.0)
600-
rubocop (~> 1.61)
601-
rubocop-rspec (~> 3, >= 3.0.1)
606+
rubocop-rspec (~> 3.5)
602607
ruby-progressbar (1.13.0)
603608
ruby-vips (2.2.3)
604609
ffi (~> 1.12)
@@ -668,7 +673,7 @@ GEM
668673
timeout (0.4.3)
669674
tzinfo (2.0.6)
670675
concurrent-ruby (~> 1.0)
671-
unicode-display_width (3.1.4)
676+
unicode-display_width (3.1.5)
672677
unicode-emoji (~> 4.0, >= 4.0.4)
673678
unicode-emoji (4.0.4)
674679
uppy-s3_multipart (1.2.1)

app/controllers/api/v1/rest_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ def authenticate_request!
4141
end
4242

4343
def api_token
44-
@api_token ||= ApiToken.find_by(token: api_key_header)
44+
return @api_token if defined?(@api_token)
45+
46+
@api_token = ApiToken.find_by(token: api_key_header)
4547
end
4648

4749
def api_key_header

app/controllers/application_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
class ApplicationController < ActionController::Base
44
# Adds a few additional behaviors into the application controller
55
include Blacklight::Controller
6+
67
layout 'frontend'
78

89
# Authorization

app/forms/autocomplete_work_form.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
class AutocompleteWorkForm
44
include ActiveModel::Model
5+
56
attr_accessor :doi
67

78
validate :doi, :valid_doi?

app/models/application_setting.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def self.instance
1010
private
1111

1212
def enforce_singleton
13-
return if self.class.count.zero?
13+
return if self.class.none?
1414

1515
raise ArgumentError, "#{self.class} is a singleton"
1616
end

app/reports/all_work_versions_report.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def rows
103103
def work_versions
104104
WorkVersion
105105
.includes(:work)
106-
.order('work_id, id asc')
106+
.order(:work_id, :id)
107107
end
108108

109109
# Returns a hash of { work_version_id => num_views }

app/services/delete_collection.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def successful?
4040
private
4141

4242
def collection
43-
@collection ||= Collection.find_by(uuid: uuid)
43+
return @collection if defined?(@collection)
44+
45+
@collection = Collection.find_by(uuid: uuid)
4446
end
4547
end

app/services/destroy_work_version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def self.call(work_version, force: false)
55
work_version.force_destroy = force
66
parent_work = work_version.work
77

8-
if parent_work.versions.count == 1
8+
if parent_work.versions.one?
99
WorkVersion.transaction do
1010
work_version.destroy!
1111
parent_work.destroy!

app/services/merge_collection.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ def validate
6969
private
7070

7171
def collection
72-
@collection ||= Collection.find_by(uuid: uuid)
72+
return @collection if defined?(@collection)
73+
74+
@collection = Collection.find_by(uuid: uuid)
7375
end
7476

7577
def canonical_work

0 commit comments

Comments
 (0)