gem-licenses 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e2644dc330eb91c98b3ecb88b7261580d112f17b
4
+ data.tar.gz: e8af03bf7586f68d443f00af88eae071c71a9099
5
+ SHA512:
6
+ metadata.gz: c0d5bd2625309f20ae3d52bdd941996966cfcc5fd6e85c29150ec5c59f4e43f032234babc012c4a9c8b5f760bd31b5fa93ed95d9b93a6ea3658f39b801213135
7
+ data.tar.gz: 1126f2db99bed3d1b68a2c63b264f25ed57a35d366abeedc1b3ab8d32d9f3d251b45b3d77acc8e8988141282e072c0b9b01baf2969d3fcd2391fe6afd90d0be4
@@ -0,0 +1,44 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+
30
+ .DS_Store
31
+
32
+ # For TextMate
33
+ *.tmproj
34
+ tmtags
35
+
36
+ # For emacs:
37
+ *~
38
+ \#*
39
+ .\#*
40
+
41
+ # For vim:
42
+ *.swp
43
+
44
+ Gemfile.lock
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --color
2
-
2
+ --format=documentation
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ Exclude:
3
+ - vendor/**/*
4
+
5
+ inherit_from: .rubocop_todo.yml
@@ -0,0 +1,41 @@
1
+ # This configuration was generated by `rubocop --auto-gen-config`
2
+ # on 2015-02-20 11:26:16 -0500 using RuboCop version 0.29.1.
3
+ # The point is for the user to remove these configuration records
4
+ # one by one as the offenses are removed from the code base.
5
+ # Note that changes in the inspected code, or installation of new
6
+ # versions of RuboCop, may require this file to be generated again.
7
+
8
+ # Offense count: 1
9
+ Lint/HandleExceptions:
10
+ Enabled: false
11
+
12
+ # Offense count: 1
13
+ Metrics/AbcSize:
14
+ Max: 26
15
+
16
+ # Offense count: 1
17
+ Metrics/CyclomaticComplexity:
18
+ Max: 7
19
+
20
+ # Offense count: 8
21
+ # Configuration parameters: AllowURI, URISchemes.
22
+ Metrics/LineLength:
23
+ Max: 107
24
+
25
+ # Offense count: 3
26
+ # Configuration parameters: CountComments.
27
+ Metrics/MethodLength:
28
+ Max: 24
29
+
30
+ # Offense count: 1
31
+ Metrics/PerceivedComplexity:
32
+ Max: 9
33
+
34
+ # Offense count: 4
35
+ Style/Documentation:
36
+ Enabled: false
37
+
38
+ # Offense count: 1
39
+ # Configuration parameters: Exclude.
40
+ Style/FileName:
41
+ Enabled: false
@@ -0,0 +1,8 @@
1
+ sudo: false
2
+
3
+ rvm:
4
+ - 2.1.2
5
+
6
+ language: ruby
7
+
8
+ cache: bundler
@@ -0,0 +1,12 @@
1
+ #### 0.2.0 (7/17/2015)
2
+
3
+ * [#6](https://github.com/dblock/gem-licenses/pull/6): Use HTTPS for rubygems.org - [@O-I](https://github.com/O-I).
4
+ * [#4](https://github.com/dblock/gem-licenses/pull/4): Try to match file contents to known, common licenses - [@joeyAghion](https://github.com/joeyAghion).
5
+ * Added `gem:licenses` Rake task - [@dblock](https://github.com/dblock).
6
+ * Attempt to normalize license name - [@dblock](https://github.com/dblock).
7
+ * Install Rake tasks via `Gem::Licenses.install_tasks` - [@dblock](https://github.com/dblock).
8
+
9
+ #### 0.1.2 (7/27/2011)
10
+
11
+ * Initial public release - [@dblock](https://github.com/dblock).
12
+
@@ -0,0 +1,104 @@
1
+ # Contributing to Gem-Licenses
2
+
3
+ This project is work of [many contributors](https://github.com/dblock/gem-licenses/graphs/contributors).
4
+ You're encouraged to submit [pull requests](https://github.com/dblock/gem-licenses/pulls),
5
+ [propose features and discuss issues](https://github.com/dblock/gem-licenses/issues).
6
+
7
+ In the examples below, substitute your Github username for `contributor` in URLs.
8
+
9
+ ## Fork the Project
10
+
11
+ Fork the [project on Github](https://github.com/dblock/gem-licenses) and check out your copy.
12
+
13
+ ```
14
+ git clone https://github.com/contributor/gem-licenses.git
15
+ cd gem-licenses
16
+ git remote add upstream https://github.com/dblock/gem-licenses.git
17
+ ```
18
+
19
+ ## Create a Topic Branch
20
+
21
+ Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
22
+
23
+ ```
24
+ git checkout master
25
+ git pull upstream master
26
+ git checkout -b my-feature-branch
27
+ ```
28
+
29
+ ## Bundle Install and Test
30
+
31
+ Ensure that you can build the project and run tests.
32
+
33
+ ```
34
+ bundle install
35
+ bundle exec rake
36
+ ```
37
+
38
+ ## Write Tests
39
+
40
+ Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build.
41
+ Add to [spec](spec).
42
+
43
+ We definitely appreciate pull requests that highlight or reproduce a problem, even without a fix.
44
+
45
+ ## Write Code
46
+
47
+ Implement your feature or bug fix.
48
+
49
+ Make sure that `bundle exec rake` completes without errors.
50
+
51
+ ## Write Documentation
52
+
53
+ Document any external behavior in the [README](README.md).
54
+
55
+ ## Update Changelog
56
+
57
+ Add a line to [CHANGELOG](CHANGELOG.md) under *Next Release*.
58
+ Make it look like every other line, including your name and link to your Github account.
59
+
60
+ ## Push
61
+
62
+ ```
63
+ git push origin my-feature-branch
64
+ ```
65
+
66
+ ## Make a Pull Request
67
+
68
+ Go to https://github.com/contributor/grape and select your feature branch.
69
+ Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
70
+
71
+ ## Update CHANGELOG Again
72
+
73
+ Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical entry looks as follows.
74
+
75
+ ```
76
+ * [#123](https://github.com/dblock/gem-licenses/pull/123): Reticulated splines - [@contributor](https://github.com/contributor).
77
+ ```
78
+
79
+ Amend your previous commit and force push the changes.
80
+
81
+ ```
82
+ git commit --amend
83
+ git push origin my-feature-branch -f
84
+ ## Rebase
85
+
86
+ If you've been working on a change for a while, rebase with upstream/master.
87
+
88
+ ```
89
+ git fetch upstream
90
+ git rebase upstream/master
91
+ git push origin my-feature-branch -f
92
+ ```
93
+
94
+ ## Check on Your Pull Request
95
+
96
+ Go back to your pull request after a few minutes and see whether it passed muster with Travis-CI. Everything should look green, otherwise fix issues and amend your commit as described above.
97
+
98
+ ## Be Patient
99
+
100
+ It's likely that your change will not be merged and that the nitpicky maintainers will ask you to do more, or fix seemingly benign problems. Hang on there!
101
+
102
+ ## Thank You
103
+
104
+ Please do know that we really appreciate and value your time and work. We love you, really.
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
- source "http://rubygems.org"
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
2
4
 
3
5
  group :development do
4
- gem "rspec", "~> 2.5.0"
5
- gem "jeweler", "~> 1.5.2"
6
+ gem 'rake'
7
+ gem 'rspec', '~> 3.1'
8
+ gem 'rubocop', '0.29.1'
6
9
  end
7
-
data/README.md CHANGED
@@ -1,50 +1,59 @@
1
1
  Gem-Licenses
2
2
  ============
3
3
 
4
- Gem-licenses is an attempt to collect license information from project's gems. Similar to [3licenses](http://3licenses.codeplex.com/).
4
+ [![Build Status](https://travis-ci.org/dblock/gem-licenses.svg)](https://travis-ci.org/dblock/gem-licenses)
5
+
6
+ Gem-licenses is an attempt to collect license information from project's gems. Similar to [3licenses](https://github.com/dblock/3licenses).
5
7
 
6
8
  Motivation
7
9
  ==========
8
10
 
9
- The overwhelming majority of 3rd party licenses require the application that uses them to reproduce the license verbatim in an artifact that is installed with the application itself. For instance, the BSD license states the following.
11
+ The overwhelming majority of 3rd party licenses require the application that uses them to reproduce the license verbatim in an artifact that is installed with the application itself. For instance, the BSD license states the following.
10
12
 
11
- “Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.”
13
+ _“Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.”_
12
14
 
13
15
  Are you currently copying individual license.txt files "by hand" or are you including license text in your documentation with copy/paste? This project aims at improving this situation.
14
16
 
15
17
  Usage
16
18
  =====
17
19
 
18
- Include in your project. To list licenses try the following Rake task.
20
+ Include gem-licenses in your project's Gemfile.
21
+
22
+ ```
23
+ group :development, :test do
24
+ gem 'gem-licenses'
25
+ end
26
+ ```
27
+
28
+ Install Rake tasks from Rakefile.
29
+
30
+ ```
31
+ Gem::Licenses.install_tasks
32
+ ```
33
+
34
+ To list licenses try the following Rake task.
35
+
36
+ ```
37
+ rake gem:licenses
38
+ ```
19
39
 
20
- task :licenses do
21
- Gem.licenses.each do |license, gems|
22
- puts "#{license}"
23
- gems.sort_by { |gem| gem.name }.each do |gem|
24
- puts "* #{gem.name} #{gem.version} (#{gem.homepage}) - #{gem.summary}"
25
- end
26
- end
27
- end
40
+ To write a CSV file of gems + licenses.
41
+
42
+ ```
43
+ rake gem:licenses:csv['licenses.csv']
44
+ ```
28
45
 
29
46
  Contributing
30
47
  ============
31
48
 
32
- * Fork the project.
33
- * Make your feature addition or bug fix, write tests.
34
- * Commit, do not mess with rakefile, version, or history.
35
- * Make a pull request.
49
+ See [CONTRIBUTING](CONTRIBUTING.md).
36
50
 
37
51
  License
38
52
  =======
39
53
 
40
- This project is licenced under the MIT license.
54
+ This project is licenced under the MIT license, see [LICENSE](LICENSE) for details.
41
55
 
42
56
  Copyright
43
57
  =========
44
58
 
45
- Copyright (c) Daniel Doubrovkine, 2011 by Artsy, Inc.
46
-
47
-
48
-
49
-
50
-
59
+ Copyright (c) Daniel Doubrovkine, 2011-2015, Artsy, Inc.
data/Rakefile CHANGED
@@ -1,48 +1,21 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
3
 
4
- begin
5
- Bundler.setup(:default, :development)
6
- rescue Bundler::BundlerError => e
7
- $stderr.puts e.message
8
- $stderr.puts "Run `bundle install` to install missing gems."
9
- exit e.status_code
10
- end
4
+ Bundler.setup(:default, :development)
11
5
 
12
- require 'rake'
6
+ require 'rspec/core'
13
7
  require 'rspec/core/rake_task'
14
8
 
15
- require 'jeweler'
9
+ RSpec::Core::RakeTask.new(:spec)
16
10
 
17
- Jeweler::Tasks.new do |gem|
18
- gem.name = "gem-licenses"
19
- gem.homepage = "http://github.com/dblock/gem-licenses"
20
- gem.license = "MIT"
21
- gem.summary = "List all gem licenses."
22
- gem.description = "Attempts to figure out what licenses various gems use."
23
- gem.email = "dblock@dblock.org"
24
- gem.authors = [ "Daniel Doubrovkine" ]
25
- end
11
+ require 'rubocop/rake_task'
12
+ RuboCop::RakeTask.new(:rubocop)
26
13
 
27
- Jeweler::RubygemsDotOrgTasks.new
14
+ task default: [:rubocop, :spec]
28
15
 
29
- RSpec::Core::RakeTask.new(:spec) do |spec|
30
- spec.pattern = "spec/**/*_spec.rb"
31
- end
16
+ require 'rake'
32
17
 
33
- task :default => :spec
18
+ Bundler::GemHelper.install_tasks
34
19
 
35
20
  require 'gem_licenses'
36
-
37
- task :licenses do
38
- Gem.licenses.each do |license, gems|
39
- puts "#{license}"
40
- puts "=" * license.length
41
- gems.sort_by { |gem| gem.name }.each do |gem|
42
- puts "* #{gem.name} #{gem.version} (#{gem.homepage}) - #{gem.summary.strip}"
43
- puts gem.full_gem_path
44
- end
45
- puts ""
46
- end
47
- end
48
-
21
+ Gem::Licenses.install_tasks
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.2.0
@@ -0,0 +1,24 @@
1
+ Redistribution and use in source and binary forms, with or without modification,
2
+ are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright notice, this
5
+ list of conditions and the following disclaimer.
6
+
7
+ * Redistributions in binary form must reproduce the above copyright notice, this
8
+ list of conditions and the following disclaimer in the documentation and/or
9
+ other materials provided with the distribution.
10
+
11
+ * Neither the name of schillmania.com nor the names of its contributors may be
12
+ used to endorse or promote products derived from this software without
13
+ specific prior written permission from schillmania.com.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
19
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,22 @@
1
+ Redistribution and use in source and binary forms, with or without
2
+ modification, are permitted provided that the following conditions are
3
+ met:
4
+
5
+ * Redistributions of source code must retain the above copyright
6
+ notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,3 @@
1
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
2
+
3
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,16 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ of this software and associated documentation files (the "Software"), to
3
+ deal in the Software without restriction, including without limitation the
4
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5
+ sell copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in
9
+ all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
14
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,17 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ of this software and associated documentation files (the "Software"), to deal
3
+ in the Software without restriction, including without limitation the rights
4
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5
+ copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in
9
+ all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17
+ THE SOFTWARE.
@@ -0,0 +1,8 @@
1
+ Everyone is permitted to copy and distribute verbatim or modified
2
+ copies of this license document, and changing it is allowed as long
3
+ as the name is changed.
4
+
5
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
7
+
8
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
@@ -1,58 +1,17 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
2
+ require 'gem-licenses/version'
5
3
 
6
4
  Gem::Specification.new do |s|
7
- s.name = %q{gem-licenses}
8
- s.version = "0.1.2"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Daniel Doubrovkine"]
12
- s.date = %q{2011-07-27}
13
- s.description = %q{Attempts to figure out what licenses various gems use.}
14
- s.email = %q{dblock@dblock.org}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".rspec",
21
- "Gemfile",
22
- "LICENSE",
23
- "README.md",
24
- "Rakefile",
25
- "VERSION",
26
- "gem-licenses.gemspec",
27
- "lib/gem-licenses.rb",
28
- "lib/gem_licenses.rb",
29
- "lib/gem_specification.rb",
30
- "spec/gem_licenses/gem_licenses_spec.rb",
31
- "spec/spec_helper.rb"
32
- ]
33
- s.homepage = %q{http://github.com/dblock/gem-licenses}
34
- s.licenses = ["MIT"]
35
- s.require_paths = ["lib"]
36
- s.rubygems_version = %q{1.6.2}
37
- s.summary = %q{List all gem licenses.}
38
- s.test_files = [
39
- "spec/gem_licenses/gem_licenses_spec.rb",
40
- "spec/spec_helper.rb"
41
- ]
42
-
43
- if s.respond_to? :specification_version then
44
- s.specification_version = 3
45
-
46
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
- s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
48
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
49
- else
50
- s.add_dependency(%q<rspec>, ["~> 2.5.0"])
51
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
52
- end
53
- else
54
- s.add_dependency(%q<rspec>, ["~> 2.5.0"])
55
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
56
- end
5
+ s.name = 'gem-licenses'
6
+ s.version = Gem::Licenses::VERSION
7
+ s.authors = ['Daniel Doubrovkine']
8
+ s.email = 'dblock@dblock.org'
9
+ s.platform = Gem::Platform::RUBY
10
+ s.required_rubygems_version = '>= 1.3.6'
11
+ s.files = `git ls-files`.split("\n")
12
+ s.test_files = `git ls-files -- spec/*`.split("\n")
13
+ s.require_paths = ['lib']
14
+ s.homepage = 'http://github.com/dblock/gem-licenses'
15
+ s.licenses = ['MIT']
16
+ s.summary = 'Attempts to figure out what licenses various gems use.'
57
17
  end
58
-
@@ -1,3 +1 @@
1
- require 'gem_specification'
2
1
  require 'gem_licenses'
3
-
@@ -0,0 +1,10 @@
1
+ module Gem
2
+ module Licenses
3
+ def self.install_tasks
4
+ spec = Gem::Specification.find_by_name('gem-licenses')
5
+ Dir[File.join(spec.gem_dir, 'tasks/*.rake')].each do |file|
6
+ load file
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,5 @@
1
+ module Gem
2
+ module Licenses
3
+ VERSION = '0.2.0'
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ module Gem
2
+ def self.licenses
3
+ licenses = {}
4
+ config_path = File.expand_path('../../licenses/config.yml', __FILE__)
5
+ config = YAML.load(File.read(config_path))
6
+ Gem.loaded_specs.each do |_key, spec|
7
+ spec.licenses.map(&:downcase).each do |license|
8
+ license_name = config[license] || license
9
+ licenses[license_name] ||= []
10
+ licenses[license_name] << spec
11
+ end
12
+ end
13
+ licenses
14
+ end
15
+ end
@@ -0,0 +1,95 @@
1
+ module Gem
2
+ class Specification
3
+ alias_method :__licenses, :licenses
4
+
5
+ LICENSE_REFERENCES = [
6
+ /released under the (?<l>[\s\w]*) license/i,
7
+ /same license as (?<l>[\s\w]*)/i,
8
+ /^(?<l>[\s\w]*) License, see/i,
9
+ /^(?<l>[\w]*) license$/i,
10
+ /\(the (?<l>[\s\w]*) license\)/i,
11
+ /^license: (?<l>[\s\w]*)/i,
12
+ /^released under the (?<l>[\s\w]*) license/i,
13
+ /license: (?<l>[\s\w]*)$/i,
14
+ /^same as (?<l>[\s\w]*)/i,
15
+ /license of (?<l>[\s\w]*)/i
16
+ ]
17
+
18
+ def licenses
19
+ ary = (__licenses || []).keep_if { |l| l.length > 0 }
20
+ ary.length == 0 ? guess_licenses : ary
21
+ end
22
+
23
+ def guess_licenses
24
+ licenses = []
25
+ Dir.foreach(full_gem_path) do |filename|
26
+ case File.basename(filename, File.extname(filename)).downcase
27
+ when /license/
28
+ parts = filename.split('-')
29
+ return [parts[0].upcase] if parts.length >= 2
30
+ licenses = guess_licenses_from_file File.join(full_gem_path, filename)
31
+ when /copying|readme/
32
+ licenses = guess_licenses_from_file File.join(full_gem_path, filename)
33
+ end
34
+ break if licenses.length > 0
35
+ end
36
+ licenses << 'unknown' if licenses.length == 0
37
+ licenses
38
+ rescue Errno::ENOENT
39
+ # TODO: warning
40
+ []
41
+ end
42
+
43
+ def self.common_licenses
44
+ @common_licenses ||= Hash[
45
+ Dir.glob(File.expand_path('../../../common_licenses/*', __FILE__)).map do |f|
46
+ [File.basename(f), normalize_text(File.read(f))]
47
+ end
48
+ ]
49
+ end
50
+
51
+ def self.normalize_text(text)
52
+ text.downcase.to_s.gsub(/[[:space:]]+/, ' ').gsub(/[[:punct:]]/, '').strip
53
+ rescue ArgumentError
54
+ nil
55
+ end
56
+
57
+ private
58
+
59
+ def guess_licenses_from_file(path)
60
+ licenses = guess_licenses_from_reference(path)
61
+ return licenses if licenses.any?
62
+ guess_licenses_from_contents(path)
63
+ end
64
+
65
+ def guess_licenses_from_reference(path)
66
+ file_handle = File.new(path, 'r')
67
+ begin
68
+ while (line = file_handle.gets)
69
+ line = line.strip
70
+ # positive matches
71
+ LICENSE_REFERENCES.each do |r|
72
+ res = r.match(line)
73
+ return [res['l']] if res
74
+ end
75
+ end
76
+ rescue
77
+ # TODO: warning
78
+ ensure
79
+ file_handle.close
80
+ end
81
+ []
82
+ end
83
+
84
+ def guess_licenses_from_contents(path)
85
+ File.open(path, 'r') do |file|
86
+ contents = file.read
87
+ match, _ = self.class.common_licenses.detect do |_key, lic|
88
+ normalized = self.class.normalize_text(contents)
89
+ normalized.include?(lic) if normalized
90
+ end
91
+ return [match].compact
92
+ end
93
+ end
94
+ end
95
+ end
@@ -1,19 +1,5 @@
1
- module Gem
2
-
3
- require 'gem_specification'
4
-
5
- class << self
6
-
7
- def licenses
8
- licenses = {}
9
- Gem.loaded_specs.each do |key, spec|
10
- spec.licenses.each do |license|
11
- licenses[license.capitalize.to_sym] ||= []
12
- licenses[license.capitalize.to_sym] << spec
13
- end
14
- end
15
- licenses
16
- end
17
-
18
- end
19
- end
1
+ require 'yaml'
2
+ require 'gem-licenses/version'
3
+ require 'gem-licenses/install_tasks'
4
+ require 'gem/specification'
5
+ require 'gem/licenses'
@@ -0,0 +1,37 @@
1
+ mit: MIT
2
+ perl artistic v2: Perl Artistic v2
3
+ artistic 2.0: Perl Artistic v2
4
+ gnu gpl v2: GPLv2
5
+ ruby 1.8: Ruby
6
+ ruby: Ruby
7
+ bsd: BSD
8
+ bsd-2-clause: BSD 2-Clause
9
+ 2-clause bsdl: BSD 2-Clause
10
+ bsd 2-clause: BSD 2-Clause
11
+ gpl2: GPLv2
12
+ gpl-2: GPLv2
13
+ gplv2: GPLv2
14
+ apache 2.0: Apache 2.0
15
+ apache license 2.0: Apache 2.0
16
+ apache-2.0: Apache 2.0
17
+ apache 2: Apache 2.0
18
+ apache license version 2.0: Apache 2.0
19
+ apache: Apache 2.0
20
+ apl 2.0: Apache 2.0
21
+ gpl-3.0: GPLv3
22
+ gpl-3: GPLv3
23
+ gplv3: GPLv3
24
+ lgpl: LGPLv2.1
25
+ LGPLv2.1+: LGPLv2.1
26
+ lgplv2.1+: LGPLv2.1
27
+ gplv2+: GPLv2
28
+ new relic: NewRelic
29
+ isc: ISC
30
+ license: unknown
31
+ wtfpl: WTFPL
32
+ mit-v1: MIT
33
+ mit-v2: MIT
34
+ mit license: MIT
35
+ lgpl-2.1+: LGPLv2.1
36
+ lgpl-3.0: LGPLv3
37
+ lgpl-3: LGPLv3
@@ -0,0 +1,13 @@
1
+ Intro
2
+ ===
3
+
4
+ Background
5
+ ---
6
+
7
+ License
8
+ ---
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,16 @@
1
+ Intro
2
+ ===
3
+
4
+ Background
5
+ ---
6
+
7
+ License
8
+ ---
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+
12
+
13
+
14
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
15
+
16
+ The software is provided 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ Example of characters that don't support down-casing:
2
+
3
+ xml.sample("I�t�rn�ti�n�l")
@@ -0,0 +1,4 @@
1
+ Welcome
2
+ ---
3
+
4
+ This fake gem is released under the BSD license.
@@ -0,0 +1,3 @@
1
+ (c) Copyright Foo Bar, Acme Inc.
2
+
3
+ Same license as Ruby.
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gem do
4
+ subject do
5
+ Gem.licenses
6
+ end
7
+ it 'collects 3rd party licenses' do
8
+ expect(subject.size).to be > 0
9
+ end
10
+ it 'finds an MIT license for itself' do
11
+ expect(subject['MIT'].size).to be > 0
12
+ gem_licenses_spec = Gem::Specification.find_by_name('gem-licenses')
13
+ gem_licenses_mit_spec = subject['MIT'].detect { |spec| spec == gem_licenses_spec }
14
+ expect(gem_licenses_spec).to eq gem_licenses_mit_spec
15
+ end
16
+ it 'normalizes known license names' do
17
+ expect(subject['GPLv2'].size).to be > 0
18
+ end
19
+ end
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gem::Specification do
4
+ def gem_dir(label)
5
+ File.expand_path("../../fixtures/gems/#{label}", __FILE__)
6
+ end
7
+
8
+ let(:spec) { Gem::Specification.new }
9
+
10
+ it 'finds text matching the MIT license in README' do
11
+ allow(spec).to receive(:full_gem_path).and_return(gem_dir('mit_license_in_readme'))
12
+ expect(spec.guess_licenses).to eq(['mit-v2'])
13
+ end
14
+
15
+ it 'tolerates whitespace, capitalization, and punctuation discrepancies' do
16
+ allow(spec).to receive(:full_gem_path).and_return(gem_dir('mit_license_in_readme_with_discrepancies'))
17
+ expect(spec.guess_licenses).to eq(['mit-v2'])
18
+ end
19
+
20
+ it 'matches "released under the ___ license"' do
21
+ allow(spec).to receive(:full_gem_path).and_return(gem_dir('released_under_the_bsd_license'))
22
+ expect(spec.guess_licenses).to eq(['BSD'])
23
+ end
24
+
25
+ it 'matches "same license as ___"' do
26
+ allow(spec).to receive(:full_gem_path).and_return(gem_dir('same_license_as_ruby'))
27
+ expect(spec.guess_licenses).to eq(['Ruby'])
28
+ end
29
+
30
+ it 'gracefully recovers from unparseable files' do
31
+ allow(spec).to receive(:full_gem_path).and_return(gem_dir('nonstandard_characters'))
32
+ expect(spec.guess_licenses).to eq(['unknown'])
33
+ end
34
+ end
@@ -2,5 +2,6 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'rspec'
4
4
 
5
- require File.expand_path("../../lib/gem_licenses", __FILE__)
5
+ require File.expand_path('../../lib/gem_licenses', __FILE__)
6
6
 
7
+ RSpec.configure(&:raise_errors_for_deprecations!)
@@ -0,0 +1,41 @@
1
+ desc 'Gather open-source licenses.'
2
+ namespace :gem do
3
+ task :licenses do
4
+ Gem.licenses.each do |license, gems|
5
+ puts "#{license}"
6
+ puts '=' * license.length
7
+ gems.sort_by(&:name).each do |gem|
8
+ puts "* #{gem.name} #{gem.version} (#{gem.homepage}) - #{gem.summary.strip}"
9
+ puts gem.full_gem_path
10
+ end
11
+ puts ''
12
+ end
13
+ end
14
+
15
+ namespace :licenses do
16
+ task :csv, [:filename] do |_t, args|
17
+ require 'csv'
18
+ filename = File.expand_path(args[:filename], Dir.pwd)
19
+ puts "Writing #{filename} ..."
20
+ licenses = Gem.licenses
21
+ total = 0
22
+ CSV.open(filename, 'w') do |csv|
23
+ csv << %w(name version homepage summary license)
24
+ licenses.each do |license, gems|
25
+ total += gems.count
26
+ gems.sort_by(&:name).each do |gem|
27
+ csv << [gem.name, gem.version, gem.homepage, gem.summary.strip, license]
28
+ end
29
+ end
30
+ end
31
+ puts "Written #{licenses.keys.count} license(s) for #{total} project(s): #{licenses.keys.join(', ')}"
32
+
33
+ if licenses.key?('unknown')
34
+ puts "IMPORTANT: You have #{licenses['unknown'].count} projects without a guessable license!"
35
+ licenses['unknown'].each do |gem|
36
+ puts " #{gem.name}: #{gem.full_gem_path}"
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
metadata CHANGED
@@ -1,88 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-licenses
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Daniel Doubrovkine
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2011-07-27 00:00:00.000000000 -04:00
13
- default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rspec
17
- requirement: &79298890 !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 2.5.0
23
- type: :development
24
- prerelease: false
25
- version_requirements: *79298890
26
- - !ruby/object:Gem::Dependency
27
- name: jeweler
28
- requirement: &79298580 !ruby/object:Gem::Requirement
29
- none: false
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: 1.5.2
34
- type: :development
35
- prerelease: false
36
- version_requirements: *79298580
37
- description: Attempts to figure out what licenses various gems use.
11
+ date: 2015-07-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
38
14
  email: dblock@dblock.org
39
15
  executables: []
40
16
  extensions: []
41
- extra_rdoc_files:
42
- - LICENSE
43
- - README.md
17
+ extra_rdoc_files: []
44
18
  files:
45
- - .rspec
19
+ - ".gitignore"
20
+ - ".rspec"
21
+ - ".rubocop.yml"
22
+ - ".rubocop_todo.yml"
23
+ - ".travis.yml"
24
+ - CHANGELOG.md
25
+ - CONTRIBUTING.md
46
26
  - Gemfile
47
27
  - LICENSE
48
28
  - README.md
49
29
  - Rakefile
50
30
  - VERSION
31
+ - common_licenses/bsd
32
+ - common_licenses/bsd-2-clause
33
+ - common_licenses/isc
34
+ - common_licenses/mit-v1
35
+ - common_licenses/mit-v2
36
+ - common_licenses/wtfpl
51
37
  - gem-licenses.gemspec
52
38
  - lib/gem-licenses.rb
39
+ - lib/gem-licenses/install_tasks.rb
40
+ - lib/gem-licenses/version.rb
41
+ - lib/gem/licenses.rb
42
+ - lib/gem/specification.rb
53
43
  - lib/gem_licenses.rb
54
- - lib/gem_specification.rb
55
- - spec/gem_licenses/gem_licenses_spec.rb
44
+ - lib/licenses/config.yml
45
+ - spec/fixtures/gems/mit_license_in_readme/README.txt
46
+ - spec/fixtures/gems/mit_license_in_readme_with_discrepancies/README.txt
47
+ - spec/fixtures/gems/nonstandard_characters/README.md
48
+ - spec/fixtures/gems/released_under_the_bsd_license/COPYING
49
+ - spec/fixtures/gems/same_license_as_ruby/LICENSE
50
+ - spec/gem/licenses_spec.rb
51
+ - spec/gem/specification_spec.rb
56
52
  - spec/spec_helper.rb
57
- has_rdoc: true
53
+ - tasks/licenses.rake
58
54
  homepage: http://github.com/dblock/gem-licenses
59
55
  licenses:
60
56
  - MIT
57
+ metadata: {}
61
58
  post_install_message:
62
59
  rdoc_options: []
63
60
  require_paths:
64
61
  - lib
65
62
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
63
  requirements:
68
- - - ! '>='
64
+ - - ">="
69
65
  - !ruby/object:Gem::Version
70
66
  version: '0'
71
- segments:
72
- - 0
73
- hash: 64015247
74
67
  required_rubygems_version: !ruby/object:Gem::Requirement
75
- none: false
76
68
  requirements:
77
- - - ! '>='
69
+ - - ">="
78
70
  - !ruby/object:Gem::Version
79
- version: '0'
71
+ version: 1.3.6
80
72
  requirements: []
81
73
  rubyforge_project:
82
- rubygems_version: 1.6.2
74
+ rubygems_version: 2.2.2
83
75
  signing_key:
84
- specification_version: 3
85
- summary: List all gem licenses.
76
+ specification_version: 4
77
+ summary: Attempts to figure out what licenses various gems use.
86
78
  test_files:
87
- - spec/gem_licenses/gem_licenses_spec.rb
79
+ - spec/fixtures/gems/mit_license_in_readme/README.txt
80
+ - spec/fixtures/gems/mit_license_in_readme_with_discrepancies/README.txt
81
+ - spec/fixtures/gems/nonstandard_characters/README.md
82
+ - spec/fixtures/gems/released_under_the_bsd_license/COPYING
83
+ - spec/fixtures/gems/same_license_as_ruby/LICENSE
84
+ - spec/gem/licenses_spec.rb
85
+ - spec/gem/specification_spec.rb
88
86
  - spec/spec_helper.rb
@@ -1,61 +0,0 @@
1
- class Gem::Specification
2
- alias_method :__licenses, :licenses
3
-
4
- def licenses
5
- ary = (__licenses || []).keep_if { |l| l.length > 0 }
6
- ary.length == 0 ? guess_licenses : ary
7
- end
8
-
9
- def guess_licenses
10
- licenses = []
11
- Dir.foreach(full_gem_path) do |filename|
12
- filename_without_extension = File.basename(filename, File.extname(filename)).downcase
13
- if filename_without_extension.include?("license")
14
- parts = filename.split('-')
15
- if (parts.length >= 2)
16
- licenses << parts[0].upcase
17
- else
18
- licenses = guess_licenses_from_file_contents File.join(full_gem_path, filename)
19
- end
20
- elsif filename_without_extension.include?("readme")
21
- licenses = guess_licenses_from_file_contents File.join(full_gem_path, filename)
22
- end
23
- break if licenses.length > 0
24
- end
25
- licenses << :unknown if licenses.length == 0
26
- licenses
27
- end
28
-
29
- private
30
-
31
- def guess_licenses_from_file_contents(path)
32
- licenses = []
33
- file_handle = File.new(path, "r")
34
- begin
35
- while (line = file_handle.gets) && (licenses.size == 0)
36
- line = line.strip
37
- # positive matches
38
- [
39
- /released under the (?<l>[\s\w]*) license/i,
40
- /same license as (?<l>[\s\w]*)/i,
41
- /^(?<l>[\s\w]*) License, see/i,
42
- /^(?<l>[\w]*) license$/i,
43
- /\(the (?<l>[\s\w]*) license\)/i,
44
- /^license: (?<l>[\s\w]*)/i,
45
- /^released under the (?<l>[\s\w]*) license/i,
46
- ].each do |r|
47
- res = Regexp.new(r).match(line)
48
- next unless res
49
- licenses << res['l']
50
- break
51
- end
52
- end
53
- rescue
54
- # TODO: warning
55
- end
56
- file_handle.close
57
- licenses
58
- end
59
-
60
- end
61
-
@@ -1,10 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gem do
4
- it "collects 3rd party licenses" do
5
- licenses = Gem.licenses
6
- licenses.size.should == 2
7
- licenses[:Mit].size.should == 7
8
- licenses[:Unknown].size.should == 2
9
- end
10
- end