licensed 2.0.0 → 2.0.1

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
2
  SHA1:
3
- metadata.gz: cd572795c842f263e5fc3c180b1bf716404b9021
4
- data.tar.gz: '094c5d5227704cbac518df12e20b05456a4bba03'
3
+ metadata.gz: c0f8ca7a1d4607f4051c9347ce5d9de2b42fa46f
4
+ data.tar.gz: 9a0aee1b3d112ca9c57ea0ec74db1c91e62048cd
5
5
  SHA512:
6
- metadata.gz: be757c8f540285eaa610799963f184522e923c14bdb54d6250709511a13e6f08d3cac1da1e72b5d625687a5b0b4b874cfab50f8589ad3614cf2673a8b1781766
7
- data.tar.gz: 836885af14623a25feb9ebaf8a697a9c7878bd9bc839615c4dc5e685f913059ddeb93b122b9b7ba19a2419965b2a8009c2d6f8594cbafcba922f2259505d1a72
6
+ metadata.gz: 3e9c5fcd573bbe2bd7a275ac60ae90423d207b87673d900e95322404081f2aefd7db237aef8f582a5bf51b9e007e271e49a28b8cb73e7df612c5e5559b8c9954
7
+ data.tar.gz: ea703164f15583a9eb0728055a2443ddde2e14e53a0b93fae2dcada23ca64b926f8e4821ad1c76edf0397a3af8abd0540790084e3d93e741b2cb1fadaff7f4d8
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 2.0.1 - 2019-02-14
10
+
11
+ ### Changes
12
+ - Dependency paths that don't exist on the local disk are reported as warnings
13
+ - Cache, status and list output is sorted by app name, source type and dependency name
14
+ - Bumped `licensee` gem requirement
15
+
9
16
  ## 2.0.0 - 2019-02-09
10
17
 
11
18
  **This is a major release and includes breaking changes to the configuration and cached record file formats**
@@ -133,4 +140,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
133
140
 
134
141
  Initial release :tada:
135
142
 
136
- [Unreleased]: https://github.com/github/licensed/compare/2.0.0...HEAD
143
+ [Unreleased]: https://github.com/github/licensed/compare/2.0.1...HEAD
@@ -41,6 +41,10 @@ module Licensed
41
41
  report["cached"] = true
42
42
  end
43
43
 
44
+ if !dependency.exist?
45
+ report.warnings << "expected dependency path #{dependency.path} does not exist"
46
+ end
47
+
44
48
  true
45
49
  end
46
50
 
@@ -20,7 +20,9 @@ module Licensed
20
20
  @options = options
21
21
  begin
22
22
  result = reporter.report_run(self) do
23
- config.apps.map { |app| run_app(app) }.all?
23
+ config.apps.sort_by { |app| app["name"] }
24
+ .map { |app| run_app(app) }
25
+ .all?
24
26
  end
25
27
  ensure
26
28
  @options = nil
@@ -41,7 +43,9 @@ module Licensed
41
43
  reporter.report_app(app) do |report|
42
44
  Dir.chdir app.source_path do
43
45
  begin
44
- app.sources.select(&:enabled?).map { |source| run_source(app, source) }.all?
46
+ app.sources.select(&:enabled?)
47
+ .sort_by { |source| source.class.type }
48
+ .map { |source| run_source(app, source) }.all?
45
49
  rescue Licensed::Shell::Error => err
46
50
  report.errors << err.message
47
51
  false
@@ -60,7 +64,9 @@ module Licensed
60
64
  def run_source(app, source)
61
65
  reporter.report_source(source) do |report|
62
66
  begin
63
- source.dependencies.map { |dependency| run_dependency(app, source, dependency) }.all?
67
+ source.dependencies.sort_by { |dependency| dependency.name }
68
+ .map { |dependency| run_dependency(app, source, dependency) }
69
+ .all?
64
70
  rescue Licensed::Shell::Error => err
65
71
  report.errors << err.message
66
72
  false
@@ -23,9 +23,8 @@ module Licensed
23
23
  def initialize(name:, version:, path:, search_root: nil, metadata: {}, errors: [])
