cobench 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b298ef3dbb65893787af11d1b4cf86e9b02169dc2c83a3e34d902c2c26a2d43
4
- data.tar.gz: b13f5d42eb289a3e6a5fdd9bdb8a5c31a2357ec1c8a3f35cc35b3c5ec1b6c9e6
3
+ metadata.gz: a36f769e2bd7c22261752671935908e1e9776228406eab462a80e14ec47f5888
4
+ data.tar.gz: 528467b0d08b48aa958d2bc5eb5d075322f55af081834982a2fc06c02e5c0919
5
5
  SHA512:
6
- metadata.gz: 83080a2db71ccd8d2e93a00bcbb0bd33a1aa3ddd3ae4a31accdc442403f65b22db215b6e2887dae69c43f0a3655293c7d398f8d5be2819e272995162884923bc
7
- data.tar.gz: 86b2a9d10ac6e59b41b43ba16c1e55aa0cec3b83729556f53a7530b847a6c2b5738bc8b142ebca0583ac231dc3750156c870776dfad93f2201c1467ab85c67eb
6
+ metadata.gz: ce12d12d53b6cda30c247125455e7b5b7f9cd256a05df04a99e9871606e6a862436ac802057848068c5d9cd88165baa326d79ebbaee8b1455c124f96e2cbe6fd
7
+ data.tar.gz: '059a36cb0f76dbfa525a87ac56b38cd1816eedeabeb89389cdd5048ba2ac1d35488655b0adfc7dd01bc4b86abfa78ab55fea4b54a7794db8150b4804eb5fc868'
data/bin/cobench CHANGED
@@ -56,7 +56,7 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
56
56
  o.array '--exclude', 'Mask of GitHub repo to exclude'
57
57
  end
58
58
 
59
- if opts.help?
59
+ if opts.help? || opts[:coder].empty?
60
60
  puts opts
61
61
  exit
62
62
  end
@@ -95,16 +95,17 @@ begin
95
95
  loog.info("Reading GitHub data for the last #{opts[:days]} days")
96
96
  titles = {}
97
97
  opts[:coder].each do |u|
98
- loog.info("Scanning #{u}...")
99
- data[u] = {}
98
+ user = u.downcase
99
+ loog.info("Scanning #{user}...")
100
+ data[user] = {}
100
101
  Dir[File.join(__dir__, '../lib/cobench/metrics/*.rb')].each do |f|
101
102
  name = File::basename(f).split('.')[0]
102
103
  if !opts[:metrics].empty? && !opts[:metrics].include?(name)
103
- loog.info("Ignoring #{u}/#{name} due to --metrics")
104
+ loog.info("Ignoring #{user}/#{name} due to --metrics")
104
105
  next
105
106
  end
106
107
  type = "Cobench::#{name.capitalize}"
107
- loog.info("Reading #{u}/#{name}...")
108
+ loog.info("Reading #{user}/#{name}...")
108
109
  require_relative f
109
110
  m = type.split('::').reduce(Module, :const_get).new(api, u, opts)
110
111
  if opts.dry?
@@ -122,7 +123,7 @@ begin
122
123
  before += data[u][d[:title]][:total] if data[u][d[:title]] != nil
123
124
  data[u][d[:title]] = { total: d[:total] + before, href: d[:href] }
124
125
  titles[d[:title]] = d[:title]
125
- loog.info("The value of #{u}/#{d[:title]} is #{d[:total]}")
126
+ loog.info("The value of #{user}/#{d[:title]} is #{d[:total]}")
126
127
  end
127
128
  end
128
129
  end
data/lib/cobench/mask.rb CHANGED
@@ -24,11 +24,11 @@
24
24
  # License:: MIT
25
25
  class Cobench::Mask
26
26
  def initialize(txt)
27
- @org, @repo = txt.split('/')
27
+ @org, @repo = txt.downcase.split('/')
28
28
  end
29
29
 
30
30
  def matches?(repo)
31
- org, repo = repo.split('/')
31
+ org, repo = repo.downcase.split('/')
32
32
  return false if ['', nil].include?(org)
33
33
  return false if ['', nil].include?(repo)
34
34
  return false if org != @org && @org != '*'
@@ -23,5 +23,5 @@
23
23
  # Copyright:: Copyright (c) 2022 Yegor Bugayenko
24
24
  # License:: MIT
25
25
  module Cobench
26
- VERSION = '0.0.13'.freeze
26
+ VERSION = '0.0.14'.freeze
27
27
  end
data/test/test_mask.rb CHANGED
@@ -28,8 +28,8 @@ require_relative '../lib/cobench/mask'
28
28
  class TestMask < Minitest::Test
29
29
  def test_positive
30
30
  assert Cobench::Mask.new('*/*').matches?('foo/bar')
31
- assert Cobench::Mask.new('test/*').matches?('test/one')
32
- assert Cobench::Mask.new('test/hello').matches?('test/hello')
31
+ assert Cobench::Mask.new('test/*').matches?('Test/one')
32
+ assert Cobench::Mask.new('test/hello').matches?('test/Hello')
33
33
  end
34
34
 
35
35
  def test_negative
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.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko