• 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

35.29
/marc_to_solr/lib/cache_adapter.rb
1
# Class which provides an API similar to that of ActiveSupport::Cache::Store Objects
2
# Currently this just supports the Lightly Gem (@see https://github.com/DannyBen/lightly)
3
class CacheAdapter
1✔
4
  # Clear a directory path used by a caching service
5
  # @param dir [String] the path to the directory used by the cache
6
  def self.clear(dir:)
1✔
7
    # Ensure that the directory is empty
8
    base_path = File.expand_path(dir)
×
9
    glob_path = File.join(base_path, '**', '*')
×
10
    paths = Dir.glob(glob_path)
×
11
    FileUtils.rm_r(paths)
×
12
  end
13

14
  # Constructor
15
  # @param service [Lightly] the caching service
16
  def initialize(service:)
1✔
UNCOV
17
    @service = service
×
18
  end
19

20
  # Fetch a value from the cache
21
  # @param key [String] key for the cache
22
  # @return [Object, nil] the value (or nil if no objects have been cached)
23
  def fetch(key)
1✔
UNCOV
24
    return nil unless @service.cached?(key)
×
25

UNCOV
26
    @service.get(key)
×
27
  end
28

29
  # Write to the cache
30
  # @param key [String] key for the cache
31
  # @return [Object] the object being cached for the key
32
  def write(key, value)
1✔
UNCOV
33
    @service.clear(key)
×
UNCOV
34
    @service.get(key) do
×
UNCOV
35
      value
×
36
    end
37
  end
38

39
  # Determine whether or not a value for a given key has been cached
40
  # @param key [String] the key
41
  # @return [TrueClass, FalseClass]
42
  def exist?(key)
1✔
UNCOV
43
    @service.cached?(key)
×
44
  end
45
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