24
24
  # check the path for default errors if no other errors
25
25
  # were found when loading the dependency
26
- if errors.empty?
27
- path_error = path_error(path, search_root)
28
- errors.push(path_error) if path_error
26
+ if errors.empty? && path.to_s.empty?
27
+ errors.push("dependency path not found")
29
28
  end
30
29
 
31
30
  @name = name
@@ -47,6 +46,21 @@ module Licensed
47
46
  super(path, search_root: search_root, detect_readme: true, detect_packages: true)
48
47
  end
49
48
 
49
+ # Returns whether the dependency exists locally
50
+ def exist?
51
+ # some types of dependencies won't necessarily have a path that exists,
52
+ # but they can still find license contents between the given path and
53
+ # the search root
54
+ # @root is defined
55
+ path.exist? || File.exist?(@root)
56
+ end
57
+
58
+ # Returns the location of this dependency on the local disk
59
+ def path
60
+ # exposes the private method Licensee::Projects::FSProject#dir_path
61
+ dir_path
62
+ end
63
+
50
64
  # Returns true if the dependency has any errors, false otherwise
51
65
  def errors?
52
66
  errors.any?
@@ -96,17 +110,6 @@ module Licensed
96
110
 
97
111
  private
98
112
 
99
- def path_error(path, search_root)
100
- return "dependency path not found" if path.to_s.empty?
101
- return if File.exist?(path)
102
- return if search_root && File.exist?(search_root)
103
-
104
- # if the given path doesn't exist
105
- # AND a search root isn't given, or the search root doesn't exist
106
- # then set an error that the expected dependency path doesn't exist
107
- "expected dependency path #{path} does not exist"
108
- end
109
-
110
113
  # Returns the sources for a group of license or notice file contents
111
114
  #
112
115
  # Sources are returned as a single string with sources separated by ", "
@@ -27,6 +27,22 @@ module Licensed
27
27
  shell.info " #{source.class.type}"
28
28
  result = yield report
29
29
 
30
+ warning_reports = report.all_reports.select { |report| report.warnings.any? }.to_a
31
+ if warning_reports.any?
32
+ shell.newline
33
+ shell.warn " * Warnings:"
34
+ warning_reports.each do |report|
35
+ display_metadata = report.map { |k, v| "#{k}: #{v}" }.join(", ")
36
+
37
+ shell.warn " * #{report.name}"
38
+ shell.warn " #{display_metadata}" unless display_metadata.empty?
39
+ report.warnings.each do |warning|
40
+ shell.warn " - #{warning}"
41
+ end
42
+ shell.newline
43
+ end
44
+ end
45
+
30
46
  errored_reports = report.all_reports.select { |report| report.errors.any? }.to_a
31
47
  if errored_reports.any?
32
48
  shell.newline
@@ -19,6 +19,10 @@ module Licensed
19
19
  @errors ||= []
20
20
  end
21
21
 
22
+ def warnings
23
+ @warnings ||= []
24
+ end
25
+
22
26
  def all_reports
23
27
  result = []
24
28
  result << self
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Licensed
3
- VERSION = "2.0.0".freeze
3
+ VERSION = "2.0.1".freeze
4
4
 
5
5
  def self.previous_major_versions
6
6
  major_version = Gem::Version.new(Licensed::VERSION).segments.first
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.required_ruby_version = ">= 2.3.0"
25
25
 
26
- spec.add_dependency "licensee", "~> 9.0"
26
+ spec.add_dependency "licensee", "~> 9.10"
27
27
  spec.add_dependency "thor", "~> 0.19"
28
28
  spec.add_dependency "pathname-common_prefix", "~> 0.0.1"
29
29
  spec.add_dependency "tomlrb", "~> 1.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensed
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-11 00:00:00.000000000 Z
11
+ date: 2019-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: licensee
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '9.0'
19
+ version: '9.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '9.0'
26
+ version: '9.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: thor
29
29
  requirement: !ruby/object:Gem::Requirement