mirror of
https://github.com/jimeh/build-emacs-for-macos.git
synced 2026-02-19 13:06:38 +00:00
53 lines
1.1 KiB
Ruby
Executable File
53 lines
1.1 KiB
Ruby
Executable File
#!/usr/bin/env ruby
|
|
# frozen_string_literal: true
|
|
|
|
require 'optparse'
|
|
|
|
require_relative '../lib/commit_info'
|
|
require_relative '../lib/errors'
|
|
require_relative '../lib/log'
|
|
|
|
options = {
|
|
repo: 'emacs-mirror/emacs',
|
|
output: File.expand_path('../tarballs', __dir__),
|
|
log_level: :info
|
|
}
|
|
|
|
OptionParser.new do |opts|
|
|
opts.banner = <<~TXT
|
|
Usage: ./commit-info [options] <branch/tag/sha>
|
|
|
|
Fetch commit info of given GitHub repository branch, tag, or SHA.
|
|
|
|
Options:
|
|
TXT
|
|
|
|
opts.on('-r', '--repo STRING',
|
|
"GitHub repository (default: #{options[:repo]})") do |v|
|
|
options[:repo] = v
|
|
end
|
|
|
|
opts.on('-o', '--output DIR', 'Directory to save tarball in ' \
|
|
"(default: #{options[:output]})") do |v|
|
|
options[:output] = v
|
|
end
|
|
|
|
opts.on('-l', '--log-level LEVEL', 'Log level ' \
|
|
"(default: #{options[:log_level]})") do |v|
|
|
options[:log_level] = v.to_sym
|
|
end
|
|
end.parse!
|
|
|
|
begin
|
|
logger = Log.new('commit-info', options[:log_level])
|
|
commit = CommitInfo.new(
|
|
ref: ARGV[0],
|
|
repo: options[:repo],
|
|
logger: logger
|
|
).perform
|
|
|
|
puts commit.to_yaml
|
|
rescue Error => e
|
|
handle_error(e)
|
|
end
|