licensed 1.3.1 → 1.3.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
2
  SHA1:
3
- metadata.gz: 99d4424d324ded01c5f13692ae1b5a9734b9416d
4
- data.tar.gz: dd71bfbd16503bdf6546b6288df73fe17553fbc3
3
+ metadata.gz: 877368e57ede0682327f09bcfcea106b6f34ac3a
4
+ data.tar.gz: 44e24e3dab3df7507ff805cd3eccc10591827586
5
5
  SHA512:
6
- metadata.gz: 960f003a12c192fef141896c3e7e2e65c50c3adc4c5805f531575da15e56408c278e86abb099974c7b1f595664ad2fd16dcf44345d048be6c4f82124af035b7b
7
- data.tar.gz: d7876610c8d0f856b71a10d7693cb5585500a0ee4e9543472857faeac2e3923c27cf04a17d3ad5d901ee7d105e5f6481528d195ffb9b51dc41eb6e9126da1305
6
+ metadata.gz: 7891002cbec39b405c48498b93be1fe6b261ef88815673f5efc2b0a0fdf9410afbfb374bc41f2bf3030e4afe3505cc2ea9002d969693c32e78960e7044d01855
7
+ data.tar.gz: 3f254744732b945cd9df93f1c113ca424844200c1cc5686687108af7907cc2cc5d37a719b4b94800703b0f25f52eeabd4c535c0e3b54415e60c36e5afc8db684
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## 1.3.2 - 2018-08-15
10
+ ### Fixed
11
+ - Fixed issue when multiple versions of a cabal package are found
12
+
9
13
  ## 1.3.1 - 2018-08-01
10
14
  ### Fixed
11
15
  - Fixed regression finding ruby gems by path
@@ -64,4 +68,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
64
68
 
65
69
  Initial release :tada:
66
70
 
67
- [Unreleased]: https://github.com/github/licensed/compare/1.3.1...HEAD
71
+ [Unreleased]: https://github.com/github/licensed/compare/1.3.2...HEAD
@@ -66,7 +66,7 @@ module Licensed
66
66
 
67
67
  # Returns a `Set` of the package ids for all cabal dependencies
68
68
  def package_ids
69
- recursive_dependencies(cabal_file_dependencies)
69
+ recursive_dependencies(cabal_file_dependency_ids)
70
70
  end
71
71
 
72
72
  # Recursively finds the dependencies for each cabal package.
@@ -151,29 +151,35 @@ module Licensed
151
151
  end
152
152
 
153
153
  # Returns a set containing the top-level dependencies found in cabal files
154
+ def cabal_file_dependency_ids
155
+ cabal_file_dependencies.map { |target| cabal_package_id(target) }.compact
156
+ end
157
+
154
158
  def cabal_file_dependencies
155
- cabal_files.each_with_object(Set.new) do |cabal_file, packages|
159
+ @cabal_file_dependencies ||= cabal_files.each_with_object(Set.new) do |cabal_file, targets|
156
160
  content = File.read(cabal_file)
157
161
  next if content.nil? || content.empty?
158
162
 
159
163
  # add any dependencies for matched targets from the cabal file.
160
164
  # by default this will find executable and library dependencies
161
165
  content.scan(cabal_file_regex).each do |match|
162
- # match[1] is a string of "," separated dependencies
163
- dependencies = match[1].split(",").map(&:strip)
164
- dependencies.each do |dep|
165
- # the dependency might have a version specifier.
166
- # remove it so we can get the full id specifier for each package
167
- id = cabal_package_id(dep.split(/\s/)[0])
168
- packages.add(id) if id
169
- end
166
+ # match[1] is a string of "," separated dependencies.
167
+ # dependency packages might have a version specifier, remove them
168
+ # to get the full id specifier for each package
169
+ dependencies = match[1].split(",").map { |dep| dep.strip.split(/\s/)[0] }
170
+ targets.merge(dependencies)
170
171
  end
171
172
  end
172
173
  end
173
174
 
174
175
  # Returns an installed package id for the package.
175
176
  def cabal_package_id(package_name)
176
- field = ghc_pkg_field_command(package_name, ["id"])
177
+ # using the first returned id assumes that package resolvers
178
+ # order returned package information in the same order that it would
179
+ # be used during build
180
+ field = ghc_pkg_field_command(package_name, ["id"]).lines.first
181
+ return unless field
182
+
177
183
  id = field.split(":", 2)[1]
178
184
  id.strip if id
179
185
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Licensed
3
- VERSION = "1.3.1".freeze
3
+ VERSION = "1.3.2".freeze
4
4
  end
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: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-01 00:00:00.000000000 Z
11
+ date: 2018-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: licensee