yolice 0.0.2
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.
- data/Gemfile +4 -0
 - data/README.md +21 -0
 - data/Rakefile +15 -0
 - data/lib/licenses/license_features.yml +302 -0
 - data/lib/yolice.rb +133 -0
 - metadata +50 -0
 
    
        data/Gemfile
    ADDED
    
    
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #Yolice
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ###Easy licensing for lazy people
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            __DISCLAIMER__ - _I'm not a lawyer, and this gem is very simple. The aim is awareness, not to cover your ass._
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            Just add the gem to your Gemfile:
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                gem 'yolice'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Then you can run the rake tasks.
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ###Tasks
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            * List all licenses:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  bundle exec rake licensing:list
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            * Explain my rights and obligations:
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  bundle exec rake licensing:explain
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require './lib/yolice'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            namespace :licenses do
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              desc "List the licenses of your gems" 
         
     | 
| 
      
 6 
     | 
    
         
            +
              task :list do
         
     | 
| 
      
 7 
     | 
    
         
            +
                puts Yolice::YoLicense.new.raw_licenses
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              desc "Explain what licensing situation"
         
     | 
| 
      
 11 
     | 
    
         
            +
              task :explain do
         
     | 
| 
      
 12 
     | 
    
         
            +
                Yolice::YoLicense.new.match_licenses.col_features.print_explanations
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,302 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            features:
         
     | 
| 
      
 3 
     | 
    
         
            +
              include-copyright:
         
     | 
| 
      
 4 
     | 
    
         
            +
                name: License and copyright notice 
         
     | 
| 
      
 5 
     | 
    
         
            +
                required: Include a copy of the license and copyright notice with the code.
         
     | 
| 
      
 6 
     | 
    
         
            +
              document-changes:
         
     | 
| 
      
 7 
     | 
    
         
            +
                name: State Changes
         
     | 
| 
      
 8 
     | 
    
         
            +
                required: Indicate significant changes made to the code.
         
     | 
| 
      
 9 
     | 
    
         
            +
              disclose-source:
         
     | 
| 
      
 10 
     | 
    
         
            +
                name: Disclose source
         
     | 
| 
      
 11 
     | 
    
         
            +
                required: Source code must be made available when distributing the software. In the case of LGPL, the source for the library (and not the entire program) must be made available.
         
     | 
| 
      
 12 
     | 
    
         
            +
              library-usage:
         
     | 
| 
      
 13 
     | 
    
         
            +
                name: Library usage
         
     | 
| 
      
 14 
     | 
    
         
            +
                permitted: The library may be used within a non-open-source application.
         
     | 
| 
      
 15 
     | 
    
         
            +
              rename: 
         
     | 
| 
      
 16 
     | 
    
         
            +
                name: 
         
     | 
| 
      
 17 
     | 
    
         
            +
                required: You must change the name of the software if you modify it.
         
     | 
| 
      
 18 
     | 
    
         
            +
              commercial-use:
         
     | 
| 
      
 19 
     | 
    
         
            +
                name: Commercial use
         
     | 
| 
      
 20 
     | 
    
         
            +
                permitted: This software and derivatives may be used for commercial purposes.
         
     | 
| 
      
 21 
     | 
    
         
            +
              modifications:
         
     | 
| 
      
 22 
     | 
    
         
            +
                name: Modification
         
     | 
| 
      
 23 
     | 
    
         
            +
                permitted: This software may be modified.
         
     | 
| 
      
 24 
     | 
    
         
            +
                forbidden: This software may not be modified.
         
     | 
| 
      
 25 
     | 
    
         
            +
              distribution:
         
     | 
| 
      
 26 
     | 
    
         
            +
                name: Distribution
         
     | 
| 
      
 27 
     | 
    
         
            +
                permitted: You may distribute this software.
         
     | 
| 
      
 28 
     | 
    
         
            +
                forbidden: You may not distribute this software.
         
     | 
| 
      
 29 
     | 
    
         
            +
              sublicense:
         
     | 
| 
      
 30 
     | 
    
         
            +
                name: Sublicensing
         
     | 
| 
      
 31 
     | 
    
         
            +
                permitted: You may grant a sublicense to modify and distribute this software to third parties not included in the license.
         
     | 
| 
      
 32 
     | 
    
         
            +
                forbidden: You may not grant a sublicense to modify and distribute this software to third parties not included in the license.
         
     | 
| 
      
 33 
     | 
    
         
            +
              private-use:
         
     | 
| 
      
 34 
     | 
    
         
            +
                name: Private use
         
     | 
| 
      
 35 
     | 
    
         
            +
                permitted: You may use and modify the software without distributing it.
         
     | 
| 
      
 36 
     | 
    
         
            +
              patent-grant:
         
     | 
| 
      
 37 
     | 
    
         
            +
                name: Patent Grant
         
     | 
| 
      
 38 
     | 
    
         
            +
                permitted: This license provides an express grant of patent rights from the contributor to the recipient.
         
     | 
| 
      
 39 
     | 
    
         
            +
              trademark-use:
         
     | 
| 
      
 40 
     | 
    
         
            +
                name: Use trademark
         
     | 
| 
      
 41 
     | 
    
         
            +
                forbidden: While this may be implicitly true of all licenses, this license explicitly states that you may NOT use the names, logos, or trademarks of contributors.
         
     | 
| 
      
 42 
     | 
    
         
            +
              no-liability:
         
     | 
| 
      
 43 
     | 
    
         
            +
                name: Hold liable
         
     | 
| 
      
 44 
     | 
    
         
            +
                forbidden: Software is provided without warranty and the software author/license owner cannot be held liable for damages.
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 47 
     | 
    
         
            +
              gpl_2:
         
     | 
| 
      
 48 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 49 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 50 
     | 
    
         
            +
                - feature: document-changes
         
     | 
| 
      
 51 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 52 
     | 
    
         
            +
                - feature: disclose-source
         
     | 
| 
      
 53 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 54 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 55 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 56 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 57 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 58 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 59 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 60 
     | 
    
         
            +
                - feature: patent-grant
         
     | 
| 
      
 61 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 62 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 63 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 64 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 65 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 66 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 67 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 68 
     | 
    
         
            +
              apache_2:
         
     | 
| 
      
 69 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 70 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 71 
     | 
    
         
            +
                - feature: document-changes
         
     | 
| 
      
 72 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 73 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 74 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 75 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 76 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 77 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 78 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 79 
     | 
    
         
            +
                - feature: patent-grant
         
     | 
| 
      
 80 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 81 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 82 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 83 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 84 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 85 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 86 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 87 
     | 
    
         
            +
                - feature: trademark-use
         
     | 
| 
      
 88 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 89 
     | 
    
         
            +
              mit:
         
     | 
| 
      
 90 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 91 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 92 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 93 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 94 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 95 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 96 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 97 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 98 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 99 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 100 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 101 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 102 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 103 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 104 
     | 
    
         
            +
              bsd_2_clause:
         
     | 
| 
      
 105 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 106 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 107 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 108 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 109 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 110 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 111 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 112 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 113 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 114 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 115 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 116 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 117 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 118 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 119 
     | 
    
         
            +
              affero_gpl:
         
     | 
| 
      
 120 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 121 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 122 
     | 
    
         
            +
                - feature: document-changes
         
     | 
| 
      
 123 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 124 
     | 
    
         
            +
                - feature: disclose-source
         
     | 
| 
      
 125 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 126 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 127 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 128 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 129 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 130 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 131 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 132 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 133 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 134 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 135 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 136 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 137 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 138 
     | 
    
         
            +
              eclipse_v1:
         
     | 
| 
      
 139 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 140 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 141 
     | 
    
         
            +
                - feature: disclose-source
         
     | 
| 
      
 142 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 143 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 144 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 145 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 146 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 147 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 148 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 149 
     | 
    
         
            +
                - feature: patent-grant
         
     | 
| 
      
 150 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 151 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 152 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 153 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 154 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 155 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 156 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 157 
     | 
    
         
            +
              public_domain:
         
     | 
| 
      
 158 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 159 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 160 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 161 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 162 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 163 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 164 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 165 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 166 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 167 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 168 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 169 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 170 
     | 
    
         
            +
              lgpl_3:
         
     | 
