This commit is contained in:
Dominic Grimm 2021-10-23 12:17:50 +02:00
parent ba052e31f8
commit 22ab96d7d0
7 changed files with 20 additions and 31 deletions

View file

@ -1,14 +1,5 @@
require "./compiled_license/version"
module CompiledLicense
VERSION = {{ `shards version`.stringify.chomp }}
module Compiled
module License
def self.display
{{ run("./compiled_license/licenses.cr").stringify }}
end
end
end
if ARGV[0]? && ARGV[0]? == "--licenses"
puts Compiled::License.display
exit 0
LICENSES = {{ run("./compiled_license/licenses.cr").stringify }}
end

View file

@ -1,19 +1,21 @@
licenses = String.build do |s|
DELIMITER = "================================================================================"
LICENSES = String.build do |s|
if File.exists?("./LICENSE")
s.puts Dir.current.split("/").last.capitalize
s.puts "================================================================================"
s.puts Dir.current.split("/").last
s.puts DELIMITER
s.puts File.read("./LICENSE")
s.puts "================================================================================"
s.puts DELIMITER
s.puts "\n\n"
end
Dir.glob("./lib/*/LICENSE", "./lib/*/license").each do |path|
s.puts path.match(/^\.\/lib\/([^\/]+)\//).try(&.[1]).to_s.capitalize
s.puts "================================================================================"
s.puts path.match(/^\.\/lib\/([^\/]+)\//).try(&.[1]).to_s
s.puts DELIMITER
s.puts File.read(path)
s.puts "================================================================================"
s.puts DELIMITER
s.puts "\n\n"
end
end
puts licenses
puts LICENSES

View file

@ -1,3 +0,0 @@
module CompiledLicense
VERSION = "1.0.0"
end