• 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

13.79
/app/services/dump_log_ids_service.rb
1
class DumpLogIdsService
1✔
2
  # Process a dump of MARC files and updates the Dump's delete_id and update_id properties
3
  def process_dump(id)
1✔
UNCOV
4
    dump = Dump.find(id)
×
UNCOV
5
    raise StandardError.new, "Dump is of type #{dump.dump_type}, must be changed_records" unless dump.changed_records?
×
6

UNCOV
7
    delete_ids = []
×
UNCOV
8
    update_ids = []
×
UNCOV
9
    dump.dump_files.each do |dump_file|
×
UNCOV
10
      dump_file.tar_decompress_file do |marc_file|
×
UNCOV
11
        file_delete_ids, file_update_ids = process_marc_file(marc_file)
×
UNCOV
12
        delete_ids += file_delete_ids
×
UNCOV
13
        update_ids += file_update_ids
×
14
      end
15
    end
16

UNCOV
17
    dump.delete_ids = delete_ids
×
UNCOV
18
    dump.update_ids = update_ids
×
UNCOV
19
    dump.save
×
UNCOV
20
    Rails.logger.info "Log ID totals for dump #{id}: deleted #{dump.delete_ids.count}, updated #{dump.update_ids.count}."
×
21
  end
22

23
  private
1✔
24

25
    def process_marc_file(marc_file)
1✔
UNCOV
26
      delete_ids = []
×
UNCOV
27
      update_ids = []
×
UNCOV
28
      reader = Nokogiri::XML::Reader(marc_file)
×
UNCOV
29
      reader.each do |node|
×
UNCOV
30
        next unless node.name == 'record' && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
×
31

UNCOV
32
        xml = Nokogiri::XML(node.outer_xml)
×
UNCOV
33
        id = xml.xpath("//controlfield[@tag='001']/text()").text
×
UNCOV
34
        leader = xml.xpath('//leader/text()').text
×
UNCOV
35
        if leader[5] == 'd'
×
UNCOV
36
          delete_ids << id
×
37
        else
UNCOV
38
          update_ids << id
×
39
        end
40
      end
UNCOV
41
      [delete_ids, update_ids]
×
42
    end
43
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