licensee 0.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/README.md +4 -2
 - data/bin/licensee +3 -3
 - data/lib/licensee.rb +2 -12
 - data/lib/licensee/license.rb +9 -8
 - data/lib/licensee/license_file.rb +22 -51
 - data/lib/licensee/licenses.rb +1 -1
 - data/lib/licensee/project.rb +25 -5
 - data/lib/licensee/version.rb +1 -1
 - data/test/fixtures/licenses.git/HEAD +1 -0
 - data/test/fixtures/licenses.git/config +4 -0
 - data/test/fixtures/licenses.git/objects/info/packs +2 -0
 - data/test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.idx +0 -0
 - data/test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.pack +0 -0
 - data/test/fixtures/licenses.git/packed-refs +4 -0
 - data/test/functions.rb +61 -0
 - data/test/helper.rb +1 -8
 - data/test/test_licensee.rb +2 -2
 - data/test/test_licensee_bin.rb +2 -2
 - data/test/test_licensee_license.rb +1 -1
 - data/test/test_licensee_license_file.rb +8 -24
 - data/test/test_licensee_licenses.rb +2 -2
 - data/test/test_licensee_project.rb +1 -1
 - data/test/test_licensee_vendor.rb +17 -0
 - metadata +44 -53
 - data/test/fixtures/md/LICENSE.md +0 -21
 - data/test/fixtures/simple/LICENSE +0 -21
 - data/test/fixtures/txt/LICENSE.txt +0 -21
 - data/vendor/choosealicense.com/_licenses/no-license.txt +0 -28
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 9b45a6b8c2dada9497081deeb9647043ee37c0a8
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: bcbf1d51786773643525e8683fd98ee13b0c9971
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fc8fdb2c8c0576470179896e7a8c2fd5c63cd641aa1fcf2a5699d56a7fbb6972ea7a9a4a59edde88071b38dd9b5b1df62796f0d14acfa18a20fca953198c1ea0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 41e76bb395c9bf949cbf6a78da120854c3512d12db9628f3e814ac0471343f92847231813059481a83fd793fddbcbce6c315ee26b55fe30428499a4ea6cd1671
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -12,12 +12,14 @@ 
     | 
