affected_tests 0.3.0 → 0.4.0

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: f6c26808768b7b2110367dfd84f0da252499ea6e78e3e19c05620556b56ea761
4
- data.tar.gz: 9d2060dd26c7342686491144a0c63609ef1669c30d2c07c67d2881ebf688b174
3
+ metadata.gz: fbb2179c4fffe41e99f31697dc10b161f5d0063776a4e844b88591013c33a97c
4
+ data.tar.gz: 1c4b1596a80fea2d05dc754d4ddc7219843dacb53b022afd0ddab06acc663c31
5
5
  SHA512:
6
- metadata.gz: dbbed873c50948dea8d76b4b52fdda4c7a78d8ef9387c807d993b82cd4b31456fe57b814a833159850ecb485fd5c517b50c265a2f62262a2f6e718e1cf544f92
7
- data.tar.gz: 80240e18765d971e153827bbb7ef1b1c8688fe997ca9c16bd78ace0b10d81bb3e31890c841dca829f6ac16c4610abb69612ca21ed3021131f87ba1b27ed34738
6
+ metadata.gz: 58d176dc48c68f09fa0ff3a610879e1c3c90d6d360eb33cc2b48306810996a7dd762b7490dc47fd63c9bddee22a44005bfbce7262c88043ab4352e41ead236bc
7
+ data.tar.gz: 484bade7034e6ccf3259dd84419b2c80cac33f17a0171f842d59d1cad5d2db252dbaf487ec6082cead83bca000ea2540ee718963d6562c7ba4b8a336f7a5d28b
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AffectedTests
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -14,7 +14,7 @@ module AffectedTests
14
14
  @project_path = project_path
15
15
  @test_dir_path = test_dir_path
16
16
  @output_path = output_path
17
- @revision = revision
17
+ @revision = revision || build_revision
18
18
  @rotoscope = Rotoscope.new do |call|
19
19
  next if self == call.receiver
20
20
 
@@ -55,7 +55,7 @@ module AffectedTests
55
55
  end
56
56
 
57
57
  def dump
58
- data = { revision: revision, map: cache.transform_values(&:to_a) }
58
+ data = { revision: @revision, map: cache.transform_values(&:to_a) }
59
59
  File.write(@output_path, JSON.dump(data))
60
60
  ensure
61
61
  @rotoscope.stop_trace if @rotoscope.tracing?
@@ -74,12 +74,14 @@ module AffectedTests
74
74
  cache[callee].add(caller)
75
75
  end
76
76
 
77
- def revision
78
- return @revision if @revision
79
-
80
- revision_path = File.expand_path("../../REVISION", __FILE__)
81
- if File.exist?(revision_path)
82
- File.read(revision_path).strip
77
+ def build_revision
78
+ if defined? Rails
79
+ path = Rails.root.join("REVISION")
80
+ if path.exist?
81
+ path.read.chomp
82
+ else
83
+ "UNKNOWN"
84
+ end
83
85
  else
84
86
  "UNKNOWN"
85
87
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: affected_tests
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shia