bin/cobench in cobench-0.0.13 vs bin/cobench in cobench-0.0.14

- old
+ new

@@ -54,11 +54,11 @@ o.array '--metrics', 'Names of metrics to use (all by default)' o.array '--include', 'Mask of GitHub repo to include, e.g. yegor256/*' o.array '--exclude', 'Mask of GitHub repo to exclude' end -if opts.help? +if opts.help? || opts[:coder].empty? puts opts exit end if opts.verbose? @@ -93,20 +93,21 @@ api.auto_paginate = true api = Obk.new(api, pause: 2000) loog.info("Reading GitHub data for the last #{opts[:days]} days") titles = {} opts[:coder].each do |u| - loog.info("Scanning #{u}...") - data[u] = {} + user = u.downcase + loog.info("Scanning #{user}...") + data[user] = {} Dir[File.join(__dir__, '../lib/cobench/metrics/*.rb')].each do |f| name = File::basename(f).split('.')[0] if !opts[:metrics].empty? && !opts[:metrics].include?(name) - loog.info("Ignoring #{u}/#{name} due to --metrics") + loog.info("Ignoring #{user}/#{name} due to --metrics") next end type = "Cobench::#{name.capitalize}" - loog.info("Reading #{u}/#{name}...") + loog.info("Reading #{user}/#{name}...") require_relative f m = type.split('::').reduce(Module, :const_get).new(api, u, opts) if opts.dry? measures = [ { title: 'Issues', total: Random.new.rand(100), href: 'https://github.com/' }, @@ -120,10 +121,10 @@ measures.each do |d| before = 0 before += data[u][d[:title]][:total] if data[u][d[:title]] != nil data[u][d[:title]] = { total: d[:total] + before, href: d[:href] } titles[d[:title]] = d[:title] - loog.info("The value of #{u}/#{d[:title]} is #{d[:total]}") + loog.info("The value of #{user}/#{d[:title]} is #{d[:total]}") end end end data.each do |u, ms| score = ms.map do |t, h|