gem-licenses 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +7 -0
- data/.rubocop_todo.yml +22 -16
- data/.travis.yml +4 -4
- data/CHANGELOG.md +2 -2
- data/CONTRIBUTING.md +9 -7
- data/Gemfile +2 -2
- data/README.md +5 -4
- data/Rakefile +1 -1
- data/lib/gem-licenses/version.rb +1 -1
- data/lib/gem/licenses.rb +2 -2
- data/lib/gem/specification.rb +8 -8
- data/lib/licenses/config.yml +2 -1
- data/spec/gem/licenses_spec.rb +1 -0
- data/tasks/licenses.rake +3 -3
- metadata +3 -4
- data/VERSION +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 822e6db6df0f53b90818db751e9476cbf6b5b5bfde69673c54b0444b5761c0b7
|
4
|
+
data.tar.gz: f090d8718658f5b3f95a0ec6aae9cbdb8c67955b9bd10e6f7fe146db794e404c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3a7e50d6f28af9e98f7ff8967b5e828182a13340ef979ae169cb984382e015619a051eb2bd4e3f93e0bfeffc077f62d9d4fd6963a5339905d9d4431e920e584
|
7
|
+
data.tar.gz: 560bceec5cc8a43e52df4a368a01b40d8a95f7a10f0c1bb3f3751a39a01a2841ff2f4df97cf4f69cfb914e58851d701e15f755a850803d94dffda86ddcc34a52
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
#
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-11-02 19:09:46 +0100 using RuboCop version 0.51.0.
|
3
4
|
# The point is for the user to remove these configuration records
|
4
5
|
# one by one as the offenses are removed from the code base.
|
5
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -7,35 +8,40 @@
|
|
7
8
|
|
8
9
|
# Offense count: 1
|
9
10
|
Lint/HandleExceptions:
|
10
|
-
|
11
|
+
Exclude:
|
12
|
+
- 'lib/gem/specification.rb'
|
11
13
|
|
12
14
|
# Offense count: 1
|
13
15
|
Metrics/AbcSize:
|
14
|
-
Max:
|
16
|
+
Max: 21
|
15
17
|
|
16
18
|
# Offense count: 1
|
17
19
|
Metrics/CyclomaticComplexity:
|
18
20
|
Max: 7
|
19
21
|
|
20
|
-
# Offense count:
|
21
|
-
# Configuration parameters: AllowURI, URISchemes.
|
22
|
+
# Offense count: 11
|
23
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
24
|
+
# URISchemes: http, https
|
22
25
|
Metrics/LineLength:
|
23
26
|
Max: 107
|
24
27
|
|
25
28
|
# Offense count: 3
|
26
29
|
# Configuration parameters: CountComments.
|
27
30
|
Metrics/MethodLength:
|
28
|
-
Max:
|
31
|
+
Max: 16
|
29
32
|
|
30
33
|
# Offense count: 1
|
31
|
-
|
32
|
-
|
34
|
+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
35
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
36
|
+
Naming/FileName:
|
37
|
+
Exclude:
|
38
|
+
- 'lib/gem-licenses.rb'
|
33
39
|
|
34
|
-
# Offense count:
|
40
|
+
# Offense count: 3
|
35
41
|
Style/Documentation:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
Exclude:
|
43
|
+
- 'spec/**/*'
|
44
|
+
- 'test/**/*'
|
45
|
+
- 'lib/gem-licenses/install_tasks.rb'
|
46
|
+
- 'lib/gem/licenses.rb'
|
47
|
+
- 'lib/gem/specification.rb'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -10,7 +10,7 @@ In the examples below, substitute your Github username for `contributor` in URLs
|
|
10
10
|
|
11
11
|
Fork the [project on Github](https://github.com/dblock/gem-licenses) and check out your copy.
|
12
12
|
|
13
|
-
```
|
13
|
+
```shell
|
14
14
|
git clone https://github.com/contributor/gem-licenses.git
|
15
15
|
cd gem-licenses
|
16
16
|
git remote add upstream https://github.com/dblock/gem-licenses.git
|
@@ -20,7 +20,7 @@ git remote add upstream https://github.com/dblock/gem-licenses.git
|
|
20
20
|
|
21
21
|
Make sure your fork is up-to-date and create a topic branch for your feature or bug fix.
|
22
22
|
|
23
|
-
```
|
23
|
+
```shell
|
24
24
|
git checkout master
|
25
25
|
git pull upstream master
|
26
26
|
git checkout -b my-feature-branch
|
@@ -30,7 +30,7 @@ git checkout -b my-feature-branch
|
|
30
30
|
|
31
31
|
Ensure that you can build the project and run tests.
|
32
32
|
|
33
|
-
```
|
33
|
+
```shell
|
34
34
|
bundle install
|
35
35
|
bundle exec rake
|
36
36
|
```
|
@@ -59,13 +59,13 @@ Make it look like every other line, including your name and link to your Github
|
|
59
59
|
|
60
60
|
## Push
|
61
61
|
|
62
|
-
```
|
62
|
+
```shell
|
63
63
|
git push origin my-feature-branch
|
64
64
|
```
|
65
65
|
|
66
66
|
## Make a Pull Request
|
67
67
|
|
68
|
-
Go to https://github.com/contributor/
|
68
|
+
Go to https://github.com/contributor/gem-licenses and select your feature branch.
|
69
69
|
Click the 'Pull Request' button and fill out the form. Pull requests are usually reviewed within a few days.
|
70
70
|
|
71
71
|
## Update CHANGELOG Again
|
@@ -78,14 +78,16 @@ Update the [CHANGELOG](CHANGELOG.md) with the pull request number. A typical ent
|
|
78
78
|
|
79
79
|
Amend your previous commit and force push the changes.
|
80
80
|
|
81
|
-
```
|
81
|
+
```shell
|
82
82
|
git commit --amend
|
83
83
|
git push origin my-feature-branch -f
|
84
|
+
```
|
85
|
+
|
84
86
|
## Rebase
|
85
87
|
|
86
88
|
If you've been working on a change for a while, rebase with upstream/master.
|
87
89
|
|
88
|
-
```
|
90
|
+
```shell
|
89
91
|
git fetch upstream
|
90
92
|
git rebase upstream/master
|
91
93
|
git push origin my-feature-branch -f
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Usage
|
|
19
19
|
|
20
20
|
Include gem-licenses in your project's Gemfile.
|
21
21
|
|
22
|
-
```
|
22
|
+
```ruby
|
23
23
|
group :development, :test do
|
24
24
|
gem 'gem-licenses'
|
25
25
|
end
|
@@ -27,19 +27,20 @@ end
|
|
27
27
|
|
28
28
|
Install Rake tasks from Rakefile.
|
29
29
|
|
30
|
-
```
|
30
|
+
```ruby
|
31
|
+
require 'gem-licenses'
|
31
32
|
Gem::GemLicenses.install_tasks
|
32
33
|
```
|
33
34
|
|
34
35
|
To list licenses try the following Rake task.
|
35
36
|
|
36
|
-
```
|
37
|
+
```shell
|
37
38
|
rake gem:licenses
|
38
39
|
```
|
39
40
|
|
40
41
|
To write a CSV file of gems + licenses.
|
41
42
|
|
42
|
-
```
|
43
|
+
```shell
|
43
44
|
rake gem:licenses:csv['licenses.csv']
|
44
45
|
```
|
45
46
|
|
data/Rakefile
CHANGED
data/lib/gem-licenses/version.rb
CHANGED
data/lib/gem/licenses.rb
CHANGED
@@ -2,8 +2,8 @@ module Gem
|
|
2
2
|
def self.licenses
|
3
3
|
licenses = {}
|
4
4
|
config_path = File.expand_path('../../licenses/config.yml', __FILE__)
|
5
|
-
config = YAML.
|
6
|
-
Gem.loaded_specs.
|
5
|
+
config = YAML.safe_load(File.read(config_path))
|
6
|
+
Gem.loaded_specs.each_value do |spec|
|
7
7
|
spec.licenses.map(&:downcase).each do |license|
|
8
8
|
license_name = config[license] || license
|
9
9
|
licenses[license_name] ||= []
|
data/lib/gem/specification.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Gem
|
2
2
|
class Specification
|
3
|
-
|
3
|
+
alias __licenses licenses
|
4
4
|
|
5
5
|
LICENSE_REFERENCES = [
|
6
6
|
/released under the (?<l>[\s\w]*) license/i,
|
@@ -13,11 +13,11 @@ module Gem
|
|
13
13
|
/license: (?<l>[\s\w]*)$/i,
|
14
14
|
/^same as (?<l>[\s\w]*)/i,
|
15
15
|
/license of (?<l>[\s\w]*)/i
|
16
|
-
]
|
16
|
+
].freeze
|
17
17
|
|
18
18
|
def licenses
|
19
|
-
ary = (__licenses || []).keep_if { |l| l.
|
20
|
-
ary.
|
19
|
+
ary = (__licenses || []).keep_if { |l| !l.empty? }
|
20
|
+
ary.empty? ? guess_licenses : ary
|
21
21
|
end
|
22
22
|
|
23
23
|
def guess_licenses
|
@@ -31,9 +31,9 @@ module Gem
|
|
31
31
|
when /copying|readme/
|
32
32
|
licenses = guess_licenses_from_file File.join(full_gem_path, filename)
|
33
33
|
end
|
34
|
-
break
|
34
|
+
break unless licenses.empty?
|
35
35
|
end
|
36
|
-
licenses << 'unknown' if licenses.
|
36
|
+
licenses << 'unknown' if licenses.empty?
|
37
37
|
licenses
|
38
38
|
rescue Errno::ENOENT
|
39
39
|
# TODO: warning
|
@@ -73,7 +73,7 @@ module Gem
|
|
73
73
|
return [res['l']] if res
|
74
74
|
end
|
75
75
|
end
|
76
|
-
rescue
|
76
|
+
rescue StandardError
|
77
77
|
# TODO: warning
|
78
78
|
ensure
|
79
79
|
file_handle.close
|
@@ -84,7 +84,7 @@ module Gem
|
|
84
84
|
def guess_licenses_from_contents(path)
|
85
85
|
File.open(path, 'r') do |file|
|
86
86
|
contents = file.read
|
87
|
-
match,
|
87
|
+
match, = self.class.common_licenses.detect do |_key, lic|
|
88
88
|
normalized = self.class.normalize_text(contents)
|
89
89
|
normalized.include?(lic) if normalized
|
90
90
|
end
|
data/lib/licenses/config.yml
CHANGED
data/spec/gem/licenses_spec.rb
CHANGED
data/tasks/licenses.rake
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
desc 'Gather open-source licenses.'
|
2
2
|
namespace :gem do
|
3
3
|
task :licenses do
|
4
|
-
Gem.licenses.each do |license, gems|
|
5
|
-
puts
|
4
|
+
Gem.licenses.sort_by { |k, v| [-v.count, k] }.each do |license, gems|
|
5
|
+
puts license.to_s
|
6
6
|
puts '=' * license.length
|
7
7
|
gems.sort_by(&:name).each do |gem|
|
8
8
|
puts "* #{gem.name} #{gem.version} (#{gem.homepage}) - #{gem.summary.strip}"
|
@@ -20,7 +20,7 @@ namespace :gem do
|
|
20
20
|
licenses = Gem.licenses
|
21
21
|
total = 0
|
22
22
|
CSV.open(filename, 'w') do |csv|
|
23
|
-
csv << %w
|
23
|
+
csv << %w[name version homepage summary license]
|
24
24
|
licenses.each do |license, gems|
|
25
25
|
total += gems.count
|
26
26
|
gems.sort_by(&:name).each do |gem|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-licenses
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: dblock@dblock.org
|
@@ -28,7 +28,6 @@ files:
|
|
28
28
|
- README.md
|
29
29
|
- RELEASING.md
|
30
30
|
- Rakefile
|
31
|
-
- VERSION
|
32
31
|
- common_licenses/bsd
|
33
32
|
- common_licenses/bsd-2-clause
|
34
33
|
- common_licenses/isc
|
@@ -72,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
71
|
version: 1.3.6
|
73
72
|
requirements: []
|
74
73
|
rubyforge_project:
|
75
|
-
rubygems_version: 2.
|
74
|
+
rubygems_version: 2.7.3
|
76
75
|
signing_key:
|
77
76
|
specification_version: 4
|
78
77
|
summary: Attempts to figure out what licenses various gems use.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.1
|