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

pulibrary / bibdata / 1dcebae2-3318-4e77-bc53-82276e293354

02 May 2025 04:45PM UTC coverage: 28.256% (-63.9%) from 92.189%
1dcebae2-3318-4e77-bc53-82276e293354

push

circleci

sandbergja
Add basic infrastructure for compiling rust code

* Add a rake compile task to compile
* Run the rake task in CI
* Run the rake task before rspec tests with the rust tag, to provide quick feedback on rust changes in TDD cycles

2 of 7 new or added lines in 2 files covered. (28.57%)

2467 existing lines in 97 files now uncovered.

1089 of 3854 relevant lines covered (28.26%)

0.29 hits per line

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

20.0
/app/models/scsb/partner_updates/incremental.rb
1
module Scsb
1✔
2
  class PartnerUpdates
1✔
3
    class Incremental < Update
1✔
4
      def process_incremental_files
1✔
UNCOV
5
        prepare_directory
×
UNCOV
6
        update_files = download_partner_updates
×
UNCOV
7
        process_partner_updates(files: update_files)
×
UNCOV
8
        Dump.generated_date(dump.id)
×
UNCOV
9
        delete_files = download_partner_deletes
×
UNCOV
10
        process_partner_deletes(files: delete_files)
×
11
      end
12

13
      def download_partner_updates
1✔
UNCOV
14
        file_list = @s3_bucket.list_files(prefix: ENV['SCSB_S3_PARTNER_UPDATES'] || 'data-exports/PUL/MARCXml/Incremental')
×
UNCOV
15
        @s3_bucket.download_files(files: file_list, timestamp_filter: @last_dump, output_directory: @update_directory)
×
16
      end
17

18
      def download_partner_deletes
1✔
UNCOV
19
        file_list = @s3_bucket.list_files(prefix: ENV['SCSB_S3_PARTNER_DELETES'] || 'data-exports/PUL/Json')
×
UNCOV
20
        @s3_bucket.download_files(files: file_list, timestamp_filter: @last_dump, output_directory: @update_directory)
×
21
      end
22

23
      def process_partner_deletes(files:)
1✔
UNCOV
24
        json_files = []
×
UNCOV
25
        files.each do |file|
×
UNCOV
26
          filename = File.basename(file, '.zip')
×
UNCOV
27
          file_increment = 1
×
UNCOV
28
          Zip::File.open(file) do |zip_file|
×
UNCOV
29
            zip_file.each do |entry|
×
UNCOV
30
              target = "#{@update_directory}/scsbdelete#{filename}_#{file_increment}.json"
×
UNCOV
31
              json_files << target
×
UNCOV
32
              entry.extract(target)
×
UNCOV
33
              file_increment += 1
×
34
            end
35
          end
UNCOV
36
          File.unlink(file)
×
37
        end
UNCOV
38
        ids = []
×
UNCOV
39
        json_files.each do |file|
×
UNCOV
40
          scsb_ids(file, ids)
×
UNCOV
41
          File.unlink(file)
×
42
        end
UNCOV
43
        @dump.delete_ids = ids
×
UNCOV
44
        @dump.save
×
45
      end
46

47
      def scsb_ids(filename, ids)
1✔
UNCOV
48
        file = File.read(filename)
×
UNCOV
49
        data = JSON.parse(file)
×
UNCOV
50
        data.each do |record|
×
UNCOV
51
          ids << "SCSB-#{record['bib']['bibId']}"
×
52
        end
UNCOV
53
        ids
×
54
      end
55
    end
56
  end
57
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