diffend-monitor 0.2.40 → 0.2.46
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +26 -1
- data/certs/mensfeld.pem +21 -21
- data/diffend.gemspec +14 -4
- data/lib/diffend/commands.rb +2 -0
- data/lib/diffend/configs/error_messages.rb +11 -0
- data/lib/diffend/configs/validator.rb +22 -0
- data/lib/diffend/errors.rb +2 -0
- data/lib/diffend/execute.rb +4 -3
- data/lib/diffend/handle_errors/report.rb +4 -4
- data/lib/diffend/integration_repository.rb +92 -0
- data/lib/diffend/local_context/host.rb +12 -1
- data/lib/diffend/local_context/packages.rb +10 -27
- data/lib/diffend/plugin.rb +3 -0
- data/lib/diffend/repository.rb +109 -0
- data/lib/diffend/request_object.rb +1 -1
- data/lib/diffend/request_verdict.rb +4 -4
- data/lib/diffend/shell.rb +44 -0
- data/lib/diffend/track.rb +4 -4
- data/lib/diffend/version.rb +1 -1
- metadata +35 -47
- metadata.gz.sig +0 -0
- data/.coditsu/ci.yml +0 -3
- data/.diffend.yml +0 -3
- data/.github/workflows/ci.yml +0 -88
- data/.gitignore +0 -58
- data/.rspec +0 -1
- data/.ruby-version +0 -1
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -40
- data/bin/bundle +0 -114
- data/bin/byebug +0 -29
- data/bin/htmldiff +0 -29
- data/bin/ldiff +0 -29
- data/bin/rake +0 -29
- data/bin/rspec +0 -29
- data/certs/tomaszpajor.pem +0 -25
- data/scripts/generate_payload_for_file.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7a9ce0136a3adc532898cdabc5972be7ed152c0479a7ad724ec66a5a563777a
|
4
|
+
data.tar.gz: ece9ff8f2226deff51cb670b0cb985247fd4b497d0538015d736192bb0548b01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2b69a6ca6aacb8a99d45c6333f6da252b4a952d939d704b75f6d122e9cb5c383bb222992488226ebc3a400bd9db91a310365279141d612524c191b67a5b2d69
|
7
|
+
data.tar.gz: fe78cb956b12566737ab17dd092c2a42eab82cafd9dd5ca81f409978b0f837c28b4ff99d0617aeae847085390dc173736f3786d31d5973b54f856cfa7cc35261
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,27 @@
|
|
2
2
|
|
3
3
|
## [Unreleased][master]
|
4
4
|
|
5
|
+
## [0.2.46] (2021-05-05)
|
6
|
+
- Optimized file selection to make releases smaller and easier to read through.
|
7
|
+
|
8
|
+
## [0.2.45] (2021-05-05)
|
9
|
+
- Bundler 2.2.17 support
|
10
|
+
|
11
|
+
## [0.2.44] (2021-03-31)
|
12
|
+
- `project_id`, `shareable_id` and `shareable_key` need to be a valid UUID
|
13
|
+
|
14
|
+
## [0.2.43] (2021-03-16)
|
15
|
+
- introduce `DIFFEND_TAGS` ([#119](https://github.com/diffend-io/diffend-ruby/pull/119))
|
16
|
+
- add support for `bundle add` command ([#118](https://github.com/diffend-io/diffend-ruby/pull/118))
|
17
|
+
|
18
|
+
## [0.2.42] (2021-03-09)
|
19
|
+
- introduce `DIFFEND_SKIP_DENY` flag
|
20
|
+
- fix config not being passed properly to `build_error` in `Diffend::Execute` ([#116](https://github.com/diffend-io/diffend-ruby/pull/116))
|
21
|
+
|
22
|
+
## [0.2.41] (2021-03-09)
|
23
|
+
- introduce integration specs ([#107](https://github.com/diffend-io/diffend-ruby/pull/107))
|
24
|
+
- use `Bundler::Definition.resolve` for specs ([#112](https://github.com/diffend-io/diffend-ruby/pull/112))
|
25
|
+
|
5
26
|
## [0.2.40] (2021-02-23)
|
6
27
|
- don't expose ips, we can identify instance by a hostname ([#108](https://github.com/diffend-io/diffend-ruby/pull/108))
|
7
28
|
- don't set `verify_mode` when creating request in `Diffend::Request`, use default value set by `use_ssl` flag instead ([#109](https://github.com/diffend-io/diffend-ruby/pull/109))
|
@@ -126,7 +147,11 @@
|
|
126
147
|
|
127
148
|
- initial release
|
128
149
|
|
129
|
-
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.
|
150
|
+
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.44...HEAD
|
151
|
+
[0.2.44]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.43...v0.2.44
|
152
|
+
[0.2.43]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.42...v0.2.43
|
153
|
+
[0.2.42]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.41...v0.2.42
|
154
|
+
[0.2.41]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.40...v0.2.41
|
130
155
|
[0.2.40]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.39...v0.2.40
|
131
156
|
[0.2.39]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.38...v0.2.39
|
132
157
|
[0.2.38]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.37...v0.2.38
|
data/certs/mensfeld.pem
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
2
|
MIIEODCCAqCgAwIBAgIBATANBgkqhkiG9w0BAQsFADAjMSEwHwYDVQQDDBhtYWNp
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
3
|
+
ZWovREM9bWVuc2ZlbGQvREM9cGwwHhcNMjAwODExMDkxNTM3WhcNMjEwODExMDkx
|
4
|
+
NTM3WjAjMSEwHwYDVQQDDBhtYWNpZWovREM9bWVuc2ZlbGQvREM9cGwwggGiMA0G
|
5
|
+
CSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDCpXsCgmINb6lHBXXBdyrgsBPSxC4/
|
6
|
+
2H+weJ6L9CruTiv2+2/ZkQGtnLcDgrD14rdLIHK7t0o3EKYlDT5GhD/XUVhI15JE
|
7
|
+
N7IqnPUgexe1fbZArwQ51afxz2AmPQN2BkB2oeQHXxnSWUGMhvcEZpfbxCCJH26w
|
8
|
+
hS0Ccsma8yxA6hSlGVhFVDuCr7c2L1di6cK2CtIDpfDaWqnVNJEwBYHIxrCoWK5g
|
9
|
+
sIGekVt/admS9gRhIMaIBg+Mshth5/DEyWO2QjteTodItlxfTctrfmiAl8X8T5JP
|
10
|
+
VXeLp5SSOJ5JXE80nShMJp3RFnGw5fqjX/ffjtISYh78/By4xF3a25HdWH9+qO2Z
|
11
|
+
tx0wSGc9/4gqNM0APQnjN/4YXrGZ4IeSjtE+OrrX07l0TiyikzSLFOkZCAp8oBJi
|
12
|
+
Fhlosz8xQDJf7mhNxOaZziqASzp/hJTU/tuDKl5+ql2icnMv5iV/i6SlmvU29QNg
|
13
|
+
LCV71pUv0pWzN+OZbHZKWepGhEQ3cG9MwvkCAwEAAaN3MHUwCQYDVR0TBAIwADAL
|
14
|
+
BgNVHQ8EBAMCBLAwHQYDVR0OBBYEFImGed2AXS070ohfRidiCEhXEUN+MB0GA1Ud
|
15
15
|
EQQWMBSBEm1hY2llakBtZW5zZmVsZC5wbDAdBgNVHRIEFjAUgRJtYWNpZWpAbWVu
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
c2ZlbGQucGwwDQYJKoZIhvcNAQELBQADggGBAKiHpwoENVrMi94V1zD4o8/6G3AU
|
17
|
+
gWz4udkPYHTZLUy3dLznc/sNjdkJFWT3E6NKYq7c60EpJ0m0vAEg5+F5pmNOsvD3
|
18
|
+
2pXLj9kisEeYhR516HwXAvtngboUcb75skqvBCU++4Pu7BRAPjO1/ihLSBexbwSS
|
19
|
+
fF+J5OWNuyHHCQp+kGPLtXJe2yUYyvSWDj3I2//Vk0VhNOIlaCS1+5/P3ZJThOtm
|
20
|
+
zJUBI7h3HgovwRpcnmk2mXTmU4Zx/bCzX8EA6VY0khEvnmiq7S6eBF0H9qH8KyQ6
|
21
|
+
EkVLpvmUDFcf/uNaBQdazEMB5jYtwoA8gQlANETNGPi51KlkukhKgaIEDMkBDJOx
|
22
|
+
65N7DzmkcyY0/GwjIVIxmRhcrCt1YeCUElmfFx0iida1/YRm6sB2AXqScc1+ECRi
|
23
|
+
2DND//YJUikn1zwbz1kT70XmHd97B4Eytpln7K+M1u2g1pHVEPW4owD/ammXNpUy
|
24
|
+
nt70FcDD4yxJQ+0YNiHd0N8IcVBM1TMIVctMNQ==
|
25
25
|
-----END CERTIFICATE-----
|
data/diffend.gemspec
CHANGED
@@ -4,10 +4,19 @@ lib = File.expand_path('lib', __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
5
|
require 'diffend/version'
|
6
6
|
|
7
|
+
files_locations = %w[
|
8
|
+
*.md
|
9
|
+
lib/**/*.rb
|
10
|
+
config/*
|
11
|
+
certs/*
|
12
|
+
diffend.gemspec
|
13
|
+
plugins.rb
|
14
|
+
]
|
15
|
+
|
7
16
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'diffend'
|
17
|
+
spec.name = 'diffend-monitor'
|
9
18
|
spec.version = Diffend::VERSION
|
10
|
-
spec.authors = ['Tomasz Pajor']
|
19
|
+
spec.authors = ['Tomasz Pajor', 'Maciej Mensfeld']
|
11
20
|
spec.email = ['contact@diffend.io']
|
12
21
|
|
13
22
|
spec.summary = 'OSS supply chain security and management platform'
|
@@ -18,10 +27,11 @@ Gem::Specification.new do |spec|
|
|
18
27
|
spec.signing_key = File.expand_path('~/.ssh/gem-private_key.pem')
|
19
28
|
end
|
20
29
|
|
21
|
-
spec.cert_chain = %w[certs/
|
22
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
30
|
+
spec.cert_chain = %w[certs/mensfeld.pem]
|
23
31
|
spec.require_paths = %w[lib]
|
24
32
|
|
33
|
+
files_locations.each { |location| spec.files += Dir[location] }
|
34
|
+
|
25
35
|
spec.add_development_dependency 'bundler'
|
26
36
|
spec.add_development_dependency 'rake'
|
27
37
|
end
|
data/lib/diffend/commands.rb
CHANGED
@@ -32,6 +32,17 @@ module Diffend
|
|
32
32
|
Expected #{Validator::KNOWN_KEYS[key].join(' or ')}, was #{config.public_send(key).class}.
|
33
33
|
MSG
|
34
34
|
end
|
35
|
+
|
36
|
+
# Invalid uuid value message
|
37
|
+
#
|
38
|
+
# @param key [String] invalid key
|
39
|
+
#
|
40
|
+
# @return [String]
|
41
|
+
def invalid_uuid(key)
|
42
|
+
<<~MSG
|
43
|
+
Diffend configuration value for #{key} is invalid.
|
44
|
+
MSG
|
45
|
+
end
|
35
46
|
end
|
36
47
|
end
|
37
48
|
end
|
@@ -17,6 +17,14 @@ module Diffend
|
|
17
17
|
development?: [TrueClass, FalseClass]
|
18
18
|
}.freeze
|
19
19
|
|
20
|
+
# List of known uuid keys
|
21
|
+
UUID_KEYS = %i[project_id shareable_id shareable_key].freeze
|
22
|
+
|
23
|
+
# Imported from https://github.com/assaf/uuid/blob/master/lib/uuid.rb#L199
|
24
|
+
UUID_FORMAT = /\A[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i
|
25
|
+
|
26
|
+
private_constant :UUID_KEYS, :UUID_FORMAT
|
27
|
+
|
20
28
|
class << self
|
21
29
|
# @param config [Diffend::Config]
|
22
30
|
def call(config)
|
@@ -28,6 +36,12 @@ module Diffend
|
|
28
36
|
|
29
37
|
config.errors << ErrorMessages.invalid_key(config, key) if invalid?(config, key)
|
30
38
|
end
|
39
|
+
|
40
|
+
UUID_KEYS.each do |key|
|
41
|
+
next if valid_uuid?(config, key)
|
42
|
+
|
43
|
+
config.errors << ErrorMessages.invalid_uuid(key)
|
44
|
+
end
|
31
45
|
end
|
32
46
|
|
33
47
|
private
|
@@ -49,6 +63,14 @@ module Diffend
|
|
49
63
|
def invalid?(config, key)
|
50
64
|
!KNOWN_KEYS[key].include?(config.public_send(key).class)
|
51
65
|
end
|
66
|
+
|
67
|
+
# @param config [Diffend::Config]
|
68
|
+
# @param key [String]
|
69
|
+
#
|
70
|
+
# @return [Boolean] true if key has a valid uuid, false otherwise
|
71
|
+
def valid_uuid?(config, key)
|
72
|
+
UUID_FORMAT.match?(config.public_send(key))
|
73
|
+
end
|
52
74
|
end
|
53
75
|
end
|
54
76
|
end
|
data/lib/diffend/errors.rb
CHANGED
@@ -21,5 +21,7 @@ module Diffend
|
|
21
21
|
HandledException = Class.new(BaseError)
|
22
22
|
# Raised when we are unable to resolve dependencies
|
23
23
|
DependenciesResolveException = Class.new(BaseError)
|
24
|
+
# Failure of a shell command execution
|
25
|
+
FailedShellCommand = Class.new(BaseError)
|
24
26
|
end
|
25
27
|
end
|
data/lib/diffend/execute.rb
CHANGED
@@ -30,7 +30,7 @@ module Diffend
|
|
30
30
|
# @param response [Hash] response from diffend API
|
31
31
|
def build_message(config, response)
|
32
32
|
if response.key?('error')
|
33
|
-
build_error(response)
|
33
|
+
build_error(config, response)
|
34
34
|
elsif response.key?('action')
|
35
35
|
build_verdict(config, response)
|
36
36
|
else
|
@@ -43,8 +43,9 @@ module Diffend
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
# @param config [Diffend::Config]
|
46
47
|
# @param response [Hash] response from diffend API
|
47
|
-
def build_error(response)
|
48
|
+
def build_error(config, response)
|
48
49
|
build_error_message(response)
|
49
50
|
.tap(&config.logger.method(:error))
|
50
51
|
|
@@ -65,7 +66,7 @@ module Diffend
|
|
65
66
|
build_deny_message(config.command, response)
|
66
67
|
.tap(&config.logger.method(:error))
|
67
68
|
|
68
|
-
exit 1
|
69
|
+
exit 1 unless ENV.key?('DIFFEND_SKIP_DENY')
|
69
70
|
else
|
70
71
|
Diffend::HandleErrors::Report.call(
|
71
72
|
config: config,
|
@@ -39,10 +39,10 @@ module Diffend
|
|
39
39
|
# @return [Diffend::RequestObject]
|
40
40
|
def build_request_object(config, payload)
|
41
41
|
Diffend::RequestObject.new(
|
42
|
-
config
|
43
|
-
|
44
|
-
payload
|
45
|
-
|
42
|
+
config,
|
43
|
+
config.errors_url,
|
44
|
+
payload,
|
45
|
+
:post
|
46
46
|
)
|
47
47
|
end
|
48
48
|
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Diffend
|
4
|
+
# Repository for integrations
|
5
|
+
class IntegrationRepository
|
6
|
+
# Plugin code entry in Gemfile
|
7
|
+
GEMFILE_PLUGIN_ENTRY = 'plugin \'diffend\''
|
8
|
+
# Gemfile file name
|
9
|
+
GEMFILE_FILE_NAME = 'Gemfile'
|
10
|
+
# Gemfile backup file name
|
11
|
+
GEMFILE_BACKUP_FILE_NAME = 'Gemfile.backup'
|
12
|
+
# Plugin install command
|
13
|
+
PLUGIN_INSTALL_COMMAND = 'bundle plugin install diffend'
|
14
|
+
|
15
|
+
attr_reader :command, :name, :repository
|
16
|
+
|
17
|
+
# @param command [String] command executed via bundler
|
18
|
+
# @param name [String] repository name
|
19
|
+
def initialize(command, name)
|
20
|
+
@command = command
|
21
|
+
@name = name
|
22
|
+
@repository = Diffend::Repository.new(command, name)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String] full name of the repository with command
|
26
|
+
def full_name
|
27
|
+
"#{command}_#{name}"
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param path [String] path to the repository
|
31
|
+
def config?(path)
|
32
|
+
# check if .diffend.yml exists
|
33
|
+
return if File.exist?(File.join(path, Diffend::Config::FILENAME))
|
34
|
+
|
35
|
+
puts "Diffend configuration does not exist for #{command} #{name}"
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param path [String] path to the repository
|
40
|
+
def install_plugin(path)
|
41
|
+
cmd = Diffend::Shell.call_in_path(path, PLUGIN_INSTALL_COMMAND)
|
42
|
+
|
43
|
+
unless cmd[:exit_code].zero?
|
44
|
+
puts "#{PLUGIN_INSTALL_COMMAND} failed"
|
45
|
+
puts cmd[:stderr]
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
|
49
|
+
switch_plugin_to_development(path, cmd[:stdout])
|
50
|
+
add_plugin_to_gemfile(path)
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
# @param path [String] path to the repository
|
56
|
+
# @param stdout [String] stdout from plugin install command
|
57
|
+
def switch_plugin_to_development(path, stdout)
|
58
|
+
installed_version = stdout.scan(/Installing diffend (\d*\.\d*\.\d*)/)[0][0]
|
59
|
+
diffend_working_path = File.expand_path('..', Bundler.bin_path)
|
60
|
+
bundler_plugins_path = File.join(path, '.bundle/plugin/gems')
|
61
|
+
bundler_diffend_plugin_path = File.join(bundler_plugins_path, "diffend-#{installed_version}")
|
62
|
+
FileUtils.mv(bundler_diffend_plugin_path, "#{bundler_diffend_plugin_path}-")
|
63
|
+
FileUtils.ln_s(diffend_working_path, bundler_diffend_plugin_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
# @param path [String] path to the repository
|
67
|
+
def add_plugin_to_gemfile(path)
|
68
|
+
gemfile_path = File.join(path, GEMFILE_FILE_NAME)
|
69
|
+
|
70
|
+
FileUtils.mv(gemfile_path, File.join(path, GEMFILE_BACKUP_FILE_NAME))
|
71
|
+
file = File.open(gemfile_path, 'w')
|
72
|
+
source_detected = nil
|
73
|
+
|
74
|
+
File.readlines(
|
75
|
+
File.join(path, GEMFILE_BACKUP_FILE_NAME)
|
76
|
+
).each do |line|
|
77
|
+
if line.start_with?('source') && source_detected.nil?
|
78
|
+
source_detected = true
|
79
|
+
elsif source_detected
|
80
|
+
source_detected = false
|
81
|
+
file.write("\n#{GEMFILE_PLUGIN_ENTRY}\n")
|
82
|
+
end
|
83
|
+
|
84
|
+
file.write(line)
|
85
|
+
end
|
86
|
+
|
87
|
+
file.close
|
88
|
+
|
89
|
+
FileUtils.rm(File.join(path, GEMFILE_BACKUP_FILE_NAME))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -56,7 +56,7 @@ module Diffend
|
|
56
56
|
#
|
57
57
|
# @return [Array]
|
58
58
|
def tags
|
59
|
-
tags =
|
59
|
+
tags = prepare_user_tags
|
60
60
|
|
61
61
|
if ENV.key?('GITHUB_ACTIONS')
|
62
62
|
tags << 'ci'
|
@@ -71,6 +71,17 @@ module Diffend
|
|
71
71
|
tags
|
72
72
|
end
|
73
73
|
|
74
|
+
# Prepare user tags
|
75
|
+
#
|
76
|
+
# @return [Array]
|
77
|
+
def prepare_user_tags
|
78
|
+
if ENV.key?('DIFFEND_TAGS')
|
79
|
+
ENV['DIFFEND_TAGS'].split(',')
|
80
|
+
else
|
81
|
+
[]
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
74
85
|
# @param str [String] that we want to clean and truncate
|
75
86
|
def clean(str)
|
76
87
|
str
|
@@ -39,8 +39,7 @@ module Diffend
|
|
39
39
|
::Bundler.ui.silence { instance.resolve }
|
40
40
|
|
41
41
|
case command
|
42
|
-
when Commands::INSTALL, Commands::EXEC, Commands::SECURE then instance.
|
43
|
-
when Commands::UPDATE then instance.build_update
|
42
|
+
when Commands::INSTALL, Commands::EXEC, Commands::SECURE, Commands::UPDATE, Commands::ADD then instance.build
|
44
43
|
else
|
45
44
|
raise ArgumentError, "invalid command: #{command}"
|
46
45
|
end
|
@@ -63,37 +62,21 @@ module Diffend
|
|
63
62
|
# Resolve definition
|
64
63
|
def resolve
|
65
64
|
@cached ? @definition.resolve_with_cache! : @definition.resolve_remotely!
|
66
|
-
end
|
67
|
-
|
68
|
-
# Build install specification
|
69
|
-
#
|
70
|
-
# @return [Hash]
|
71
|
-
def build_install
|
72
|
-
hash = build_main
|
73
|
-
|
74
|
-
@definition.specs.each do |spec|
|
75
|
-
next if skip?(spec.source)
|
76
|
-
|
77
|
-
locked_spec = @locked_specs.find { |s| s.name == spec.name }
|
78
|
-
|
79
|
-
hash['dependencies'][spec.name] = {
|
80
|
-
'platform' => build_spec_platform(spec, locked_spec),
|
81
|
-
'source' => build_spec_source(spec),
|
82
|
-
'type' => build_dependency_type(spec.name),
|
83
|
-
'versions' => build_versions(spec, locked_spec)
|
84
|
-
}
|
85
|
-
end
|
86
65
|
|
87
|
-
|
66
|
+
# Despite bundler not materializing resolution, we always need to do so to get all the
|
67
|
+
# gems details
|
68
|
+
@definition.specs
|
88
69
|
end
|
89
70
|
|
90
|
-
# Build
|
71
|
+
# Build specification
|
91
72
|
#
|
92
73
|
# @return [Hash]
|
93
|
-
def
|
74
|
+
def build
|
94
75
|
hash = build_main
|
95
76
|
|
96
|
-
@definition.
|
77
|
+
@definition.resolve.each do |spec|
|
78
|
+
# Skip metadata
|
79
|
+
next if spec.instance_variable_get(:@specification).nil?
|
97
80
|
next if skip?(spec.source)
|
98
81
|
|
99
82
|
locked_spec = @locked_specs.find { |s| s.name == spec.name }
|
@@ -117,8 +100,8 @@ module Diffend
|
|
117
100
|
def build_main
|
118
101
|
{
|
119
102
|
'dependencies' => {},
|
120
|
-
'sources' => build_sources,
|
121
103
|
'plugins' => {},
|
104
|
+
'sources' => build_sources,
|
122
105
|
'platforms' => @definition.platforms.map(&:to_s)
|
123
106
|
}
|
124
107
|
end
|