| 
      
 171 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 172 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 173 
     | 
    
         
            +
                - feature: disclose-source
         
     | 
| 
      
 174 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 175 
     | 
    
         
            +
                - feature: library-usage
         
     | 
| 
      
 176 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 177 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 178 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 179 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 180 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 181 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 182 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 183 
     | 
    
         
            +
                - feature: patent-grant
         
     | 
| 
      
 184 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 185 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 186 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 187 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 188 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 189 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 190 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 191 
     | 
    
         
            +
              gpl_3:
         
     | 
| 
      
 192 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 193 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 194 
     | 
    
         
            +
                - feature: document-changes
         
     | 
| 
      
 195 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 196 
     | 
    
         
            +
                - feature: disclose-source
         
     | 
| 
      
 197 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 198 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 199 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 200 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 201 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 202 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 203 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 204 
     | 
    
         
            +
                - feature: patent-grant
         
     | 
| 
      
 205 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 206 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 207 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 208 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 209 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 210 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 211 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 212 
     | 
    
         
            +
              mozilla_2:
         
     | 
| 
      
 213 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 214 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 215 
     | 
    
         
            +
                - feature: disclose-source
         
     | 
| 
      
 216 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 217 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 218 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 219 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 220 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 221 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 222 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 223 
     | 
    
         
            +
                - feature: patent-grant
         
     | 
| 
      
 224 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 225 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 226 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 227 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 228 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 229 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 230 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 231 
     | 
    
         
            +
                - feature: trademark-use
         
     | 
| 
      
 232 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 233 
     | 
    
         
            +
              bsd_3_clause:
         
     | 
| 
      
 234 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 235 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 236 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 237 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 238 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 239 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 240 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 241 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 242 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 243 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 244 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 245 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 246 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 247 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 248 
     | 
    
         
            +
                - feature: trademark-use
         
     | 
| 
      
 249 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 250 
     | 
    
         
            +
              no-license:
         
     | 
| 
      
 251 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 252 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 253 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 254 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 255 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 256 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 257 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 258 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 259 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 260 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 261 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 262 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 263 
     | 
    
         
            +
              lgpl_2_1:
         
     | 
| 
      
 264 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 265 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 266 
     | 
    
         
            +
                - feature: disclose-source
         
     | 
| 
      
 267 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 268 
     | 
    
         
            +
                - feature: library-usage
         
     | 
| 
      
 269 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 270 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 271 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 272 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 273 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 274 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 275 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 276 
     | 
    
         
            +
                - feature: patent-grant
         
     | 
| 
      
 277 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 278 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 279 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 280 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 281 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 282 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 283 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 284 
     | 
    
         
            +
              artistic:
         
     | 
| 
      
 285 
     | 
    
         
            +
                - feature: include-copyright
         
     | 
| 
      
 286 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 287 
     | 
    
         
            +
                - feature: document-changes
         
     | 
| 
      
 288 
     | 
    
         
            +
                  permission: required
         
     | 
| 
      
 289 
     | 
    
         
            +
                - feature: commercial-use
         
     | 
| 
      
 290 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 291 
     | 
    
         
            +
                - feature: modifications
         
     | 
| 
      
 292 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 293 
     | 
    
         
            +
                - feature: distribution
         
     | 
| 
      
 294 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 295 
     | 
    
         
            +
                - feature: private-use
         
     | 
| 
      
 296 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 297 
     | 
    
         
            +
                - feature: no-liability
         
     | 
| 
      
 298 
     | 
    
         
            +
                  permission: forbidden
         
     | 
| 
      
 299 
     | 
    
         
            +
                - feature: sublicense
         
     | 
| 
      
 300 
     | 
    
         
            +
                  permission: permitted
         
     | 
| 
      
 301 
     | 
    
         
            +
                - feature: trademark-use
         
     | 
| 
      
 302 
     | 
    
         
            +
                  permission: forbidden
         
     | 
    
        data/lib/yolice.rb
    ADDED
    
    | 
         @@ -0,0 +1,133 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'yaml'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'ostruct'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'colorize'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            class String
         
     | 
