• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_describe / cace366a-ffad-45f1-9b60-678e607fa527

14 May 2024 02:21PM UTC coverage: 60.862% (-35.0%) from 95.908%
cace366a-ffad-45f1-9b60-678e607fa527

push

circleci

jrgriffiniii
wip

1 of 3 new or added lines in 2 files covered. (33.33%)

1194 existing lines in 57 files now uncovered.

2076 of 3411 relevant lines covered (60.86%)

22.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

29.17
/app/services/pul_dspace_aws_connector.rb
1
# frozen_string_literal: true
2
class PULDspaceAwsConnector
1✔
3
  attr_reader :work, :ark, :dspace_doi, :migration_snapshot
1✔
4

5
  def initialize(work, dspace_doi)
1✔
UNCOV
6
    @work = work
×
UNCOV
7
    @ark = work.ark&.gsub("ark:/", "")
×
UNCOV
8
    @dspace_doi = dspace_doi
×
9
  end
10

11
  def upload_to_s3(dspace_files)
1✔
UNCOV
12
    dspace_files.map do |dspace_file|
×
UNCOV
13
      filename = dspace_file.filename
×
UNCOV
14
      match_dspace_file = dspace_file.clone
×
UNCOV
15
      basename = File.basename(dspace_file.filename_display)
×
UNCOV
16
      match_dspace_file.filename = dspace_file.filename_display
×
UNCOV
17
      io = File.open(filename)
×
UNCOV
18
      size = File.size(filename)
×
UNCOV
19
      key = work.s3_query_service.upload_file(io:, filename: basename, md5_digest: dspace_file.checksum, size:)
×
UNCOV
20
      if key
×
UNCOV
21
        { key:, file: match_dspace_file, error: nil }
×
22
      else
UNCOV
23
        { key: nil, file: match_dspace_file, error: "An error uploading #{filename}.  Please try again." }
×
24
      end
25
    end
26
  end
27

28
  def aws_files
1✔
UNCOV
29
    return [] if ark.nil? || dspace_doi.nil?
×
UNCOV
30
    @aws_files ||= work.s3_query_service.client_s3_files(reload: true, bucket_name: dspace_bucket_name, prefix: dspace_doi.tr(".", "-"), ignore_directories: false)
×
31
  end
32

33
  private
1✔
34

35
    def dspace_bucket_name
1✔
UNCOV
36
      @dspace_bucket_name ||= Rails.configuration.s3.dspace[:bucket]
×
37
    end
38
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc