Sha256: 7a883ee09215782313b2b6b6673826ecd9344a59c55a0491fa8bd32cd2151d34
Contents?: true
Size: 1.96 KB
Versions: 50
Compression:
Stored size: 1.96 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'date' require 'optparse' require 'pry' require_relative '../lib/github_repo_statistics/version' require_relative '../lib/github_repo_statistics/force_merge_report' require_relative '../lib/github_repo_statistics/review_report' options = {} OptionParser.new do |opts| opts.banner = 'Usage: github_repo_statistics [options]' opts.on('--duration-in-days STRING', 'Number of days to aggregate the changes for [default: 90]') do |duration_in_days| options[:duration_in_days] = duration_in_days.to_i end opts.on('--default-branch STRING', 'The default branch to pull and run metrics for [default: master]') do |default_branch| options[:default_branch] = default_branch end opts.on('--github-token STRING', 'GitHub API token [default: ""]') do |github_token| options[:github_token] = github_token end opts.on('--github-repo STRING', 'GitHub repository name and owner (e.g. octokit/octokit) [default: ""]') do |github_repo| options[:github_repo] = github_repo end opts.on('-v', '--version', 'Display the version of the gem') do puts "github_repo_statistics version #{GithubRepoStatistics::VERSION}" exit end opts.on('-h', '--help', 'Display this help message') do puts opts puts <<~EXAMPLES Examples: review_report --github-token ghp_bKasj29ndkfdksf3rjt2ngi43j --github-repo octokit/octokit EXAMPLES exit end end.parse! DEFAULT_BRANCH = options[:default_branch] || 'master' raise 'Please provide GitHub token using --github-token flag' if options[:github_token].nil? raise 'Please provide GitHub repo name using --github-repo flag' if options[:github_repo].nil? raise 'Please provide default GitHub branch using --default-branch flag' if DEFAULT_BRANCH.nil? ReviewReport.new(token: options[:github_token], repo: options[:github_repo], branch: DEFAULT_BRANCH, duration: options[:duration_in_days] || 30).report
Version data entries
50 entries across 50 versions & 1 rubygems