specs
This commit is contained in:
parent
5612dfa4df
commit
09fdd517bd
4 changed files with 30 additions and 5 deletions
|
@ -7,3 +7,7 @@ authors:
|
|||
crystal: 0.24.1
|
||||
|
||||
license: MIT
|
||||
|
||||
dependencies:
|
||||
cry:
|
||||
github: elorest/cry
|
||||
|
|
|
@ -1,9 +1,22 @@
|
|||
require "./spec_helper"
|
||||
|
||||
describe CompiledLicense do
|
||||
# TODO: Write tests
|
||||
licenses = {{ run("../src/compiled_license/licenses.cr").stringify }}
|
||||
|
||||
it "works" do
|
||||
false.should eq(true)
|
||||
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")
|
||||
end
|
||||
|
||||
it "should contain name of author from license file" do
|
||||
licenses.should contain("Isaac Sloan")
|
||||
end
|
||||
|
||||
it "should contain more than one license" do
|
||||
delimiter = "\n\n"
|
||||
(licenses.split(delimiter).size > 1).should be_true
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,12 +3,12 @@ require "./compiled_license/version"
|
|||
module Compiled
|
||||
module License
|
||||
def self.display
|
||||
{{ run("../compiled_license/licenses.cr").stringify }}
|
||||
{{ run("./compiled_license/licenses.cr").stringify }}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ARGV[0]? && ARGV[0]? == "--license"
|
||||
puts Amber::Support::Licenses.display
|
||||
puts Compiled::License.display
|
||||
exit 0
|
||||
end
|
||||
|
|
|
@ -1,4 +1,12 @@
|
|||
licenses = String.build do |s|
|
||||
if File.exists?("./LICENSE")
|
||||
s.puts Dir.current.split("/").last.capitalize
|
||||
s.puts "================================================================================"
|
||||
s.puts File.read("./LICENSE")
|
||||
s.puts "================================================================================"
|
||||
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 "================================================================================"
|
||||
|
|
Loading…
Reference in a new issue