license_scout 2.0.14 → 2.1.0

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
  SHA256:
3
- metadata.gz: 57d85e891dfcbaa756c9b16bc500c42e9fbfa0640015965f33fc08939d70c554
4
- data.tar.gz: f84feb4e5c5efa5cb213b64948d27c95beb3b2ee9a0f543bf1a6e231a0f9c595
3
+ metadata.gz: 9424ab5a07b97ad3aae865f34272ef0929133dc59a2a2517099733b9f52b2d5d
4
+ data.tar.gz: 49b5eef3a1c45e5d4941ef213f58e3530151357ab832dd9c5b69014148191543
5
5
  SHA512:
6
- metadata.gz: 111165550c1cf078c48bc5c1878e3e4529c9abafcb3d4731696cc51c2f779829abe6b8efd6e6269ff483c9c54c44d2647b4a70d2777cefabb0c098edcdf71d4f
7
- data.tar.gz: 67cb097807cd8cbfddd5ab0bc2c2f45acb51997d4446c9520edf6fcad472703633fee290c9899f865307951ee82ee35c49423bc5106765a2577e9c2796f5a568
6
+ metadata.gz: 0b4e3b501de6f26ec2f01b7a99f9b27620761ba183bc14be7febb6b8a3a54830ec3f3ec064e9fab64469359d44fbc5ae6f5ae91e41ab1537da20fff29c23f1f0
7
+ data.tar.gz: 42310f9e3474e7b07242103e2f00295063ab87101417e89aa758a436b926959fb2dc8e297e086f9c16d755551001d745b3dd36c032ae9c4a1143b2dd894c828a
data/README.md CHANGED
@@ -179,6 +179,22 @@ license_content | A URL to a file where the raw text of the license can be downl
179
179
 
180
180
  In addition to including any files Licensee identified as potential license files (but couldn't identify), License Scout will also include the Fallback License you specified in the Dependency Manifest.
181
181
 
182
+ ## Habitat Channel Configuration
183
+
184
+ By default License Scout searches for Habitat package in the `stable`
185
+ channel. If your build process publishes packages to another channel
186
+ by default, you can use the `channel_for_origin` habitat configuration
187
+ option:
188
+
189
+ ```yaml
190
+ habitat:
191
+ channel_for_origin:
192
+ - origin: yourorigin
193
+ channel: dev
194
+ - origin: someotherorigin
195
+ channel: prod
196
+ ```
197
+
182
198
  ## Exporting a Dependency Manifest to another format
183
199
 
184
200
  By default, License Scout creates the Dependency Manifest as a JSON file. We do this because it provides a single document that can be easily processed into many different forms. License Scout has the ability to also export that JSON file into other formats.
@@ -223,4 +239,3 @@ Pull requests in this project are merged when they have two :+1:s from maintaine
223
239
 
224
240
  - [Dan DeLeo](https://github.com/danielsdeleo)
225
241
  - [Tom Duffield](https://github.com/tduffield)
226
-
@@ -62,6 +62,10 @@ module LicenseScout
62
62
  default :ruby, []
63
63
  end
64
64
 
65
+ config_context :habitat do
66
+ default :channel_for_origin, []
67
+ end
68
+
65
69
  # Runtime Parameters - if you add any bins, make sure to update the habitat/plan.sh
66
70
  # to ensure we override the defaults to scope to the Habitat path
67
71
  default :environment, {}
@@ -23,6 +23,7 @@ require "mixlib/shellout"
23
23
  module LicenseScout
24
24
  module DependencyManager
25
25
  class Habitat < Base
26
+ DEFAULT_CHANNEL = "stable".freeze
26
27
 
27
28
  def name
28
29
  "habitat"
@@ -53,13 +54,14 @@ module LicenseScout
53
54
 
54
55
  tdeps.sort.map do |tdep|
55
56
  o, n, v, r = tdep.split("/")
57
+ c = channel_for_origin(o)
56
58
  dep_name = "#{o}/#{n}"
57
59
  dep_version = "#{v}-#{r}"
58
60
 
59
61
  dependency = new_dependency(dep_name, dep_version, nil)
60
62
 
61
63
  license_from_manifest(pkg_info(tdep)["manifest"]).each do |spdx|
62
- dependency.add_license(spdx, "https://bldr.habitat.sh/v1/depot/channels/#{o}/stable/pkgs/#{n}/#{v}/#{r}")
64
+ dependency.add_license(spdx, "https://bldr.habitat.sh/v1/depot/channels/#{o}/#{c}/pkgs/#{n}/#{v}/#{r}")
63
65
  end
64
66
 
65
67
  dependency
@@ -94,8 +96,9 @@ module LicenseScout
94
96
  $habitat_pkg_info ||= {}
95
97
  $habitat_pkg_info[pkg_ident] ||= begin
96
98
  pkg_origin, pkg_name, pkg_version, pkg_release = pkg_ident.split("/")
99
+ pkg_channel = channel_for_origin(pkg_origin)
97
100
 
98
- base_api_uri = "https://bldr.habitat.sh/v1/depot/channels/#{pkg_origin}/stable/pkgs/#{pkg_name}"
101
+ base_api_uri = "https://bldr.habitat.sh/v1/depot/channels/#{pkg_origin}/#{pkg_channel}/pkgs/#{pkg_name}"
99
102
  if pkg_version.nil? && pkg_release.nil?
100
103
  base_api_uri += "/latest"
101
104
  elsif pkg_release.nil?
@@ -110,7 +113,16 @@ module LicenseScout
110
113
  pkg_origin, pkg_name, = pkg_ident.split("/")
111
114
 
112
115
  LicenseScout::Log.warn("[habitat] Could not find pkg_info for #{pkg_ident} - trying for the latest version of #{pkg_origin}/#{pkg_name}")
113
- FFI_Yajl::Parser.parse(open("https://bldr.habitat.sh/v1/depot/channels/#{pkg_origin}/stable/pkgs/#{pkg_name}/latest").read)
116
+ FFI_Yajl::Parser.parse(open("https://bldr.habitat.sh/v1/depot/channels/#{pkg_origin}/#{pkg_channel}/pkgs/#{pkg_name}/latest").read)
117
+ end
118
+ end
119
+
120
+ def channel_for_origin(pkg_origin)
121
+ override = LicenseScout::Config.habitat.channel_for_origin.find { |t| t["origin"] == pkg_origin }
122
+ if override
123
+ override["channel"]
124
+ else
125
+ DEFAULT_CHANNEL
114
126
  end
115
127
  end
116
128
 
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module LicenseScout
19
- VERSION = "2.0.14"
19
+ VERSION = "2.1.0"
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license_scout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.14
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serdar Sutay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-14 00:00:00.000000000 Z
12
+ date: 2018-08-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi-yajl