Compare commits

..

No commits in common. "master" and "v0.1.2" have entirely different histories.

8 changed files with 42 additions and 42 deletions

1
.travis.yml Normal file
View file

@ -0,0 +1 @@
language: crystal

View file

@ -1,9 +1,6 @@
# Compiled License # compiled_license
*A fork of [elorest's library](https://github.com/elorest/compiled_license).* TODO: Write a description here
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.
## Installation ## Installation
@ -12,28 +9,24 @@ Add this to your application's `shard.yml`:
```yaml ```yaml
dependencies: dependencies:
compiled_license: compiled_license:
git: https://git.dergrimm.net/dergrimm/compiled_license.git github: elorest/compiled_license
``` ```
## Usage ## Usage
```crystal ```crystal
require "compiled_license" require "compiled_license"
puts CompiledLicense::LICENSES
``` ```
Compile and run TODO: Write usage instructions here
``` ## Development
$ crystal build src/testapp.cr
$ testapp TODO: Write development instructions here
# Returns all licenses to stdout
```
## Contributing ## 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) 2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature') 3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature) 4. Push to the branch (git push origin my-new-feature)
@ -42,4 +35,3 @@ $ testapp
## Contributors ## Contributors
- [elorest](https://github.com/elorest) Isaac Sloan - creator, maintainer - [elorest](https://github.com/elorest) Isaac Sloan - creator, maintainer
- [grimmigerFuchs](https://git.dergrimm.net/dergrimm) - contributor

View file

@ -1,15 +1,13 @@
name: compiled_license name: compiled_license
version: 2.0.0 version: 0.1.2
authors: authors:
- Isaac Sloan <isaac@isaacsloan.com> - Isaac Sloan <isaac@isaacsloan.com>
- grimmigerFuchs <dominic.grimm@gmail.com>
crystal: 1.2.1 crystal: 0.24.1
license: MIT license: MIT
dependencies: dependencies:
version: cry:
github: unn4m3d/version github: elorest/cry
version: 0.1.1

View file

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

2
spec/spec_helper.cr Normal file
View file

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

View file

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

View file

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

View file

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