spandx 0.12.2 → 0.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d43310f8751344a680d231818e7f9563df42c15062ba7230b00bbed9758eed86
4
- data.tar.gz: 87138f6b4d45fc73bcb48fa3dc22262e79a8d0423cb4d15ddd2c0310a168e400
3
+ metadata.gz: 03ab3629ac636e8be88e27061cbce6941672dfd0a99bce30a9a638a095ebddab
4
+ data.tar.gz: 3e0d7eb62b59887c2770ac9dfbef7b0037fcf3031e73f2f380a8ed1ba93d2cca
5
5
  SHA512:
6
- metadata.gz: f61f68f17cc299026704e76a0bef59d7437b6de68a85996e094b353c8e5edfa7290dd1351170f4da2e3078e3f5303ba8cdd5d550cad3349e4e83a99a9c69126a
7
- data.tar.gz: 6cd23ff18208621c628f4c3811e95aaf6b73e466f46e008ee2219d663f74f64662bd767259d97a70bf8765b0ad0cea39c1798160c12c66d676a4176ab264cc0d
6
+ metadata.gz: c6962a430329a9d3ed3f274485a55a396cea66b9bcd8f664caf803d74c5768508aa9eee499a7ae99ab06bd840a6bedb67b85812cab193c1e5f6f725458c05fbd
7
+ data.tar.gz: a42dd5adeeb36e374a1f4a2582a881d5d4e28f2959d0044e653162edd0835895ade882261379bc5d47d3a7955b536c7f0ddc53b4a489ce8e68e6b6a3ad0c9731
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- Version 0.12.2
1
+ Version 0.12.3
2
2
 
3
3
  # Changelog
4
4
 
@@ -8,6 +8,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
9
 
10
10
  ## [Unreleased]
11
+
12
+ ## [0.12.3] - 2020-04-19
13
+ ### Fixed
14
+ - Ignore nuget entries with missing `items`.
15
+ - Remove require `etc`.
16
+
11
17
  ## [0.12.2] - 2020-04-18
12
18
  ### Fixed
13
19
  - Insert entries with unknown license into cache instead of one large dead letter file that is too big to commit to git.
@@ -138,7 +144,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
138
144
  ### Added
139
145
  - Provide ruby API to the latest SPDX catalogue.
140
146
 
141
- [Unreleased]: https://github.com/mokhan/spandx/compare/v0.12.1...HEAD
147
+ [Unreleased]: https://github.com/mokhan/spandx/compare/v0.12.3...HEAD
148
+ [0.12.3]: https://github.com/mokhan/spandx/compare/v0.12.2...v0.12.3
149
+ [0.12.2]: https://github.com/mokhan/spandx/compare/v0.12.1...v0.12.2
142
150
  [0.12.1]: https://github.com/mokhan/spandx/compare/v0.12.0...v0.12.1
143
151
  [0.12.0]: https://github.com/mokhan/spandx/compare/v0.11.0...v0.12.0
144
152
  [0.11.0]: https://github.com/mokhan/spandx/compare/v0.10.1...v0.11.0
@@ -35,11 +35,13 @@ module Spandx
35
35
  desc 'build', 'Build a package index'
36
36
  method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
37
37
  method_option :directory, aliases: '-d', type: :string, desc: 'Directory to build index in', default: '.index'
38
+ method_option :logfile, aliases: '-l', type: :string, desc: 'Path to a logfile', default: '/dev/null'
38
39
  method_option :index, aliases: '-i', type: :string, desc: 'The specific index to build', default: :all
39
40
  def build(*)
40
41
  if options[:help]
41
42
  invoke :help, ['build']
42
43
  else
44
+ Spandx.logger = Logger.new(options[:logfile])
43
45
  Commands::Build.new(options).execute
44
46
  end
45
47
  end
@@ -3,10 +3,12 @@
3
3
  module Spandx
4
4
  module Core
5
5
  class Circuit
6
- attr_reader :state
6
+ attr_reader :name, :state, :logger
7
7
 
8
- def initialize(state: :closed)
8
+ def initialize(name, state: :closed, logger: Spandx.logger)
9
+ @name = name
9
10
  @state = state
11
+ @logger = logger
10
12
  end
11
13
 
12
14
  def attempt
@@ -16,6 +18,8 @@ module Spandx
16
18
  result = yield
17
19
  close!
18
20
  result
21
+ ensure
22
+ logger.debug("#{name} #{state}")
19
23
  end
20
24
 
21
25
  def open!
@@ -8,7 +8,7 @@ module Spandx
8
8
  def initialize(driver: Http.default_driver, retries: 3)
9
9
  @driver = driver
10
10
  @retries = retries
11
- @circuits = Hash.new { |hash, key| hash[key] = Circuit.new }
11
+ @circuits = Hash.new { |hash, key| hash[key] = Circuit.new(key) }
12
12
  end
13
13
 
14
14
  def get(uri, default: nil, escape: true)
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spandx
4
+ module Core
5
+ class ThreadPool
6
+ def initialize(size: Etc.nprocessors)
7
+ @size = size
8
+ @jobs = Queue.new
9
+ @pool = size.times { start_worker_thread }
10
+ end
11
+
12
+ def schedule(*args, &block)
13
+ @jobs << [block, args]
14
+ end
15
+
16
+ def shutdown
17
+ @size.times do
18
+ schedule { throw :exit }
19
+ end
20
+
21
+ @pool.map(&:join)
22
+ end
23
+
24
+ private
25
+
26
+ def start_worker_thread
27
+ Thread.new do
28
+ catch(:exit) do
29
+ loop do
30
+ job, args = @jobs.deq
31
+ job.call(*args)
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -78,7 +78,7 @@ module Spandx
78
78
  end
79
79
 
80
80
  def items_from(page)
81
- page['items'].sort_by { |x| x['commitTimeStamp'] }
81
+ page.fetch('items', []).sort_by { |x| x['commitTimeStamp'] }
82
82
  end
83
83
 
84
84
  def page_number_from(url)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spandx
4
- VERSION = '0.12.2'
4
+ VERSION = '0.12.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spandx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo khan
@@ -317,6 +317,7 @@ files:
317
317
  - lib/spandx/core/report.rb
318
318
  - lib/spandx/core/score.rb
319
319
  - lib/spandx/core/table.rb
320
+ - lib/spandx/core/thread_pool.rb
320
321
  - lib/spandx/dotnet/index.rb
321
322
  - lib/spandx/dotnet/nuget_gateway.rb
322
323
  - lib/spandx/dotnet/package_reference.rb