oyencov 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56fb7dec01c127b50a2af690eefcd419cc7d86d4c41c432d562550990bbfd66c
4
- data.tar.gz: 3ba9a297ab176fa1481a4db7a560573efa54787ae779392188b95ff6accef759
3
+ metadata.gz: 86ccbaeab7bc98e4cf43170065e6440687011bc96d5053a208509d0039dc9b15
4
+ data.tar.gz: 98245151e9b61667a65ed8a5820d570d7afd8a39be1529d3ae2f479d252ce04f
5
5
  SHA512:
6
- metadata.gz: 6d3ec6bf338ad3977ac108a7cc5b567c2f3ff22bb601f62af87416561022e4b08eb6c67a1466dcc7b0a77e907c6836885e3429f854e51f72625f3b5932eaada5
7
- data.tar.gz: a3fc843485093188f54c72b36156650d0e0b8a911a4a93d4961be4aa270a8f80d8738ffa89d577a8cac386d533afc4287b16c9a58bc333046786e60087eb0758
6
+ metadata.gz: 4d4a686bfb48925a2a2ec0444eb8aac159ee721773d6c2bf279f1cb6991cf54530682d01e442005a7269888ccf712068b590b403e798d6b8f9f4069004cece05
7
+ data.tar.gz: b5b696fc7c769ff01f1051de03fcb701e1e333b26697e318c01e53be91b4a06e8c6799b259d1dfeb3e37391ce6ca21cd4de6f830171c12b1bf3d64ad40ffd2ee
@@ -1,4 +1,5 @@
1
1
  require "parser/current"
2
+ require_relative "logger"
2
3
 
3
4
  # This module helps scanning source code files and get the definition line
4
5
  # ranges, so we can count how many times a method has been executed.
@@ -24,6 +25,10 @@ module OyenCov
24
25
  #
25
26
  # @return [Hash<String, >] Hash of methods to their children starting line count. The line count can be used to read how often the method is executed from `Coverage.peek_result`
26
27
  private_class_method def self.parse_file(filepath)
28
+ unless File.exist?(filepath)
29
+ return nil
30
+ end
31
+
27
32
  ast = traverse_ast(Parser::CurrentRuby.parse(File.read(filepath))) || []
28
33
  ast.reverse
29
34
  .to_h
@@ -8,7 +8,7 @@ defined?(Puma::Plugin.create) && Puma::Plugin.create do
8
8
  def config(c)
9
9
  OyenCov::Logger.log("Puma::Plugin.create config(c) running...")
10
10
 
11
- c.on_booted do
11
+ defined?(c.on_booted) && c.on_booted do
12
12
  OyenCov::Logger.log("Puma::Plugin.create config on_booted called")
13
13
  OyenCov::Background.start
14
14
  if defined?(Rails::Railtie)
@@ -18,7 +18,7 @@ defined?(Puma::Plugin.create) && Puma::Plugin.create do
18
18
  end
19
19
  end
20
20
 
21
- c.on_worker_boot do
21
+ defined?(c.on_worker_boot) && c.on_worker_boot do
22
22
  OyenCov::Logger.log("Puma::Plugin.create config on_worker_boot called")
23
23
  OyenCov::Background.start
24
24
  if defined?(Rails::Railtie)
@@ -1,3 +1,3 @@
1
1
  module OyenCov
2
- VERSION = "0.0.14".freeze
2
+ VERSION = "0.0.16".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oyencov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anonoz Chong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-04 00:00:00.000000000 Z
11
+ date: 2024-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday