spandx 0.15.1 → 0.16.0
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 +8 -2
- data/lib/spandx.rb +1 -1
- data/lib/spandx/cli/commands/pull.rb +16 -6
- data/lib/spandx/core/data_file.rb +4 -0
- data/lib/spandx/core/git.rb +8 -6
- data/lib/spandx/version.rb +1 -1
- data/spandx.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 252cdcff5bb25e6699751e6f842159e46a1a19485e889dca067d2120063bd11b
|
4
|
+
data.tar.gz: 4a1c66430fd54d64d8fa18a4a015dbe49d94454bd2800369d384b09e1c5fc984
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3699f961272816332c5c1ec0ab97fc5f769cfeafc80d8058bb03671f8f3eaee89a3ac831ba8c40304e5d63a59c37436ca30472da4eec8bf69496f3875fb793ee
|
7
|
+
data.tar.gz: 8b06322b0d3103eadd726a77cf8dfd43759c94d67c628710e50247946112dba479bd0f317c45639f2bf99aed083c665edde36f0c06e2860dc97c6afe1f08cb1d
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Version 0.
|
1
|
+
Version 0.16.0
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
9
9
|
|
10
10
|
## [Unreleased]
|
11
11
|
|
12
|
+
## [0.16.0] - 2020-11-19
|
13
|
+
### Changed
|
14
|
+
- Pull smaller license cache.
|
15
|
+
- Print index files after building them.
|
16
|
+
|
12
17
|
## [0.15.1] - 2020-11-18
|
13
18
|
### Fixed
|
14
19
|
- Rebuild index after pulling latest cache.
|
@@ -211,7 +216,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
211
216
|
### Added
|
212
217
|
- Provide ruby API to the latest SPDX catalogue.
|
213
218
|
|
214
|
-
[Unreleased]: https://github.com/spandx/spandx/compare/v0.
|
219
|
+
[Unreleased]: https://github.com/spandx/spandx/compare/v0.16.0...HEAD
|
220
|
+
[0.16.0]: https://github.com/spandx/spandx/compare/v0.15.1...v0.16.0
|
215
221
|
[0.15.1]: https://github.com/spandx/spandx/compare/v0.15.0...v0.15.1
|
216
222
|
[0.15.0]: https://github.com/spandx/spandx/compare/v0.14.0...v0.15.0
|
217
223
|
[0.14.0]: https://github.com/spandx/spandx/compare/v0.13.5...v0.14.0
|
data/lib/spandx.rb
CHANGED
@@ -45,7 +45,7 @@ module Spandx
|
|
45
45
|
@git ||= {
|
46
46
|
cache: ::Spandx::Core::Git.new(url: 'https://github.com/spandx/cache.git'),
|
47
47
|
rubygems: ::Spandx::Core::Git.new(url: 'https://github.com/spandx/rubygems-cache.git'),
|
48
|
-
spdx: ::Spandx::Core::Git.new(url: 'https://github.com/spdx/license-list-data.git'),
|
48
|
+
spdx: ::Spandx::Core::Git.new(url: 'https://github.com/spdx/license-list-data.git', default_branch: 'master'),
|
49
49
|
}
|
50
50
|
end
|
51
51
|
end
|
@@ -4,13 +4,20 @@ module Spandx
|
|
4
4
|
module Cli
|
5
5
|
module Commands
|
6
6
|
class Pull
|
7
|
+
attr_reader :cache_dir, :rubygems_cache_dir
|
8
|
+
|
7
9
|
def initialize(options)
|
8
10
|
@options = options
|
11
|
+
@cache_dir = Spandx.git[:cache].root.join('.index')
|
12
|
+
@rubygems_cache_dir = Spandx.git[:rubygems].root.join('.index')
|
9
13
|
end
|
10
14
|
|
11
15
|
def execute(output: $stderr)
|
12
16
|
sync(output)
|
13
17
|
build(output, ::Spandx::Core::Dependency::PACKAGE_MANAGERS.values.uniq)
|
18
|
+
index_files_in(cache_dir, rubygems_cache_dir).each do |item|
|
19
|
+
output.puts item.to_s.gsub(Dir.home, '~')
|
20
|
+
end
|
14
21
|
output.puts 'OK'
|
15
22
|
end
|
16
23
|
|
@@ -25,14 +32,11 @@ module Spandx
|
|
25
32
|
end
|
26
33
|
|
27
34
|
def build(output, sources)
|
28
|
-
|
29
|
-
|
30
|
-
with_spinner('Rebuilding index...', output: output) do
|
35
|
+
with_spinner('Building index...', output: output) do
|
31
36
|
sources.each do |source|
|
32
|
-
Spandx::Core::Cache
|
33
|
-
.new(source, root: index_path)
|
34
|
-
.rebuild_index
|
37
|
+
Spandx::Core::Cache.new(source, root: cache_dir).rebuild_index
|
35
38
|
end
|
39
|
+
Spandx::Core::Cache.new(:rubygems, root: rubygems_cache_dir).rebuild_index
|
36
40
|
end
|
37
41
|
end
|
38
42
|
|
@@ -41,9 +45,15 @@ module Spandx
|
|
41
45
|
spinner.auto_spin
|
42
46
|
yield
|
43
47
|
spinner.success('(done)')
|
48
|
+
rescue StandardError => error
|
49
|
+
spinner.error("(#{error.message})")
|
44
50
|
ensure
|
45
51
|
spinner.stop
|
46
52
|
end
|
53
|
+
|
54
|
+
def index_files_in(*dirs)
|
55
|
+
dirs.map { |x| x.glob('**/*.idx') }.flatten.sort
|
56
|
+
end
|
47
57
|
end
|
48
58
|
end
|
49
59
|
end
|
data/lib/spandx/core/git.rb
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
module Spandx
|
4
4
|
module Core
|
5
5
|
class Git
|
6
|
-
attr_reader :root, :url
|
6
|
+
attr_reader :root, :url, :default_branch
|
7
7
|
|
8
|
-
def initialize(url:)
|
8
|
+
def initialize(url:, default_branch: 'main')
|
9
9
|
@url = url
|
10
|
+
@default_branch = default_branch
|
10
11
|
@root = path_for(url)
|
11
12
|
end
|
12
13
|
|
@@ -31,14 +32,15 @@ module Spandx
|
|
31
32
|
root.join('.git').directory?
|
32
33
|
end
|
33
34
|
|
34
|
-
def clone!
|
35
|
+
def clone!(branch: default_branch)
|
35
36
|
system('rm', '-rf', root.to_s) if root.exist?
|
36
|
-
system('git', 'clone', '--quiet', '--depth=1', '--single-branch', '--branch',
|
37
|
+
system('git', 'clone', '--quiet', '--depth=1', '--single-branch', '--branch', branch, url, root.to_s)
|
37
38
|
end
|
38
39
|
|
39
|
-
def pull!
|
40
|
+
def pull!(remote: 'origin', branch: default_branch)
|
40
41
|
Dir.chdir(root) do
|
41
|
-
system('git', '
|
42
|
+
system('git', 'fetch', '--quiet', '--depth=1', '--prune', '--no-tags', remote)
|
43
|
+
system('git', 'checkout', '--quiet', branch)
|
42
44
|
end
|
43
45
|
end
|
44
46
|
end
|
data/lib/spandx/version.rb
CHANGED
data/spandx.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.metadata['homepage_uri'] = spec.homepage
|
20
20
|
spec.metadata['source_code_uri'] = 'https://github.com/spandx/spandx'
|
21
|
-
spec.metadata['changelog_uri'] = 'https://github.com/spandx/spandx/blob/
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/spandx/spandx/blob/main/CHANGELOG.md'
|
22
22
|
|
23
23
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
24
|
Dir.glob('exe/*') +
|
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.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Can Eldem
|
@@ -427,7 +427,7 @@ licenses:
|
|
427
427
|
metadata:
|
428
428
|
homepage_uri: https://spandx.github.io/
|
429
429
|
source_code_uri: https://github.com/spandx/spandx
|
430
|
-
changelog_uri: https://github.com/spandx/spandx/blob/
|
430
|
+
changelog_uri: https://github.com/spandx/spandx/blob/main/CHANGELOG.md
|
431
431
|
post_install_message:
|
432
432
|
rdoc_options: []
|
433
433
|
require_paths:
|