cobench 0.0.8 → 0.0.9

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: 1eaf9208a53326a257503d91e54aae018b2dd0964c0ec11ddde8d8b392a036cc
4
- data.tar.gz: 5b1d155907221ec14edfbd5ca674f345531303e383c2f13aae88335bdc35c1cd
3
+ metadata.gz: 83be84557db1c5b0954853d6ceb77d18fc916628568220c65f9f6b9f0e190883
4
+ data.tar.gz: 30c59ad9a54156120fbdb126b2ff33277b402a23d59a1efa50f602dd21e72d19
5
5
  SHA512:
6
- metadata.gz: 8c155780a0a14a843daf36336d66e5a3216b9886b0da46503d0a44ad3994a7e71eb2d4ee15c7bc4edfe3c236591673c7339e918ce9afbe697f7ca5f4bb415614
7
- data.tar.gz: 2e7ca41724d9768abfbad82c6cbd2bff175b30783644c4af24650183f5868e65050832d7a72d2f776aa080d30afdb2aaaa4a82d315c5279e8f61a350e7cca72f
6
+ metadata.gz: 6e320aea23c4a7bd7bffadb17e235dc24a607ec69ff82c392a07fb403442171a2366a631700a3907cd99246cdd93286c1524ecb469ea1bbf8be68c93689d1053
7
+ data.tar.gz: 91fe1ed2ec75767b9bc2f5f67f62785e01bec6662a81ee3e798367af5dde1c96ef665f05897cb25d4caa733bc8675e8aeb975562f35424ad107cf36054c6464c
data/lib/cobench/match.rb CHANGED
@@ -25,17 +25,18 @@ require_relative 'mask'
25
25
  # Copyright:: Copyright (c) 2022 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  class Cobench::Match
28
- def initialize(opts)
28
+ def initialize(opts, loog)
29
29
  @opts = opts
30
+ @loog = loog
30
31
  end
31
32
 
32
33
  def matches?(repo)
33
34
  if !@opts[:include].empty? && @opts[:include].none? { |m| Cobench::Mask.new(m).matches?(repo) }
34
- loog.debug("Excluding #{repo}##{pr} due to lack of --include")
35
+ @loog.debug("Excluding #{repo} due to lack of --include")
35
36
  return false
36
37
  end
37
38
  if @opts[:exclude].any? { |m| Cobench::Mask.new(m).matches?(repo) }
38
- loog.debug("Excluding #{repo}##{pr} due to --exclude")
39
+ @loog.debug("Excluding #{repo} due to --exclude")
39
40
  return false
40
41
  end
41
42
  true
@@ -40,7 +40,7 @@ class Cobench::Issues
40
40
  total = json.items.count do |p|
41
41
  pr = p.url.split('/')[-1]
42
42
  repo = p.repository_url.split('/')[-2..-1].join('/')
43
- next unless Cobench::Match.new(@opts).matches?(repo)
43
+ next unless Cobench::Match.new(@opts, loog).matches?(repo)
44
44
  loog.debug("Including #{repo}#{pr}")
45
45
  end
46
46
  [
@@ -41,7 +41,7 @@ class Cobench::Pulls
41
41
  total = json.items.count do |p|
42
42
  pr = p.pull_request.url.split('/')[-1]
43
43
  repo = p.repository_url.split('/')[-2..-1].join('/')
44
- next unless Cobench::Match.new(@opts).matches?(repo)
44
+ next unless Cobench::Match.new(@opts, loog).matches?(repo)
45
45
  pr_json = @api.pull_request(repo, pr)
46
46
  hocs = pr_json.additions + pr_json.deletions
47
47
  hoc += hocs
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2022 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Cobench
26
- VERSION = '0.0.8'.freeze
26
+ VERSION = '0.0.9'.freeze
27
27
  end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2022 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+
21
+ require 'minitest/autorun'
22
+ require 'loog'
23
+ require_relative '../lib/cobench/match'
24
+
25
+ # Test for Match.
26
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
27
+ # Copyright:: Copyright (c) 2022 Yegor Bugayenko
28
+ # License:: MIT
29
+ class TestMatch < Minitest::Test
30
+ def test_positive
31
+ loog = Loog::NULL
32
+ opts = { include: [], exclude: [] }
33
+ assert Cobench::Match.new(opts, loog).matches?('foo/bar')
34
+ end
35
+
36
+ def test_negative
37
+ loog = Loog::NULL
38
+ opts = { include: ['*/*'], exclude: ['foo/*'] }
39
+ assert !Cobench::Match.new(opts, loog).matches?('foo/bar')
40
+ end
41
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cobench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -258,6 +258,7 @@ files:
258
258
  - logo.svg
259
259
  - test/test__helper.rb
260
260
  - test/test_mask.rb
261
+ - test/test_match.rb
261
262
  homepage: http://github.com/yegor256/cobench
262
263
  licenses:
263
264
  - MIT