allure-ruby-commons 2.21.0 → 2.21.2

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: 66e09f6d14fc5e93508a0d861d0df40b93b76e86a9b89a1ab8d6a5f72a0e036a
4
- data.tar.gz: d81cc78375aac9293ffa6f23a35a9ae3dfb8a4a923b20dfddcbae74ce5f8d0be
3
+ metadata.gz: bd98c6464edda2d8f2095866f00cb567c6f3daeb4d591a4e742fbf814b365ded
4
+ data.tar.gz: 0f01fffeda2b9957de193a23070864070cc7ee7adddcbdcfbd8d238db1739567
5
5
  SHA512:
6
- metadata.gz: c37fb24ee8dde0d460a3bcef86c2e515421d09ca22579f249320662542ceaa6cc506c8db017c5e1808dd1b24f428db0e4a258c7be20132c2044f271208959cb2
7
- data.tar.gz: dff9c7508de915a8e834d6715bb25883e5607279e3716d73aa42d502801dde3c1cb274c21d8d7a4081298de5896e74055253c7f6b70460bb36dce992dabc68cf
6
+ metadata.gz: 157cee12a334d96847540fc49096d2d34f2f41e64a38e285f43fee9beb8751a0c7f751d5b13ec99ae02e9dffa4edf68c40af9877fc177ac105d89a050b633c87
7
+ data.tar.gz: 372b8b2cade3f8d461b989087c56fea808e049d272f007aacea695b5e8319b3e0c128170c1dd2d27b3866697e3a1a67387f0b5a7d84f3b3751a99ec914fd7d66
@@ -28,9 +28,12 @@ module Allure
28
28
  define_method(:load_json) do |json|
29
29
  Oj.load_file(json, symbol_keys: true)
30
30
  rescue Oj::ParseError
31
+ Allure.configuration.logger.error("Failed to parse json: #{json}")
31
32
  nil
32
33
  end
33
34
  rescue LoadError
35
+ require "json"
36
+
34
37
  define_method(:dump_json) do |obj|
35
38
  JSON.generate(obj)
36
39
  end
@@ -38,6 +41,7 @@ module Allure
38
41
  define_method(:load_json) do |json|
39
42
  JSON.parse(File.read(json), symbolize_names: true)
40
43
  rescue JSON::ParserError
44
+ Allure.configuration.logger.error("Failed to parse json: #{json}")
41
45
  nil
42
46
  end
43
47
  end
@@ -28,7 +28,25 @@ module Allure
28
28
  #
29
29
  # @return [Array<Hash>]
30
30
  def tests
31
- @tests ||= load_json(ENV[TESTPLAN_PATH])&.fetch(:tests) if ENV[TESTPLAN_PATH]
31
+ @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path
32
+ end
33
+
34
+ # Fetch test plan path
35
+ #
36
+ # @return [<String, nil>]
37
+ def test_plan_path
38
+ return @test_plan_path if defined?(@test_plan_path)
39
+
40
+ @test_plan_path = ENV[TESTPLAN_PATH].then do |path|
41
+ next unless path
42
+ next path if File.file?(path)
43
+
44
+ json = File.join(path, "testplan.json")
45
+ next json if File.exist?(json)
46
+
47
+ Allure.configuration.logger.warn("'ALLURE_TESTPLAN_PATH' env var is set, but no testplan.json found!")
48
+ nil
49
+ end
32
50
  end
33
51
  end
34
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allure-ruby-commons
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.21.0
4
+ version: 2.21.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrejs Cunskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-27 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types