circleci-coverage_reporter 0.6.0 → 0.7.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
  SHA1:
3
- metadata.gz: a7aca8bd4148d9c5416e8238dea67eb03dbd6f2c
4
- data.tar.gz: 693fafae6e3340ce02cad34b682b5dbbc9f00b48
3
+ metadata.gz: 7c02b2d7af2b63de0bd7ddb667a911ff9aa27bb4
4
+ data.tar.gz: 7404cc0ff4659841480a436231ca53a1fb944693
5
5
  SHA512:
6
- metadata.gz: 8864275c0508988de280fd1424ffab28075e980c0388eb8a82b741517266d056d0cf9f01822cbdb60d369ba7520eab6a73c2d632ffba9afbe4f6330426edc82a
7
- data.tar.gz: 0fa44d79b06c75752d09dfaa4f8b4a7faf177e470bce2bcc2190686b3ea111def27dbc3e7ccdee1bea713eb95b8369a510ee634175fddfdb37be2a6f00c85246
6
+ metadata.gz: 27d50c4f709ee6bfcc164504a3121f3c47bbe25f5a43f45e20f9a14e5df4f5b055f3a6b9ef4ad9bc4739774c951c33eec0b615e06be9405ca38da3dc74fcda37
7
+ data.tar.gz: 4193dcc451c5c0fef0fbbef4046391241e30695716e2d455fe59d7e07587ad440a19d97c4fac71a1e48d52103ff02d9856cfb1035adcc5f18ec762a6d1248102
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.0] - 2017-05-31
10
+ ### Changed
11
+ - Add base and previous links to Link reporter
12
+
9
13
  ## [0.6.0] - 2017-05-30
10
14
  ### Changed
11
15
  - Refactor how to implement reporter. Now a reporter consists of a single ruby class
@@ -67,7 +71,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
67
71
  ### Added
68
72
  - Initial release
69
73
 
70
- [Unreleased]: https://github.com/increments/circleci-coverage_reporter/compare/v0.6.0...HEAD
74
+ [Unreleased]: https://github.com/increments/circleci-coverage_reporter/compare/v0.7.0...HEAD
75
+ [0.7.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.6.0...v0.7.0
71
76
  [0.6.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.5.0...v0.6.0
72
77
  [0.5.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.4.0...v0.5.0
73
78
  [0.4.0]: https://github.com/increments/circleci-coverage_reporter/compare/v0.3.1...v0.4.0
@@ -4,32 +4,47 @@ module CircleCI
4
4
  module CoverageReporter
5
5
  module Reporters
6
6
  class Link
7
- LinkReport = Struct.new(:name, :url) do
7
+ # @attr name [String]
8
+ # @attr url [String]
9
+ # @attr base_url [String, nil]
10
+ # @attr previous_url [String, nil]
11
+ LinkReport = Struct.new(:name, :url, :base_url, :previous_url) do
12
+ # @return [String]
8
13
  def to_s
9
- "[#{name}](#{url})"
14
+ links = []
15
+ links << "[master](#{base_url})" if base_url
16
+ links << "[previous](#{previous_url})" if previous_url
17
+ link = links.empty? ? nil : " (#{links.join(', ')})"
18
+ "[#{name}](#{url})#{link}"
10
19
  end
11
20
  end
12
21
 
13
- def initialize(options = {})
14
- @options = options
22
+ # @param path [String]
23
+ # @param name [String]
24
+ def initialize(path:, name:)
25
+ @path = path
26
+ @name = name
15
27
  end
16
28
 
17
29
  # @note Implementation for {Base#active?}
18
30
  def active?
19
- File.file?(File.join(configuration.artifacts_dir, @options[:path]))
31
+ File.file?(File.join(configuration.artifacts_dir, path))
20
32
  end
21
33
 
22
34
  # @note Override {Base#name}
23
- def name
24
- @options[:name]
25
- end
35
+ attr_reader :name
26
36
 
27
- def report(_base_build, _previous_build)
28
- LinkReport.new(@options[:name], url)
37
+ # @param base_build [Build, nil]
38
+ # @param previous_build [Build, nil]
39
+ # @return [LinkReport]
40
+ def report(base_build, previous_build)
41
+ LinkReport.new(name, url, extract_artifact_url(base_build), extract_artifact_url(previous_build))
29
42
  end
30
43
 
31
44
  private
32
45
 
46
+ attr_reader :path
47
+
33
48
  # @return [String]
34
49
  def url
35
50
  [
@@ -38,13 +53,21 @@ module CircleCI
38
53
  configuration.current_build_number,
39
54
  'artifacts',
40
55
  "0#{configuration.artifacts_dir}",
41
- @options[:path]
56
+ path
42
57
  ].join('/')
43
58
  end
44
59
 
45
60
  def configuration
46
61
  CoverageReporter.configuration
47
62
  end
63
+
64
+ # @param build [Build, nil]
65
+ # @return [String, nil]
66
+ def extract_artifact_url(build)
67
+ return unless build
68
+ artifact = build.find_artifact(path)
69
+ artifact ? artifact.url : nil
70
+ end
48
71
  end
49
72
  end
50
73
  end
@@ -2,7 +2,7 @@ module CircleCI
2
2
  module CoverageReporter
3
3
  module Version
4
4
  MAJOR = 0
5
- MINOR = 6
5
+ MINOR = 7
6
6
  PATCH = 0
7
7
 
8
8
  def self.to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circleci-coverage_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuku Takahashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-30 00:00:00.000000000 Z
11
+ date: 2017-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday