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 +0,0 @@
language: crystal

View File

@ -3,7 +3,8 @@ version: 1.0.0
authors:
- Isaac Sloan <isaac@isaacsloan.com>
- grimmigerFuchs <dominic.grimm@gmail.com>
crystal: "> 0.24.1, < 1.1.0"
crystal: 1.20.1
license: MIT

View File

@ -1,14 +1,15 @@
require "./spec_helper"
require "spec"
require "../src/compiled_license"
describe CompiledLicense do
licenses = {{ run("../src/compiled_license/licenses.cr").stringify }}
licenses = CompiledLicense::LICENSES
it "should return string" do
(licenses.size > 20).should be_true
end
it "should include license of current file" do
licenses.should contain("Compiled_license")
licenses.should contain("compiled_license")
end
it "should contain name of author from license file" do
@ -17,6 +18,6 @@ describe CompiledLicense do
it "should contain more than one license" do
delimiter = "\n\n"
(licenses.split(delimiter).size > 1).should be_true
(licenses.split(delimiter).size > 1).should be_true
end
end

View File

@ -1,2 +0,0 @@
require "spec"
require "../src/compiled_license"

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