spandx 0.13.3 → 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 +4 -4
- data/CHANGELOG.md +37 -2
- data/exe/spandx +0 -1
- data/ext/spandx/spandx.c +7 -3
- data/lib/spandx.rb +1 -1
- data/lib/spandx/cli.rb +2 -2
- data/lib/spandx/cli/commands/pull.rb +33 -4
- data/lib/spandx/cli/commands/scan.rb +19 -22
- data/lib/spandx/cli/main.rb +3 -3
- data/lib/spandx/cli/printer.rb +27 -0
- data/lib/spandx/cli/printers/csv.rb +17 -0
- data/lib/spandx/cli/printers/json.rb +17 -0
- data/lib/spandx/cli/printers/table.rb +42 -0
- data/lib/spandx/core/dependency.rb +48 -13
- data/lib/spandx/core/git.rb +6 -6
- data/lib/spandx/core/http.rb +6 -6
- data/lib/spandx/core/license_plugin.rb +10 -4
- data/lib/spandx/core/parser.rb +9 -4
- data/lib/spandx/core/path_traversal.rb +4 -13
- data/lib/spandx/core/plugin.rb +6 -0
- data/lib/spandx/core/thread_pool.rb +49 -0
- data/lib/spandx/dotnet/nuget_gateway.rb +1 -1
- data/lib/spandx/dotnet/parsers/csproj.rb +7 -7
- data/lib/spandx/dotnet/parsers/packages_config.rb +7 -7
- data/lib/spandx/dotnet/parsers/sln.rb +10 -13
- data/lib/spandx/dotnet/project_file.rb +3 -3
- data/lib/spandx/java/parsers/maven.rb +7 -7
- data/lib/spandx/js/parsers/npm.rb +8 -8
- data/lib/spandx/js/parsers/yarn.rb +7 -7
- data/lib/spandx/js/yarn_pkg.rb +1 -1
- data/lib/spandx/os/parsers/apk.rb +51 -0
- data/lib/spandx/os/parsers/dpkg.rb +69 -0
- data/lib/spandx/php/packagist_gateway.rb +1 -1
- data/lib/spandx/php/parsers/composer.rb +7 -7
- data/lib/spandx/python/parsers/pipfile_lock.rb +4 -4
- data/lib/spandx/python/pypi.rb +19 -7
- data/lib/spandx/python/source.rb +1 -1
- data/lib/spandx/ruby/gateway.rb +1 -1
- data/lib/spandx/ruby/parsers/gemfile_lock.rb +10 -9
- data/lib/spandx/spdx/catalogue.rb +1 -1
- data/lib/spandx/version.rb +1 -1
- data/spandx.gemspec +5 -4
- metadata +38 -20
- data/lib/spandx/core/report.rb +0 -60
- data/lib/spandx/core/spinner.rb +0 -51
- data/lib/spandx/core/table.rb +0 -29
data/lib/spandx/core/report.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spandx
|
4
|
-
module Core
|
5
|
-
class Report
|
6
|
-
include Enumerable
|
7
|
-
|
8
|
-
FORMATS = {
|
9
|
-
csv: :to_csv,
|
10
|
-
hash: :to_h,
|
11
|
-
json: :to_json,
|
12
|
-
table: :to_table,
|
13
|
-
}.freeze
|
14
|
-
|
15
|
-
def initialize
|
16
|
-
@dependencies = SortedSet.new
|
17
|
-
end
|
18
|
-
|
19
|
-
def add(dependency)
|
20
|
-
@dependencies << dependency
|
21
|
-
end
|
22
|
-
|
23
|
-
def each
|
24
|
-
@dependencies.each do |dependency|
|
25
|
-
yield dependency
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def to(format, formats: FORMATS)
|
30
|
-
public_send(formats.fetch(format&.to_sym, :to_json))
|
31
|
-
end
|
32
|
-
|
33
|
-
def to_table
|
34
|
-
Table.new do |table|
|
35
|
-
map do |dependency|
|
36
|
-
table << dependency
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def to_h
|
42
|
-
{ version: '1.0', dependencies: [] }.tap do |report|
|
43
|
-
each do |dependency|
|
44
|
-
report[:dependencies].push(dependency.to_h)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def to_json(*_args)
|
50
|
-
JSON.pretty_generate(to_h)
|
51
|
-
end
|
52
|
-
|
53
|
-
def to_csv
|
54
|
-
map do |dependency|
|
55
|
-
CSV.generate_line(dependency.to_a)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/lib/spandx/core/spinner.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spandx
|
4
|
-
module Core
|
5
|
-
class Spinner
|
6
|
-
NULL = Class.new do
|
7
|
-
def self.spin(*args); end
|
8
|
-
|
9
|
-
def self.stop(*args); end
|
10
|
-
end
|
11
|
-
|
12
|
-
attr_reader :columns, :spinner
|
13
|
-
|
14
|
-
def initialize(columns: TTY::Screen.columns, output: $stderr)
|
15
|
-
@columns = columns
|
16
|
-
@spinner = Nanospinner.new(output)
|
17
|
-
@queue = Queue.new
|
18
|
-
@thread = Thread.new { work }
|
19
|
-
end
|
20
|
-
|
21
|
-
def spin(message)
|
22
|
-
@queue.enq(justify(message))
|
23
|
-
yield if block_given?
|
24
|
-
end
|
25
|
-
|
26
|
-
def stop
|
27
|
-
@queue.clear
|
28
|
-
@queue.enq(:stop)
|
29
|
-
@thread.join
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def justify(message)
|
35
|
-
message.to_s.ljust(columns - 3)
|
36
|
-
end
|
37
|
-
|
38
|
-
def work
|
39
|
-
last_message = justify('')
|
40
|
-
loop do
|
41
|
-
message = @queue.empty? ? last_message : @queue.deq
|
42
|
-
break if message == :stop
|
43
|
-
|
44
|
-
spinner.spin(message)
|
45
|
-
last_message = message
|
46
|
-
sleep 0.1
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/spandx/core/table.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Spandx
|
4
|
-
module Core
|
5
|
-
class Table
|
6
|
-
def initialize
|
7
|
-
@rows = []
|
8
|
-
@max_justification = 0
|
9
|
-
yield self
|
10
|
-
end
|
11
|
-
|
12
|
-
def <<(item)
|
13
|
-
row = item.to_a
|
14
|
-
new_max = row[0].size
|
15
|
-
@max_justification = new_max + 1 if new_max > @max_justification
|
16
|
-
@rows << row
|
17
|
-
end
|
18
|
-
|
19
|
-
def to_s
|
20
|
-
@rows.map do |row|
|
21
|
-
row.each.with_index.map do |cell, index|
|
22
|
-
justification = index.zero? ? @max_justification : 15
|
23
|
-
Array(cell).join(', ').ljust(justification, ' ')
|
24
|
-
end.join
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|