spandx 0.15.0 → 0.15.1

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: ee3b447710888b33bf24ecf467ce1bf41e3cf6f2c91d2c3c381f256d0fa1ea6f
4
- data.tar.gz: cd802eabfd2f0e383ae198217992ce465c28ac7d53587264ca1a2f4746e9e9ce
3
+ metadata.gz: 120ae97e54f2a138b7d1053d9e71c8b702174cf70fbac0fc861b8971f4aec0bd
4
+ data.tar.gz: c89d3ffe76d00d0a6fb18e91b5cdd3ef1487a826047213dd264be3d59796d188
5
5
  SHA512:
6
- metadata.gz: ed0fec87962da7ad1576131d6a463324deeaa9ea2b9a6b289dc9c639d1eb9dda98e2bd7aa02df2f9d40526fc4793cedafe3311c9c5fb6c6aedba5594b68fcc1f
7
- data.tar.gz: f6bdc294db3b95093c8e3872bb5113879c0a12f9d45ec718557281ff9397f925d0b0a443ba41fad0c5a48e86c77babf95b855b7315d795ec8e869bf8c1dbd6c4
6
+ metadata.gz: ab85f497f8ce4fe46a03b31d25ffa07816975dcbcb91a1438cf09bcd38f857ed652a1003569e2a8cbb091c5fb5b5b88a52043f4a61eec71337eff58107c75737
7
+ data.tar.gz: e73a923228358065c7d67bdfa8aaea328657269758f2c2d664621b5e6dd6da449b1d585655ae351e0edd99dbd155ef2efa24f0e37c95cd24c75f85da517503af
@@ -1,4 +1,4 @@
1
- Version 0.15.0
1
+ Version 0.15.1
2
2
 
3
3
  # Changelog
4
4
 
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.15.1] - 2020-11-18
13
+ ### Fixed
14
+ - Rebuild index after pulling latest cache.
15
+
12
16
  ## [0.15.0] - 2020-11-18
13
17
  ### Added
14
18
  - Parse `/var/lib/dpkg/status` file.
@@ -207,7 +211,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
207
211
  ### Added
208
212
  - Provide ruby API to the latest SPDX catalogue.
209
213
 
210
- [Unreleased]: https://github.com/spandx/spandx/compare/v0.15.0...HEAD
214
+ [Unreleased]: https://github.com/spandx/spandx/compare/v0.15.1...HEAD
215
+ [0.15.1]: https://github.com/spandx/spandx/compare/v0.15.0...v0.15.1
211
216
  [0.15.0]: https://github.com/spandx/spandx/compare/v0.14.0...v0.15.0
212
217
  [0.14.0]: https://github.com/spandx/spandx/compare/v0.13.5...v0.14.0
213
218
  [0.13.5]: https://github.com/spandx/spandx/compare/v0.13.4...v0.13.5
@@ -52,4 +52,6 @@ void Init_spandx(void)
52
52
  rb_mCore = rb_define_module_under(rb_mSpandx, "Core");
53
53
  rb_mCsvParser = rb_define_module_under(rb_mCore, "CsvParser");
54
54
  rb_define_module_function(rb_mCsvParser, "parse", parse, 1);
55
+
56
+ rb_gc_register_mark_object(rb_mCsvParser);
55
57
  }
@@ -8,12 +8,41 @@ module Spandx
8
8
  @options = options
9
9
  end
10
10
 
11
- def execute(output: $stdout)
11
+ def execute(output: $stderr)
12
+ sync(output)
13
+ build(output, ::Spandx::Core::Dependency::PACKAGE_MANAGERS.values.uniq)
14
+ output.puts 'OK'
15
+ end
16
+
17
+ private
18
+
19
+ def sync(output)
12
20
  Spandx.git.each_value do |db|
13
- output.puts "Updating #{db.url}..."
14
- db.update!
21
+ with_spinner("Updating #{db.url}...", output: output) do
22
+ db.update!
23
+ end
15
24
  end
16
- output.puts 'OK'
25
+ end
26
+
27
+ def build(output, sources)
28
+ index_path = Spandx.git[:cache].root.join('.index')
29
+
30
+ with_spinner('Rebuilding index...', output: output) do
31
+ sources.each do |source|
32
+ Spandx::Core::Cache
33
+ .new(source, root: index_path)
34
+ .rebuild_index
35
+ end
36
+ end
37
+ end
38
+
39
+ def with_spinner(message, output:)
40
+ spinner = TTY::Spinner.new("[:spinner] #{message}", output: output)
41
+ spinner.auto_spin
42
+ yield
43
+ spinner.success('(done)')
44
+ ensure
45
+ spinner.stop
17
46
  end
18
47
  end
19
48
  end
@@ -6,8 +6,9 @@ module Spandx
6
6
  class Table < Printer
7
7
  HEADINGS = ['Name', 'Version', 'Licenses', 'Location'].freeze
8
8
 
9
- def initialize
10
- @spinner = TTY::Spinner.new(output: $stderr)
9
+ def initialize(output: $stderr)
10
+ @spinner = TTY::Spinner.new('[:spinner] Scanning...', output: output, clear: true, format: :dots)
11
+ @spinner.auto_spin
11
12
  end
12
13
 
13
14
  def match?(format)
@@ -16,7 +17,6 @@ module Spandx
16
17
 
17
18
  def print_header(_io)
18
19
  @dependencies = SortedSet.new
19
- @spinner.auto_spin
20
20
  end
21
21
 
22
22
  def print_line(dependency, _io)
@@ -25,6 +25,7 @@ module Spandx
25
25
 
26
26
  def print_footer(io)
27
27
  @spinner.stop
28
+ @spinner.reset
28
29
  io.puts(to_table(@dependencies.map(&:to_a)))
29
30
  end
30
31
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spandx
4
- VERSION = '0.15.0'
4
+ VERSION = '0.15.1'
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.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Can Eldem
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-11-18 00:00:00.000000000 Z
12
+ date: 2020-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable