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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e25c2c59d98ae5182e7d558f673a20736a83001c
4
- data.tar.gz: 72a3c6587573bd014d345eacc3417c945fc76005
2
+ SHA256:
3
+ metadata.gz: 822e6db6df0f53b90818db751e9476cbf6b5b5bfde69673c54b0444b5761c0b7
4
+ data.tar.gz: f090d8718658f5b3f95a0ec6aae9cbdb8c67955b9bd10e6f7fe146db794e404c
5
5
  SHA512:
6
- metadata.gz: 867c045c697593fe444bfee464d3efca397d36e68125e31fa527fbf7f0b2dc1ec3bbc6c557b33e62f3e492ad25d3ab348fcdf1d9e8835d555281d14f27a4f1cb
7
- data.tar.gz: e61205a3e28641d52b5c2f252a51fc3a0cd0e01a74bcd14a283a820920a5366e8de0502a698d7b2b3cb5bcf32e62534330bbb0c17547ed1392a89f335e367a18
6
+ metadata.gz: b3a7e50d6f28af9e98f7ff8967b5e828182a13340ef979ae169cb984382e015619a051eb2bd4e3f93e0bfeffc077f62d9d4fd6963a5339905d9d4431e920e584
7
+ data.tar.gz: 560bceec5cc8a43e52df4a368a01b40d8a95f7a10f0c1bb3f3751a39a01a2841ff2f4df97cf4f69cfb914e58851d701e15f755a850803d94dffda86ddcc34a52
@@ -1,5 +1,12 @@
1
1
  AllCops:
2
+ TargetRubyVersion: 2.2
3
+ DisplayCopNames: true
4
+ DisplayStyleGuide: true
2
5
  Exclude:
3
6
  - vendor/**/*
4
7
 
8
+ Metrics/BlockLength:
9
+ Exclude:
10
+ - tasks/*.rake
11
+
5
12
  inherit_from: .rubocop_todo.yml
@@ -1,5 +1,6 @@
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.
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
- Enabled: false
11
+ Exclude:
12
+ - 'lib/gem/specification.rb'
11
13
 
12
14
  # Offense count: 1
13
15
  Metrics/AbcSize:
14
- Max: 26
16
+ Max: 21
15
17
 
16
18
  # Offense count: 1
17
19
  Metrics/CyclomaticComplexity:
18
20
  Max: 7
19
21
 
20
- # Offense count: 8
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: 24
31
+ Max: 16
29
32
 
30
33
  # Offense count: 1
31
- Metrics/PerceivedComplexity:
32
- Max: 9
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: 4
40
+ # Offense count: 3
35
41
  Style/Documentation:
36
- Enabled: false
37
-
38
- # Offense count: 1
39
- # Configuration parameters: Exclude.
40
- Style/FileName:
41
- Enabled: false
42
+ Exclude:
43
+ - 'spec/**/*'
44
+ - 'test/**/*'
45
+ - 'lib/gem-licenses/install_tasks.rb'
46
+ - 'lib/gem/licenses.rb'
47
+ - 'lib/gem/specification.rb'
@@ -1,9 +1,9 @@
1
+ language: ruby
1
2
  sudo: false
2
3
 
3
4
  rvm:
4
- - 2.1.2
5
- - 2.3.1
6
-
7
- language: ruby
5
+ - 2.2.7
6
+ - 2.3.4
7
+ - 2.4.1
8
8
 
9
9
  cache: bundler
@@ -1,6 +1,6 @@
1
- #### 0.2.2 (Next)
1
+ #### 0.2.2 (2/16/2018)
2
2
 
3
- * Your contribution here.
3
+ * [#18](https://github.com/dblock/gem-licenses/pull/18): Make order of rake gem:licenses deterministic - [@edennis](https://github.com/edennis).
4
4
 
5
5
  #### 0.2.1 (5/31/2016)
6
6
 
@@ -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/grape and select your feature branch.
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
@@ -4,6 +4,6 @@ gemspec
4
4
 
5
5
  group :development do
6
6
  gem 'rake'
7
- gem 'rspec', '~> 3.1'
8
- gem 'rubocop', '0.29.1'
7
+ gem 'rspec', '~> 3.7'
8
+ gem 'rubocop', '0.51.0'
9
9
  end
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
@@ -11,7 +11,7 @@ RSpec::Core::RakeTask.new(:spec)
11
11
  require 'rubocop/rake_task'
12
12
  RuboCop::RakeTask.new(:rubocop)
13
13
 
14
- task default: [:rubocop, :spec]
14
+ task default: %i[rubocop spec]
15
15
 
16
16
  require 'rake'
17
17
 
@@ -1,5 +1,5 @@
1
1
  module Gem
2
2
  module GemLicenses
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'.freeze
4
4
  end
5
5
  end
@@ -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.load(File.read(config_path))
6
- Gem.loaded_specs.each do |_key, spec|
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] ||= []
@@ -1,6 +1,6 @@
1
1
  module Gem
2
2
  class Specification
3
- alias_method :__licenses, :licenses
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.length > 0 }
20
- ary.length == 0 ? guess_licenses : 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 if licenses.length > 0
34
+ break unless licenses.empty?
35
35
  end
36
- licenses << 'unknown' if licenses.length == 0
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, _ = self.class.common_licenses.detect do |_key, lic|
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
@@ -8,8 +8,9 @@ bsd: BSD
8
8
  bsd-2-clause: BSD 2-Clause
9
9
  2-clause bsdl: BSD 2-Clause
10
10
  bsd 2-clause: BSD 2-Clause
11
- gpl2: GPLv2
11
+ gpl-2.0+: GPLv2
12
12
  gpl-2: GPLv2
13
+ gpl2: GPLv2
13
14
  gplv2: GPLv2
14
15
  apache 2.0: Apache 2.0
15
16
  apache license 2.0: Apache 2.0
@@ -13,6 +13,7 @@ describe Gem do
13
13
  gem_licenses_mit_spec = subject['MIT'].detect { |spec| spec == gem_licenses_spec }
14
14
  expect(gem_licenses_spec).to eq gem_licenses_mit_spec
15
15
  end
16
+
16
17
  it 'normalizes known license names' do
17
18
  expect(subject['GPLv2'].size).to be > 0
18
19
  end
@@ -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 "#{license}"
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(name version homepage summary license)
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.1
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: 2016-05-31 00:00:00.000000000 Z
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.4.5
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