1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'dotenv/load'
require 'thor'
require 'json'
require 'licensee'
class LicenseeCLI < Thor
package_name 'Licensee'
class_option :remote, type: :boolean, desc: 'Assume PATH is a GitHub owner/repo path'
default_task :detect
def self.exit_on_failure?
true
end
private
def path
@path ||= if !options[:remote] || args.first =~ %r{^https://}
args.first || Dir.pwd
else
"https://github.com/#{args.first}"
end
end
def project
@project ||= Licensee.project(path,
detect_packages: options[:packages],
detect_readme: options[:readme],
ref: options[:ref])
end
def remote?
path =~ %r{^https://}
end
end
commands_dir = File.expand_path '../lib/licensee/commands/', __dir__
Dir["#{commands_dir}/*.rb"].each { |c| require(c) }
LicenseeCLI.start(ARGV)
|