diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ffc7b6a --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +language: crystal diff --git a/README.md b/README.md index 5c32935..2093558 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ -# Compiled License +# compiled_license -*A fork of [elorest's library](https://github.com/elorest/compiled_license).* - -Compiles the licences of all shards used in project into binary. -This allows you to legally distribute binaries without having to package the licenses files from the shards. +TODO: Write a description here ## Installation @@ -12,28 +9,24 @@ Add this to your application's `shard.yml`: ```yaml dependencies: compiled_license: - git: https://git.dergrimm.net/dergrimm/compiled_license.git + github: elorest/compiled_license ``` ## Usage ```crystal require "compiled_license" - -puts CompiledLicense::LICENSES ``` -Compile and run +TODO: Write usage instructions here -``` -$ crystal build src/testapp.cr -$ testapp -# Returns all licenses to stdout -``` +## Development + +TODO: Write development instructions here ## Contributing -1. Fork it ( https://github.com/grimmigerFuchs/compiled_license/fork ) +1. Fork it ( https://github.com/elorest/compiled_license/fork ) 2. Create your feature branch (git checkout -b my-new-feature) 3. Commit your changes (git commit -am 'Add some feature') 4. Push to the branch (git push origin my-new-feature) @@ -42,4 +35,3 @@ $ testapp ## Contributors - [elorest](https://github.com/elorest) Isaac Sloan - creator, maintainer -- [grimmigerFuchs](https://git.dergrimm.net/dergrimm) - contributor diff --git a/shard.yml b/shard.yml index 73e048c..1d9e463 100644 --- a/shard.yml +++ b/shard.yml @@ -1,15 +1,13 @@ name: compiled_license -version: 2.0.0 +version: 0.1.2 authors: - Isaac Sloan - - grimmigerFuchs -crystal: 1.2.1 +crystal: 0.24.1 license: MIT dependencies: - version: - github: unn4m3d/version - version: 0.1.1 + cry: + github: elorest/cry diff --git a/spec/compiled_license_spec.cr b/spec/compiled_license_spec.cr index 0d7e535..cb3364c 100644 --- a/spec/compiled_license_spec.cr +++ b/spec/compiled_license_spec.cr @@ -1,15 +1,14 @@ -require "spec" -require "../src/compiled_license" +require "./spec_helper" describe CompiledLicense do - licenses = CompiledLicense::LICENSES + licenses = {{ run("../src/compiled_license/licenses.cr").stringify }} 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 @@ -18,6 +17,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 diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr new file mode 100644 index 0000000..999c873 --- /dev/null +++ b/spec/spec_helper.cr @@ -0,0 +1,2 @@ +require "spec" +require "../src/compiled_license" diff --git a/src/compiled_license.cr b/src/compiled_license.cr index 10e8103..bd3852a 100644 --- a/src/compiled_license.cr +++ b/src/compiled_license.cr @@ -1,7 +1,14 @@ -require "version" +require "./compiled_license/version" -module CompiledLicense - VERSION = Version.fetch - - LICENSES = {{ run("./compiled_license/licenses.cr").stringify }} +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 end diff --git a/src/compiled_license/licenses.cr b/src/compiled_license/licenses.cr index 4f5765e..d72e2ad 100644 --- a/src/compiled_license/licenses.cr +++ b/src/compiled_license/licenses.cr @@ -1,21 +1,19 @@ -DELIMITER = "================================================================================" - -LICENSES = String.build do |s| +licenses = String.build do |s| if File.exists?("./LICENSE") - s.puts Dir.current.split("/").last - s.puts DELIMITER + s.puts Dir.current.split("/").last.capitalize + s.puts "================================================================================" s.puts File.read("./LICENSE") - s.puts DELIMITER + 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 - s.puts DELIMITER + s.puts path.match(/^\.\/lib\/([^\/]+)\//).try(&.[1]).to_s.capitalize + s.puts "================================================================================" s.puts File.read(path) - s.puts DELIMITER + s.puts "================================================================================" s.puts "\n\n" end end -puts LICENSES +puts licenses diff --git a/src/compiled_license/version.cr b/src/compiled_license/version.cr new file mode 100644 index 0000000..f067864 --- /dev/null +++ b/src/compiled_license/version.cr @@ -0,0 +1,3 @@ +module CompiledLicense + VERSION = "0.1.2" +end