• 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/jobs/import/partner/download_full_file_job.rb
1
module Import
1✔
2
  module Partner
1✔
3
    class DownloadFullFileJob
1✔
4
      include Sidekiq::Job
1✔
5
      def perform(dump_id, institution, file_prefix)
1✔
UNCOV
6
        zip_file = Scsb::PartnerUpdates::Full.download_full_file(institution, 'zip')
×
7

UNCOV
8
        raise StandardError("No full dump files found matching #{institution}") unless zip_file
×
9

UNCOV
10
        xml_files = unzip_file(zip_file, file_prefix)
×
UNCOV
11
        xml_files = xml_files.to_set
×
UNCOV
12
        batch.jobs do
×
UNCOV
13
          process_xml_files_batch = Sidekiq::Batch.new
×
UNCOV
14
          process_xml_files_batch.description = "Process #{xml_files.size} unzipped xml files from #{institution}"
×
UNCOV
15
          process_xml_files_batch.on(:success, 'Import::Partner::FullCallbacks#process_xml_file_success', 'zip_file' => zip_file)
×
UNCOV
16
          process_xml_files_batch.jobs do
×
UNCOV
17
            xml_files.each do |file|
×
UNCOV
18
              Import::Partner::ProcessXmlFileJob.perform_async(dump_id, file)
×
19
            end
20
          end
21
        end
22
      end
23

24
      def unzip_file(file, file_prefix)
1✔
UNCOV
25
        update_directory = ENV.fetch('SCSB_PARTNER_UPDATE_DIRECTORY', '/tmp/updates')
×
UNCOV
26
        xml_files = []
×
UNCOV
27
        filename = File.basename(file, '.zip')
×
UNCOV
28
        filename.gsub!(/^[^_]+_([0-9]+)_([0-9]+).*$/, '\1_\2')
×
UNCOV
29
        file_increment = 1
×
UNCOV
30
        Zip::File.open(file) do |zip_file|
×
UNCOV
31
          zip_file.each do |entry|
×
UNCOV
32
            target = "#{update_directory}/#{file_prefix}#{filename}_#{file_increment}.xml"
×
UNCOV
33
            xml_files << target
×
UNCOV
34
            entry.extract(target)
×
UNCOV
35
            file_increment += 1
×
36
          # If the file already exists, we probably partially ran this job previously, and it's not a problem.
37
          # Should just move to the next entry.
38
          rescue Zip::DestinationFileExistsError => e
UNCOV
39
            Rails.logger.info(e.message)
×
40
          end
41
        end
UNCOV
42
        xml_files
×
43
      end
44
    end
45
  end
46
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