|
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            ## The solution
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
            Licensee automates the process of reading `LICENSE` files and compares their contents to known licenses using a fancy math thing called the [ 
     | 
| 
      
 15 
     | 
    
         
            +
            Licensee automates the process of reading `LICENSE` files and compares their contents to known licenses using a fancy math thing called the [Rabin-Karp rolling-hashes](https://en.wikipedia.org/wiki/Rabin%E2%80%93Karp_algorithm), the same mechanism Git itself uses to compute changes between files. In fact, Licensee just uses Git.
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            By calculating the percent changed from the known license, you can tell, e.g., that a given license is 98% similar to the MIT license, that 2% likely representing the copyright line being properly adapted to the project.
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            Licensee will even diff the distributed license with the original, so you can see exactly what, if anything's been changed.
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
            *Special thanks to [@vmg](https://github.com/vmg) for his Git prowess.*
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       21 
23 
     | 
    
         
             
            ## Installation
         
     | 
| 
       22 
24 
     | 
    
         | 
| 
       23 
25 
     | 
    
         
             
            `gem install licensee` or add `gem 'licensee'` to your project's `Gemfile`.
         
     | 
| 
         @@ -69,7 +71,7 @@ You'll get an output that looks like: 
     | 
|
| 
       69 
71 
     | 
    
         | 
| 
       70 
72 
     | 
    
         
             
            ```
         
     | 
| 
       71 
73 
     | 
    
         
             
            License: MIT
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 74 
     | 
    
         
            +
            Confidence: 98.42%
         
     | 
| 
       73 
75 
     | 
    
         
             
            ```
         
     | 
| 
       74 
76 
     | 
    
         | 
| 
       75 
77 
     | 
    
         
             
            ## What it looks at
         
     | 
    
        data/bin/licensee
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #!/usr/bin/env ruby
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require_relative "../lib/licensee"
         
     | 
| 
       4 
     | 
    
         
            -
            license = Licensee. 
     | 
| 
      
 4 
     | 
    
         
            +
            license = Licensee::Project.new(Dir.pwd).license_file
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            if license
         
     | 
| 
       7 
     | 
    
         
            -
              puts "License: #{license.meta[ 
     | 
| 
       8 
     | 
    
         
            -
              puts " 
     | 
| 
      
 7 
     | 
    
         
            +
              puts "License: #{license.match ? license.match.meta['title'] : 'no license'}"
         
     | 
| 
      
 8 
     | 
    
         
            +
              puts "Confidence: #{license.confidence}%"
         
     | 
| 
       9 
9 
     | 
    
         
             
            else
         
     | 
| 
       10 
10 
     | 
    
         
             
              puts "Unknown"
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
    
        data/lib/licensee.rb
    CHANGED
    
    | 
         @@ -1,6 +1,5 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'levenshtein-ffi'
         
     | 
| 
       2 
1 
     | 
    
         
             
            require 'yaml'
         
     | 
| 
       3 
     | 
    
         
            -
            require ' 
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rugged'
         
     | 
| 
       4 
3 
     | 
    
         | 
| 
       5 
4 
     | 
    
         
             
            require_relative "licensee/license"
         
     | 
| 
       6 
5 
     | 
    
         
             
            require_relative "licensee/licenses"
         
     | 
| 
         @@ -8,8 +7,7 @@ require_relative "licensee/license_file" 
     | 
|
| 
       8 
7 
     | 
    
         
             
            require_relative "licensee/project"
         
     | 
| 
       9 
8 
     | 
    
         | 
| 
       10 
9 
     | 
    
         
             
            class Licensee
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              CONFIDENCE_THRESHOLD = ".90".to_f
         
     | 
| 
      
 10 
     | 
    
         
            +
              CONFIDENCE_THRESHOLD = 90
         
     | 
| 
       13 
11 
     | 
    
         | 
| 
       14 
12 
     | 
    
         
             
              def self.licenses
         
     | 
| 
       15 
13 
     | 
    
         
             
                Licensee::Licenses.list
         
     | 
| 
         @@ -18,12 +16,4 @@ class Licensee 
     | 
|
| 
       18 
16 
     | 
    
         
             
              def self.license(path)
         
     | 
| 
       19 
17 
     | 
    
         
             
                Licensee::Project.new(path).license
         
     | 
| 
       20 
18 
     | 
    
         
             
              end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
              def self.matches(path)
         
     | 
| 
       23 
     | 
    
         
            -
                Licensee::Project.new(path).matches
         
     | 
| 
       24 
     | 
    
         
            -
              end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
              def self.diff(path, options=nil)
         
     | 
| 
       27 
     | 
    
         
            -
                Licensee::Project.new(path).license_file.diff(options)
         
     | 
| 
       28 
     | 
    
         
            -
              end
         
     | 
| 
       29 
19 
     | 
    
         
             
            end
         
     | 
    
        data/lib/licensee/license.rb
    CHANGED
    
    | 
         @@ -1,11 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class Licensee
         
     | 
| 
       2 
2 
     | 
    
         
             
              class License
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
3 
     | 
    
         
             
                attr_reader :name
         
     | 
| 
       5 
     | 
    
         
            -
                attr_accessor :match
         
     | 
| 
       6 
4 
     | 
    
         | 
| 
       7 
5 
     | 
    
         
             
                def initialize(name)
         
     | 
| 
       8 
     | 
    
         
            -
                  @name=name
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @name=name.downcase
         
     | 
| 
       9 
7 
     | 
    
         
             
                end
         
     | 
| 
       10 
8 
     | 
    
         | 
| 
       11 
9 
     | 
    
         
             
                def path
         
     | 
| 
         @@ -17,7 +15,7 @@ class Licensee 
     | 
|
| 
       17 
15 
     | 
    
         
             
                end
         
     | 
| 
       18 
16 
     | 
    
         | 
| 
       19 
17 
     | 
    
         
             
                def parts
         
     | 
| 
       20 
     | 
    
         
            -
                  @parts ||= content.match 
     | 
| 
      
 18 
     | 
    
         
            +
                  @parts ||= content.match(/^(---\n.*\n---)?(.*)/m).to_a
         
     | 
| 
       21 
19 
     | 
    
         
             
                end
         
     | 
| 
       22 
20 
     | 
    
         | 
| 
       23 
21 
     | 
    
         
             
                def meta
         
     | 
| 
         @@ -34,12 +32,15 @@ class Licensee 
     | 
|
| 
       34 
32 
     | 
    
         
             
                  @body ||= parts[2]
         
     | 
| 
       35 
33 
     | 
    
         
             
                end
         
     | 
| 
       36 
34 
     | 
    
         
             
                alias_method :to_s, :body
         
     | 
| 
      
 35 
     | 
    
         
            +
                alias_method :text, :body
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                def hashsig
         
     | 
| 
      
 38 
     | 
    
         
            +
                  @hashsig ||= Rugged::Blob::HashSignature.new(
         
     | 
| 
      
 39 
     | 
    
         
            +
                    body, Rugged::Blob::HashSignature::WHITESPACE_SMART)
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
       37 
41 
     | 
    
         | 
| 
       38 
42 
     | 
    
         
             
                def inspect
         
     | 
| 
       39 
     | 
    
         
            -
                   
     | 
| 
       40 
     | 
    
         
            -
                  s += " match=#{match}" if match
         
     | 
| 
       41 
     | 
    
         
            -
                  s += ">"
         
     | 
| 
       42 
     | 
    
         
            -
                  s
         
     | 
| 
      
 43 
     | 
    
         
            +
                  "#<Licensee::License name=\"#{name}\">"
         
     | 
| 
       43 
44 
     | 
    
         
             
                end
         
     | 
| 
       44 
45 
     | 
    
         
             
              end
         
     | 
| 
       45 
46 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,78 +1,49 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class Licensee
         
     | 
| 
       2 
2 
     | 
    
         
             
              class LicenseFile
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_reader :blob
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
       5 
     | 
    
         
            -
                   
     | 
| 
       6 
     | 
    
         
            -
                   
     | 
| 
       7 
     | 
    
         
            -
                  LICENSE.md
         
     | 
| 
       8 
     | 
    
         
            -
                  UNLICENSE
         
     | 
| 
       9 
     | 
    
         
            -
                ]
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                attr_reader :path
         
     | 
| 
       12 
     | 
    
         
            -
                attr_accessor :contents
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                def initialize(path=nil)
         
     | 
| 
       15 
     | 
    
         
            -
                  @path = File.expand_path(path) unless path.nil?
         
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(blob)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @blob = blob
         
     | 
| 
      
 7 
     | 
    
         
            +
                  blob.hashsig(Rugged::Blob::HashSignature::WHITESPACE_SMART)
         
     | 
| 
       16 
8 
     | 
    
         
             
                end
         
     | 
| 
       17 
9 
     | 
    
         | 
| 
       18 
10 
     | 
    
         
             
                def contents
         
     | 
| 
       19 
     | 
    
         
            -
                  @contents ||=  
     | 
| 
      
 11 
     | 
    
         
            +
                  @contents ||= blob.content
         
     | 
| 
       20 
12 
     | 
    
         
             
                end
         
     | 
| 
       21 
13 
     | 
    
         
             
                alias_method :to_s, :contents
         
     | 
| 
       22 
14 
     | 
    
         
             
                alias_method :content, :contents
         
     | 
| 
       23 
15 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                def self.find(base_path)
         
     | 
| 
       25 
     | 
    
         
            -
                  raise "Invalid directory" unless directory_exists? base_path
         
     | 
| 
       26 
     | 
    
         
            -
                  file = self::FILENAMES.find { |file| file_exists?(file, base_path) }
         
     | 
| 
       27 
     | 
    
         
            -
                  new(File.expand_path(file, base_path)) if file
         
     | 
| 
       28 
     | 
    
         
            -
                end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
       30 
     | 
    
         
            -
                def self.directory_exists?(base_path)
         
     | 
| 
       31 
     | 
    
         
            -
                  File.directory?(base_path)
         
     | 
| 
       32 
     | 
    
         
            -
                end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                def self.file_exists?(file, base_path)
         
     | 
| 
       35 
     | 
    
         
            -
                  File.exists? File.expand_path(file, base_path)
         
     | 
| 
       36 
     | 
    
         
            -
                end
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
16 
     | 
    
         
             
                def length
         
     | 
| 
       39 
     | 
    
         
            -
                  @length ||=  
     | 
| 
      
 17 
     | 
    
         
            +
                  @length ||= blob.size
         
     | 
| 
       40 
18 
     | 
    
         
             
                end
         
     | 
| 
       41 
19 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                def  
     | 
| 
       43 
     | 
    
         
            -
                   
     | 
| 
      
 20 
     | 
    
         
            +
                def matches
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @matches ||= Licensee::Licenses.list.map { |l| [l, calculate_similarity(l)] }
         
     | 
| 
       44 
22 
     | 
    
         
             
                end
         
     | 
| 
       45 
23 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
                def  
     | 
| 
       47 
     | 
    
         
            -
                  @ 
     | 
| 
      
 24 
     | 
    
         
            +
                def match_info
         
     | 
| 
      
 25 
     | 
    
         
            +
                  @match_info ||= matches.max_by { |license, similarity| similarity }
         
     | 
| 
       48 
26 
     | 
    
         
             
                end
         
     | 
| 
       49 
27 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                def  
     | 
| 
       51 
     | 
    
         
            -
                   
     | 
| 
      
 28 
     | 
    
         
            +
                def match
         
     | 
| 
      
 29 
     | 
    
         
            +
                  match_info ? match_info[0] : nil
         
     | 
| 
       52 
30 
     | 
    
         
             
                end
         
     | 
| 
       53 
31 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                def  
     | 
| 
       55 
     | 
    
         
            -
                   
     | 
| 
       56 
     | 
    
         
            -
                    licenses_sorted.each { |l| l.match = 1 - percent_changed(l) }
         
     | 
| 
       57 
     | 
    
         
            -
                    licenses_sorted.sort_by { |l| l.match }.select { |l| l.match > 0}.reverse
         
     | 
| 
       58 
     | 
    
         
            -
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
                def confidence
         
     | 
| 
      
 33 
     | 
    
         
            +
                  match_info ? match_info[1] : nil
         
     | 
| 
       59 
34 
     | 
    
         
             
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
                alias_method :similarity, :confidence
         
     | 
| 
       60 
36 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                def  
     | 
| 
       62 
     | 
    
         
            -
                   
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
                    next unless confidence >= Licensee::CONFIDENCE_THRESHOLD
         
     | 
| 
       65 
     | 
    
         
            -
                    license.match = confidence
         
     | 
| 
       66 
     | 
    
         
            -
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
                def diff(options={})
         
     | 
| 
      
 38 
     | 
    
         
            +
                  options = options.merge(:reverse => true)
         
     | 
| 
      
 39 
     | 
    
         
            +
                  blob.diff(match.body, options).to_s if match
         
     | 
| 
       67 
40 
     | 
    
         
             
                end
         
     | 
| 
       68 
41 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                 
     | 
| 
       70 
     | 
    
         
            -
                  (Levenshtein.distance(content, license.body).to_f / content.length.to_f).abs
         
     | 
| 
       71 
     | 
    
         
            -
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
                private
         
     | 
| 
       72 
43 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                 
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
      
 44 
     | 
    
         
            +
                # Pulled out for easier testing
         
     | 
| 
      
 45 
     | 
    
         
            +
                def calculate_similarity(other)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  blob.similarity(other.hashsig)
         
     | 
| 
       75 
47 
     | 
    
         
             
                end
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
48 
     | 
    
         
             
              end
         
     | 
| 
       78 
49 
     | 
    
         
             
            end
         
     | 
    
        data/lib/licensee/licenses.rb
    CHANGED
    
    
    
        data/lib/licensee/project.rb
    CHANGED
    
    | 
         @@ -1,15 +1,35 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class Licensee
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Project
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_reader :repository
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 5 
     | 
    
         
            +
                VALID_FILENAMES = %w[
         
     | 
| 
      
 6 
     | 
    
         
            +
                  LICENSE
         
     | 
| 
      
 7 
     | 
    
         
            +
                  LICENSE.txt
         
     | 
| 
      
 8 
     | 
    
         
            +
                  LICENSE.md
         
     | 
| 
      
 9 
     | 
    
         
            +
                  UNLICENSE
         
     | 
| 
      
 10 
     | 
    
         
            +
                  COPYING
         
     | 
| 
      
 11 
     | 
    
         
            +
                ]
         
     | 
| 
       5 
12 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
                def initialize( 
     | 
| 
       7 
     | 
    
         
            -
                   
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
                def initialize(path_or_repo, revision = nil)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  if path_or_repo.kind_of? Rugged::Repository
         
     | 
| 
      
 15 
     | 
    
         
            +
                    @repository = path_or_repo
         
     | 
| 
      
 16 
     | 
    
         
            +
                  else
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @repository = Rugged::Repository.new(path_or_repo)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  @revision = revision
         
     | 
| 
       9 
21 
     | 
    
         
             
                end
         
     | 
| 
       10 
22 
     | 
    
         | 
| 
       11 
23 
     | 
    
         
             
                def license_file
         
     | 
| 
       12 
     | 
    
         
            -
                  @license_file  
     | 
| 
      
 24 
     | 
    
         
            +
                  return @license_file if defined? @license_file
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  commit = @revision ? @repository.lookup(@revision) : @repository.last_commit
         
     | 
| 
      
 27 
     | 
    
         
            +
                  license_blob = commit.tree.each_blob { |blob| break blob if VALID_FILENAMES.include? blob[:name] }
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  @license_file = if license_blob
         
     | 
| 
      
 31 
     | 
    
         
            +
                    LicenseFile.new(@repository.lookup(license_blob[:oid]))
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
       13 
33 
     | 
    
         
             
                end
         
     | 
| 
       14 
34 
     | 
    
         | 
| 
       15 
35 
     | 
    
         
             
                def matches
         
     | 
    
        data/lib/licensee/version.rb
    CHANGED
    
    
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ref: refs/heads/master
         
     | 
    
        data/test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.idx
    ADDED
    
    | 
         Binary file 
     | 
    
        data/test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.pack
    ADDED
    
    | 
         Binary file 
     | 
    
        data/test/functions.rb
    ADDED
    
    | 
         @@ -0,0 +1,61 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Pulled from helper.rb because something in the test suite monkey patches benchmarking
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'securerandom'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            def fixtures_base
         
     | 
| 
      
 6 
     | 
    
         
            +
              File.expand_path "fixtures", File.dirname( __FILE__ )
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            def fixture_path(fixture)
         
     | 
| 
      
 10 
     | 
    
         
            +
              File.expand_path fixture, fixtures_base
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            def license_from_path(path)
         
     | 
| 
      
 14 
     | 
    
         
            +
              license = File.open(path).read.split("---").last
         
     | 
| 
      
 15 
     | 
    
         
            +
              license.sub! "[fullname]", "Ben Balter"
         
     | 
| 
      
 16 
     | 
    
         
            +
              license.sub! "[year]", "2014"
         
     | 
| 
      
 17 
     | 
    
         
            +
              license.sub! "[email]", "ben@github.invalid"
         
     | 
| 
      
 18 
     | 
    
         
            +
              license
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            class FakeBlob
         
     | 
| 
      
 22 
     | 
    
         
            +
              attr_reader :content
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              def initialize(content)
         
     | 
| 
      
 25 
     | 
    
         
            +
                @content = content
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              def size
         
     | 
| 
      
 29 
     | 
    
         
            +
                content.size
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              def similarity(other)
         
     | 
| 
      
 33 
     | 
    
         
            +
                Rugged::Blob::HashSignature.compare(self.hashsig, other)
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              def hashsig(options = 0)
         
     | 
| 
      
 37 
     | 
    
         
            +
                @hashsig ||= Rugged::Blob::HashSignature.new(content, options)
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            def chaos_monkey(string)
         
     | 
| 
      
 42 
     | 
    
         
            +
              lines = string.each_line.to_a
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              Random.rand(5).times do
         
     | 
| 
      
 45 
     | 
    
         
            +
                lines[Random.rand(lines.size)] = SecureRandom.base64(Random.rand(80)) + "\n"
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
              lines.join('')
         
     | 
| 
      
 49 
     | 
    
         
            +
            end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            def verify_license_file(license, chaos = false)
         
     | 
| 
      
 52 
     | 
    
         
            +
              expected = File.basename(license, ".txt")
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              text = license_from_path(license)
         
     | 
| 
      
 55 
     | 
    
         
            +
              blob = FakeBlob.new(chaos ? chaos_monkey(text) : text)
         
     | 
| 
      
 56 
     | 
    
         
            +
              license_file = Licensee::LicenseFile.new(blob)
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
              actual = license_file.match
         
     | 
| 
      
 59 
     | 
    
         
            +
              assert actual, "No match for #{expected}."
         
     | 
| 
      
 60 
     | 
    
         
            +
              assert_equal expected, actual.name, "expeceted #{expected} but got #{actual.name} for .match. Matches: #{license_file.matches}"
         
     | 
| 
      
 61 
     | 
    
         
            +
            end
         
     | 
    
        data/test/helper.rb
    CHANGED
    
    | 
         @@ -3,15 +3,8 @@ require 'bundler' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'minitest/autorun'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'shoulda'
         
     | 
| 
       5 
5 
     | 
    
         
             
            require 'open3'
         
     | 
| 
      
 6 
     | 
    
         
            +
            require_relative 'functions'
         
     | 
| 
       6 
7 
     | 
    
         | 
| 
       7 
8 
     | 
    
         
             
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            require 'licensee'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            def fixtures_base
         
     | 
| 
       12 
     | 
    
         
            -
              File.expand_path "fixtures", File.dirname( __FILE__ )
         
     | 
| 
       13 
     | 
    
         
            -
            end
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            def fixture_path(fixture)
         
     | 
| 
       16 
     | 
    
         
            -
              File.expand_path fixture, fixtures_base
         
     | 
| 
       17 
     | 
    
         
            -
            end
         
     | 
    
        data/test/test_licensee.rb
    CHANGED
    
    | 
         @@ -3,11 +3,11 @@ require 'helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            class TestLicensee < Minitest::Test
         
     | 
| 
       4 
4 
     | 
    
         
             
              should "know the licenses" do
         
     | 
| 
       5 
5 
     | 
    
         
             
                assert_equal Array, Licensee.licenses.class
         
     | 
| 
       6 
     | 
    
         
            -
                assert_equal  
     | 
| 
      
 6 
     | 
    
         
            +
                assert_equal 15, Licensee.licenses.size
         
     | 
| 
       7 
7 
     | 
    
         
             
                assert_equal Licensee::License, Licensee.licenses.first.class
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              should "detect a project's license" do
         
     | 
| 
       11 
     | 
    
         
            -
                assert_equal "mit", Licensee.license(fixture_path(" 
     | 
| 
      
 11 
     | 
    
         
            +
                assert_equal "mit", Licensee.license(fixture_path("licenses.git")).name
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         
             
            end
         
     | 
    
        data/test/test_licensee_bin.rb
    CHANGED
    
    | 
         @@ -5,7 +5,7 @@ class TestLicenseeBin < Minitest::Test 
     | 
|
| 
       5 
5 
     | 
    
         
             
                root = File.expand_path "..", File.dirname(__FILE__)
         
     | 
| 
       6 
6 
     | 
    
         
             
                Dir.chdir root
         
     | 
| 
       7 
7 
     | 
    
         
             
                stdout,stderr,status = Open3.capture3("#{root}/bin/licensee")
         
     | 
| 
       8 
     | 
    
         
            -
                assert stdout.include? "License: MIT"
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
      
 8 
     | 
    
         
            +
                assert stdout.include?("License: MIT"), "expected #{stdout} to include `License: MIT`"
         
     | 
| 
      
 9 
     | 
    
         
            +
                assert_equal 0, status
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
| 
         @@ -3,7 +3,9 @@ require 'helper' 
     | 
|
| 
       3 
3 
     | 
    
         
             
            class TestLicenseeLicenseFile < Minitest::Test
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              def setup
         
     | 
| 
       6 
     | 
    
         
            -
                @ 
     | 
| 
      
 6 
     | 
    
         
            +
                @repo = Rugged::Repository.new(fixture_path("licenses.git"))
         
     | 
| 
      
 7 
     | 
    
         
            +
                blob = 'bcb552d06d9cf1cd4c048a6d3bf716849c2216cc'
         
     | 
| 
      
 8 
     | 
    
         
            +
                @file = Licensee::LicenseFile.new(@repo.lookup(blob))
         
     | 
| 
       7 
9 
     | 
    
         
             
                @gpl = Licensee::Licenses.find "GPL-3.0"
         
     | 
| 
       8 
10 
     | 
    
         
             
                @mit = Licensee::Licenses.find "MIT"
         
     | 
| 
       9 
11 
     | 
    
         
             
              end
         
     | 
| 
         @@ -16,35 +18,17 @@ class TestLicenseeLicenseFile < Minitest::Test 
     | 
|
| 
       16 
18 
     | 
    
         
             
                assert_equal 1077, @file.length
         
     | 
| 
       17 
19 
     | 
    
         
             
              end
         
     | 
| 
       18 
20 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
              should " 
     | 
| 
       20 
     | 
    
         
            -
                 
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
              should "sort licenses by length delta" do
         
     | 
| 
       25 
     | 
    
         
            -
                assert_equal "mit", @file.licenses_sorted.first.name
         
     | 
| 
       26 
     | 
    
         
            -
                assert_equal "no-license", @file.licenses_sorted.last.name
         
     | 
| 
       27 
     | 
    
         
            -
              end
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
              should "calculate percent changed" do
         
     | 
| 
       30 
     | 
    
         
            -
                assert @file.percent_changed(@mit) < ".02".to_f
         
     | 
| 
       31 
     | 
    
         
            -
                assert @file.percent_changed(@gpl) > 30
         
     | 
| 
      
 21 
     | 
    
         
            +
              should "calculate similiarty" do
         
     | 
| 
      
 22 
     | 
    
         
            +
                actual = @file.send(:calculate_similarity, @mit)
         
     | 
| 
      
 23 
     | 
    
         
            +
                assert actual > Licensee::CONFIDENCE_THRESHOLD, "expected #{actual} to be > 90% for MIT"
         
     | 
| 
      
 24 
     | 
    
         
            +
                actual = @file.send(:calculate_similarity, @gpl)
         
     | 
| 
      
 25 
     | 
    
         
            +
                assert actual < 1, "expected #{actual} to be < 1% for GPL"
         
     | 
| 
       32 
26 
     | 
    
         
             
              end
         
     | 
| 
       33 
27 
     | 
    
         | 
| 
       34 
28 
     | 
    
         
             
              should "match the license" do
         
     | 
| 
       35 
29 
     | 
    
         
             
                assert_equal "mit", @file.match.name
         
     | 
| 
       36 
30 
     | 
    
         
             
              end
         
     | 
| 
       37 
31 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              should "match a txt license" do
         
     | 
| 
       39 
     | 
    
         
            -
                file = Licensee::LicenseFile.find fixture_path("txt")
         
     | 
| 
       40 
     | 
    
         
            -
                assert_equal "mit", file.match.name
         
     | 
| 
       41 
     | 
    
         
            -
              end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
              should "match a md license" do
         
     | 
| 
       44 
     | 
    
         
            -
                file = Licensee::LicenseFile.find fixture_path("md")
         
     | 
| 
       45 
     | 
    
         
            -
                assert_equal "mit", file.match.name
         
     | 
| 
       46 
     | 
    
         
            -
              end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
32 
     | 
    
         
             
              should "diff the file" do
         
     | 
| 
       49 
33 
     | 
    
         
             
                expected = "-Copyright (c) [year] [fullname]\n+Copyright (c) 2014 Ben Balter"
         
     | 
| 
       50 
34 
     | 
    
         
             
                assert @file.diff.include?(expected)
         
     | 
| 
         @@ -4,12 +4,12 @@ class TestLicenseeLicenses < Minitest::Test 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
              should "know license names" do
         
     | 
| 
       6 
6 
     | 
    
         
             
                assert_equal Array, Licensee::Licenses.names.class
         
     | 
| 
       7 
     | 
    
         
            -
                assert_equal  
     | 
| 
      
 7 
     | 
    
         
            +
                assert_equal 15, Licensee::Licenses.names.size
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              should "load the licenses" do
         
     | 
| 
       11 
11 
     | 
    
         
             
                assert_equal Array, Licensee::Licenses.list.class
         
     | 
| 
       12 
     | 
    
         
            -
                assert_equal  
     | 
| 
      
 12 
     | 
    
         
            +
                assert_equal 15, Licensee::Licenses.list.size
         
     | 
| 
       13 
13 
     | 
    
         
             
                assert_equal Licensee::License, Licensee::Licenses.list.first.class
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class TestLicenseeVendor < Minitest::Test
         
     | 
| 
      
 4 
     | 
    
         
            +
              should "detect each vendored license" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                licenses = Dir["#{Licensee::Licenses.base}/*"].shuffle
         
     | 
| 
      
 6 
     | 
    
         
            +
                licenses.each do |license|
         
     | 
| 
      
 7 
     | 
    
         
            +
                  verify_license_file(license)
         
     | 
| 
      
 8 
     | 
    
         
            +
                end
         
     | 
| 
      
 9 
     | 
    
         
            +
              end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              should "detect each vendored license" do
         
     | 
| 
      
 12 
     | 
    
         
            +
                licenses = Dir["#{Licensee::Licenses.base}/*"].shuffle
         
     | 
| 
      
 13 
     | 
    
         
            +
                licenses.each do |license|
         
     | 
| 
      
 14 
     | 
    
         
            +
                  verify_license_file(license, true)
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,116 +1,110 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: licensee
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version:  
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.0
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Ben Balter
         
     | 
| 
       9 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2014- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-10-02 00:00:00.000000000 Z
         
     | 
| 
       13 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
     | 
    
         
            -
              name:  
     | 
| 
      
 14 
     | 
    
         
            +
              name: rugged
         
     | 
| 
       16 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       17 
     | 
    
         
            -
                none: false
         
     | 
| 
       18 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       20 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       21 
     | 
    
         
            -
                    version:  
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 0.21.1b2
         
     | 
| 
       22 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       25 
     | 
    
         
            -
                none: false
         
     | 
| 
       26 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       28 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
     | 
    
         
            -
                    version:  
     | 
| 
       30 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency
         
     | 
| 
       31 
     | 
    
         
            -
              name: diffy
         
     | 
| 
       32 
     | 
    
         
            -
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       33 
     | 
    
         
            -
                none: false
         
     | 
| 
       34 
     | 
    
         
            -
                requirements:
         
     | 
| 
       35 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       36 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       37 
     | 
    
         
            -
                    version: '3.0'
         
     | 
| 
       38 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       39 
     | 
    
         
            -
              prerelease: false
         
     | 
| 
       40 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       41 
     | 
    
         
            -
                none: false
         
     | 
| 
       42 
     | 
    
         
            -
                requirements:
         
     | 
| 
       43 
     | 
    
         
            -
                - - ~>
         
     | 
| 
       44 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       45 
     | 
    
         
            -
                    version: '3.0'
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 0.21.1b2
         
     | 
| 
       46 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       47 
28 
     | 
    
         
             
              name: pry
         
     | 
| 
       48 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       49 
     | 
    
         
            -
                none: false
         
     | 
| 
       50 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       51 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       52 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       53 
33 
     | 
    
         
             
                    version: '0.9'
         
     | 
| 
       54 
34 
     | 
    
         
             
              type: :development
         
     | 
| 
       55 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       56 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       57 
     | 
    
         
            -
                none: false
         
     | 
| 
       58 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       60 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
40 
     | 
    
         
             
                    version: '0.9'
         
     | 
| 
       62 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       63 
42 
     | 
    
         
             
              name: shoulda
         
     | 
| 
       64 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
     | 
    
         
            -
                none: false
         
     | 
| 
       66 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       67 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       68 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       69 
47 
     | 
    
         
             
                    version: '3.5'
         
     | 
| 
       70 
48 
     | 
    
         
             
              type: :development
         
     | 
| 
       71 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       72 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       73 
     | 
    
         
            -
                none: false
         
     | 
| 
       74 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       75 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       76 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       77 
54 
     | 
    
         
             
                    version: '3.5'
         
     | 
| 
       78 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       79 
56 
     | 
    
         
             
              name: rake
         
     | 
| 
       80 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       81 
     | 
    
         
            -
                none: false
         
     | 
| 
       82 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       83 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       84 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       85 
61 
     | 
    
         
             
                    version: '10.3'
         
     | 
| 
       86 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       87 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       88 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       89 
     | 
    
         
            -
                none: false
         
     | 
| 
       90 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       91 
     | 
    
         
            -
                - - ~>
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
       92 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       93 
68 
     | 
    
         
             
                    version: '10.3'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: ruby-prof
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0.15'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0.15'
         
     | 
| 
       94 
83 
     | 
    
         
             
            description: Licensee automates the process of reading LICENSE files and compares
         
     | 
| 
       95 
     | 
    
         
            -
              their contents to known licenses using a fancy math thing called  
     | 
| 
       96 
     | 
    
         
            -
              Distance.
         
     | 
| 
      
 84 
     | 
    
         
            +
              their contents to known licenses using a fancy math thing called Rabin-Karp rolling-hashes.
         
     | 
| 
       97 
85 
     | 
    
         
             
            email: ben.balter@github.com
         
     | 
| 
       98 
86 
     | 
    
         
             
            executables:
         
     | 
| 
       99 
87 
     | 
    
         
             
            - licensee
         
     | 
| 
       100 
88 
     | 
    
         
             
            extensions: []
         
     | 
| 
       101 
89 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       102 
90 
     | 
    
         
             
            files:
         
     | 
| 
      
 91 
     | 
    
         
            +
            - LICENSE.md
         
     | 
| 
      
 92 
     | 
    
         
            +
            - README.md
         
     | 
| 
       103 
93 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       104 
94 
     | 
    
         
             
            - bin/licensee
         
     | 
| 
      
 95 
     | 
    
         
            +
            - lib/licensee.rb
         
     | 
| 
       105 
96 
     | 
    
         
             
            - lib/licensee/license.rb
         
     | 
| 
       106 
97 
     | 
    
         
             
            - lib/licensee/license_file.rb
         
     | 
| 
       107 
98 
     | 
    
         
             
            - lib/licensee/licenses.rb
         
     | 
| 
       108 
99 
     | 
    
         
             
            - lib/licensee/project.rb
         
     | 
| 
       109 
100 
     | 
    
         
             
            - lib/licensee/version.rb
         
     | 
| 
       110 
     | 
    
         
            -
            -  
     | 
| 
       111 
     | 
    
         
            -
            - test/fixtures/ 
     | 
| 
       112 
     | 
    
         
            -
            - test/fixtures/ 
     | 
| 
       113 
     | 
    
         
            -
            - test/fixtures/ 
     | 
| 
      
 101 
     | 
    
         
            +
            - test/fixtures/licenses.git/HEAD
         
     | 
| 
      
 102 
     | 
    
         
            +
            - test/fixtures/licenses.git/config
         
     | 
| 
      
 103 
     | 
    
         
            +
            - test/fixtures/licenses.git/objects/info/packs
         
     | 
| 
      
 104 
     | 
    
         
            +
            - test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.idx
         
     | 
| 
      
 105 
     | 
    
         
            +
            - test/fixtures/licenses.git/objects/pack/pack-4a7088171ae3ca900f010a4be6f1c2c96490c338.pack
         
     | 
| 
      
 106 
     | 
    
         
            +
            - test/fixtures/licenses.git/packed-refs
         
     | 
| 
      
 107 
     | 
    
         
            +
            - test/functions.rb
         
     | 
| 
       114 
108 
     | 
    
         
             
            - test/helper.rb
         
     | 
| 
       115 
109 
     | 
    
         
             
            - test/test_licensee.rb
         
     | 
| 
       116 
110 
     | 
    
         
             
            - test/test_licensee_bin.rb
         
     | 
| 
         @@ -118,6 +112,7 @@ files: 
     | 
|
| 
       118 
112 
     | 
    
         
             
            - test/test_licensee_license_file.rb
         
     | 
| 
       119 
113 
     | 
    
         
             
            - test/test_licensee_licenses.rb
         
     | 
| 
       120 
114 
     | 
    
         
             
            - test/test_licensee_project.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - test/test_licensee_vendor.rb
         
     | 
| 
       121 
116 
     | 
    
         
             
            - vendor/choosealicense.com/_licenses/agpl-3.0.txt
         
     | 
| 
       122 
117 
     | 
    
         
             
            - vendor/choosealicense.com/_licenses/apache-2.0.txt
         
     | 
| 
       123 
118 
     | 
    
         
             
            - vendor/choosealicense.com/_licenses/artistic-2.0.txt
         
     | 
| 
         @@ -132,33 +127,29 @@ files: 
     | 
|
| 
       132 
127 
     | 
    
         
             
            - vendor/choosealicense.com/_licenses/lgpl-3.0.txt
         
     | 
| 
       133 
128 
     | 
    
         
             
            - vendor/choosealicense.com/_licenses/mit.txt
         
     | 
| 
       134 
129 
     | 
    
         
             
            - vendor/choosealicense.com/_licenses/mpl-2.0.txt
         
     | 
| 
       135 
     | 
    
         
            -
            - vendor/choosealicense.com/_licenses/no-license.txt
         
     | 
| 
       136 
130 
     | 
    
         
             
            - vendor/choosealicense.com/_licenses/unlicense.txt
         
     | 
| 
       137 
     | 
    
         
            -
            - README.md
         
     | 
| 
       138 
     | 
    
         
            -
            - LICENSE.md
         
     | 
| 
       139 
131 
     | 
    
         
             
            homepage: http://github.com/benbalter/licensee
         
     | 
| 
       140 
132 
     | 
    
         
             
            licenses:
         
     | 
| 
       141 
133 
     | 
    
         
             
            - MIT
         
     | 
| 
      
 134 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       142 
135 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       143 
136 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       144 
137 
     | 
    
         
             
            require_paths:
         
     | 
| 
       145 
138 
     | 
    
         
             
            - lib
         
     | 
| 
       146 
139 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       147 
     | 
    
         
            -
              none: false
         
     | 
| 
       148 
140 
     | 
    
         
             
              requirements:
         
     | 
| 
       149 
     | 
    
         
            -
              - -  
     | 
| 
      
 141 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       150 
142 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       151 
143 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       152 
144 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       153 
     | 
    
         
            -
              none: false
         
     | 
| 
       154 
145 
     | 
    
         
             
              requirements:
         
     | 
| 
       155 
     | 
    
         
            -
              - -  
     | 
| 
      
 146 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       156 
147 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       157 
148 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       158 
149 
     | 
    
         
             
            requirements: []
         
     | 
| 
       159 
150 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       160 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 151 
     | 
    
         
            +
            rubygems_version: 2.2.0
         
     | 
| 
       161 
152 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       162 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 153 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       163 
154 
     | 
    
         
             
            summary: A Ruby Gem to detect under what license a project is distributed
         
     | 
| 
       164 
155 
     | 
    
         
             
            test_files: []
         
     | 
    
        data/test/fixtures/md/LICENSE.md
    DELETED
    
    | 
         @@ -1,21 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            The MIT License (MIT)
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            Copyright (c) 2014 Ben Balter
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
       13 
     | 
    
         
            -
            copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       21 
     | 
    
         
            -
            SOFTWARE.
         
     | 
| 
         @@ -1,21 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            The MIT License (MIT)
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            Copyright (c) 2014 Ben Balter
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
       13 
     | 
    
         
            -
            copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       21 
     | 
    
         
            -
            SOFTWARE.
         
     | 
| 
         @@ -1,21 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            The MIT License (MIT)
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            Copyright (c) 2014 Ben Balter
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
       6 
     | 
    
         
            -
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
       7 
     | 
    
         
            -
            in the Software without restriction, including without limitation the rights
         
     | 
| 
       8 
     | 
    
         
            -
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
       9 
     | 
    
         
            -
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
       10 
     | 
    
         
            -
            furnished to do so, subject to the following conditions:
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
       13 
     | 
    
         
            -
            copies or substantial portions of the Software.
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
       16 
     | 
    
         
            -
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
       17 
     | 
    
         
            -
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
       18 
     | 
    
         
            -
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
       19 
     | 
    
         
            -
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
       20 
     | 
    
         
            -
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
       21 
     | 
    
         
            -
            SOFTWARE.
         
     | 
| 
         @@ -1,28 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ---
         
     | 
| 
       2 
     | 
    
         
            -
            layout: license
         
     | 
| 
       3 
     | 
    
         
            -
            permalink: /licenses/no-license/
         
     | 
| 
       4 
     | 
    
         
            -
            category: No License
         
     | 
| 
       5 
     | 
    
         
            -
            class: license-types
         
     | 
| 
       6 
     | 
    
         
            -
            title: No License
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            description: You retain all rights and do not permit distribution, reproduction, or derivative works. You may grant some rights in cases where you publish your source code to a site that requires accepting terms of service. For example, publishing code in a public repository on GitHub requires that you allow others to view and fork your code.
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            note: This option may be subject to the Terms Of Use of the site where you publish your source code.
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
            how: Simply do nothing, though including a copyright notice is recommended.
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            required:
         
     | 
| 
       15 
     | 
    
         
            -
              - include-copyright
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            permitted:
         
     | 
| 
       18 
     | 
    
         
            -
              - commercial-use
         
     | 
| 
       19 
     | 
    
         
            -
              - private-use
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
            forbidden:
         
     | 
| 
       22 
     | 
    
         
            -
              - modifications
         
     | 
| 
       23 
     | 
    
         
            -
              - distribution
         
     | 
| 
       24 
     | 
    
         
            -
              - sublicense
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            ---
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            Copyright [year] [fullname]
         
     |