| 
      
 6 
     | 
    
         
            +
              alias_method :forbidden, :red
         
     | 
| 
      
 7 
     | 
    
         
            +
              alias_method :permitted, :green
         
     | 
| 
      
 8 
     | 
    
         
            +
              alias_method :required, :yellow
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            module Yolice
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              class YoLicense
         
     | 
| 
      
 14 
     | 
    
         
            +
                attr_reader   :license_features
         
     | 
| 
      
 15 
     | 
    
         
            +
                attr_reader   :licenses
         
     | 
| 
      
 16 
     | 
    
         
            +
                attr_reader   :raw_licenses
         
     | 
| 
      
 17 
     | 
    
         
            +
                attr_reader   :features
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 20 
     | 
    
         
            +
                  get_raw_licenses
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @licenses = []
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @features = {}
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @license_features = OpenStruct.new.marshal_load(load_license_config)
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                def match_licenses
         
     | 
| 
      
 27 
     | 
    
         
            +
                  @raw_licenses.each do |gem_license|
         
     | 
| 
      
 28 
     | 
    
         
            +
                    @licenses << fetch_most_likely(compare_to_licenses(gem_license))
         
     | 
| 
      
 29 
     | 
    
         
            +
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  self
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                def col_features
         
     | 
| 
      
 34 
     | 
    
         
            +
                  @licenses.each do |l|
         
     | 
| 
      
 35 
     | 
    
         
            +
                    @license_features["licenses"][l].each do |f|
         
     | 
| 
      
 36 
     | 
    
         
            +
                      unless @features.include? f["feature"] && @features[f["feature"]] == "forbidden"
         
     | 
| 
      
 37 
     | 
    
         
            +
                        @features[f["feature"]] = f["permission"]
         
     | 
| 
      
 38 
     | 
    
         
            +
                      end
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  self
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                def print_explanations
         
     | 
| 
      
 45 
     | 
    
         
            +
                  puts "Here is your license situation: "
         
     | 
| 
      
 46 
     | 
    
         
            +
                  puts "=" * 20
         
     | 
| 
      
 47 
     | 
    
         
            +
                  @features.each do |f|
         
     | 
| 
      
 48 
     | 
    
         
            +
                    puts "#{@license_features["features"][f[0]]["name"]} - #{@license_features["features"][f[0]][f[1]]}".send f[1]
         
     | 
| 
      
 49 
     | 
    
         
            +
                  end
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                private
         
     | 
| 
      
 53 
     | 
    
         
            +
                  def load_license_config
         
     | 
| 
      
 54 
     | 
    
         
            +
                    YAML.load_file(File.join File.dirname(__FILE__), 'licenses', 'license_features.yml')
         
     | 
| 
      
 55 
     | 
    
         
            +
                  end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  def get_raw_licenses
         
     | 
| 
      
 58 
     | 
    
         
            +
                    @raw_licenses = []
         
     | 
| 
      
 59 
     | 
    
         
            +
                    Gem::Specification.each do |g|
         
     | 
| 
      
 60 
     | 
    
         
            +
                      if g.licenses.count > 0
         
     | 
| 
      
 61 
     | 
    
         
            +
                        @raw_licenses << g.licenses 
         
     | 
| 
      
 62 
     | 
    
         
            +
                      end  
         
     | 
| 
      
 63 
     | 
    
         
            +
                    end
         
     | 
| 
      
 64 
     | 
    
         
            +
                    @raw_licenses.flatten!.uniq!
         
     | 
| 
      
 65 
     | 
    
         
            +
                  end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                  def preprocess_raw_license(raw_text)
         
     | 
| 
      
 68 
     | 
    
         
            +
                    raw_text.downcase.gsub(/[\.\-\s]/, "_")
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                  def compare_to_licenses(gem_license)
         
     | 
| 
      
 72 
     | 
    
         
            +
                    map_results @license_features["licenses"].keys.map {|license_name| get_sorensen_index(preprocess_raw_license(gem_license), license_name)}
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                  def get_sorensen_index(gem_license, license_name)
         
     | 
| 
      
 76 
     | 
    
         
            +
                    SorensenIndex.new(gem_license, license_name).calculate
         
     | 
| 
      
 77 
     | 
    
         
            +
                  end
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
                  def map_results(results)
         
     | 
| 
      
 80 
     | 
    
         
            +
                    Hash[@license_features["licenses"].keys.flatten.zip results]
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  def fetch_most_likely(result_hash)
         
     | 
| 
      
 84 
     | 
    
         
            +
                    result_hash.max_by {|k,v| v}[0]
         
     | 
| 
      
 85 
     | 
    
         
            +
                  end
         
     | 
| 
      
 86 
     | 
    
         
            +
              end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
              class SorensenIndex
         
     | 
| 
      
 89 
     | 
    
         
            +
                def initialize(*strings)
         
     | 
| 
      
 90 
     | 
    
         
            +
                  @bigram_sets = strings.map {|s| BigramSet.new(s)}
         
     | 
| 
      
 91 
     | 
    
         
            +
                end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
                def calculate
         
     | 
| 
      
 94 
     | 
    
         
            +
                  2 * similarities.count / total.to_f
         
     | 
| 
      
 95 
     | 
    
         
            +
                end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
                private
         
     | 
| 
      
 98 
     | 
    
         
            +
                  def similarities
         
     | 
| 
      
 99 
     | 
    
         
            +
                    @bigram_sets.first & @bigram_sets.last
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
                  def total
         
     | 
| 
      
 103 
     | 
    
         
            +
                    @bigram_sets.first.count + @bigram_sets.last.count
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
              end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
              class BigramSet
         
     | 
| 
      
 108 
     | 
    
         
            +
                attr_reader :bigrams
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                def initialize(string)
         
     | 
| 
      
 111 
     | 
    
         
            +
                  get_bigrams string.dup
         
     | 
| 
      
 112 
     | 
    
         
            +
                end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
                def &(alt_set)
         
     | 
| 
      
 115 
     | 
    
         
            +
                  @bigrams & alt_set.bigrams
         
     | 
| 
      
 116 
     | 
    
         
            +
                end
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                def count
         
     | 
| 
      
 119 
     | 
    
         
            +
                  @bigrams.count
         
     | 
| 
      
 120 
     | 
    
         
            +
                end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
                private
         
     | 
| 
      
 123 
     | 
    
         
            +
                  def get_bigrams(str)
         
     | 
| 
      
 124 
     | 
    
         
            +
                    @bigrams = []
         
     | 
| 
      
 125 
     | 
    
         
            +
                    while str.length > 1 do
         
     | 
| 
      
 126 
     | 
    
         
            +
                      @bigrams << str[0..1] 
         
     | 
| 
      
 127 
     | 
    
         
            +
                      str[0] = ''
         
     | 
| 
      
 128 
     | 
    
         
            +
                    end
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
              end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            end
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: yolice
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.2
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
      
 6 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Andrew King
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-10-31 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies: []
         
     | 
| 
      
 14 
     | 
    
         
            +
            description: A lazy way to meet your licensing requirements.
         
     | 
| 
      
 15 
     | 
    
         
            +
            email: me@andrewsking.com
         
     | 
| 
      
 16 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 17 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 18 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 19 
     | 
    
         
            +
            files:
         
     | 
| 
      
 20 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 21 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 22 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 23 
     | 
    
         
            +
            - lib/yolice.rb
         
     | 
| 
      
 24 
     | 
    
         
            +
            - lib/licenses/license_features.yml
         
     | 
| 
      
 25 
     | 
    
         
            +
            homepage: http://rubygems.org/gems/yolice
         
     | 
| 
      
 26 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 27 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 28 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 29 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 30 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 31 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 32 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 33 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 34 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 35 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 36 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 37 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 38 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 39 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 40 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 41 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 42 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 43 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 44 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 45 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 46 
     | 
    
         
            +
            rubygems_version: 1.8.25
         
     | 
| 
      
 47 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 48 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 49 
     | 
    
         
            +
            summary: Simple licensing
         
     | 
| 
      
 50 
     | 
    
         
            +
            test_files: []
         
     |