diffend 0.2.18 → 0.2.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.github/workflows/ci.yml +9 -2
- data/CHANGELOG.md +7 -1
- data/Gemfile.lock +1 -1
- data/{LICENSE → LICENSE.md} +0 -0
- data/lib/diffend.rb +1 -1
- data/lib/diffend/voting/versions/local.rb +111 -33
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f18edf14b16e7f2ec3ce0c574ade976e78e3eac84f8395e45fc53595a8e3f91
|
4
|
+
data.tar.gz: 292e755dac0d191787b77fb8556b5e2f90f9e040ee9e28486de90601b2c2a67c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73326da64425debc8c27ad1dd216df34313a45795a2c6f555d0e5df067dfc17977ae9ee6e8307ab1df33af58a87ca23511ed3920eaa9c0bcec566fef602c30c3
|
7
|
+
data.tar.gz: eabf666e6c1ef7a08afaadf519011edac2416f0a2fa13152a9112b898b94dde1f598f23866a9823220be308aa091d9dab6b6d03e95191f3d22ba43509d3933fa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.github/workflows/ci.yml
CHANGED
@@ -3,6 +3,7 @@ name: ci
|
|
3
3
|
jobs:
|
4
4
|
specs:
|
5
5
|
runs-on: ubuntu-latest
|
6
|
+
|
6
7
|
strategy:
|
7
8
|
fail-fast: false
|
8
9
|
matrix:
|
@@ -11,8 +12,15 @@ jobs:
|
|
11
12
|
include:
|
12
13
|
- ruby: '2.7'
|
13
14
|
coverage: 'true'
|
15
|
+
|
14
16
|
steps:
|
15
17
|
- uses: actions/checkout@v2
|
18
|
+
- uses: actions/cache@v2
|
19
|
+
with:
|
20
|
+
path: vendor/bundle
|
21
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
22
|
+
restore-keys: |
|
23
|
+
${{ runner.os }}-gems-
|
16
24
|
- name: Install package dependencies
|
17
25
|
run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
|
18
26
|
- name: Set up Ruby
|
@@ -22,10 +30,9 @@ jobs:
|
|
22
30
|
- name: Install latest bundler
|
23
31
|
run: |
|
24
32
|
gem install bundler --no-document
|
25
|
-
bundle config set without 'tools benchmarks docs'
|
26
33
|
- name: Bundle install
|
27
34
|
run: |
|
28
|
-
bundle config
|
35
|
+
bundle config path vendor/bundle
|
29
36
|
bundle install --jobs 4 --retry 3
|
30
37
|
- name: Run all tests
|
31
38
|
env:
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## [Unreleased][master]
|
4
4
|
|
5
|
+
## [0.2.19] (2020-08-18)
|
6
|
+
|
7
|
+
- better detection of gem sources ([#13](https://github.com/diffend-io/diffend-ruby/pull/13))
|
8
|
+
|
5
9
|
## [0.2.18] (2020-08-05)
|
6
10
|
|
7
11
|
- use `Etc.getpwuid` instead of `Etc.getlogin` for fetching host user ([#11](https://github.com/diffend-io/diffend-ruby/pull/11))
|
@@ -18,6 +22,8 @@
|
|
18
22
|
|
19
23
|
- initial release
|
20
24
|
|
21
|
-
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.
|
25
|
+
[master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.19...HEAD
|
26
|
+
[0.2.19]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.18...v0.2.19
|
27
|
+
[0.2.18]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.17...v0.2.18
|
22
28
|
[0.2.17]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.16...v0.2.17
|
23
29
|
[0.2.16]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.15...v0.2.16
|
data/Gemfile.lock
CHANGED
data/{LICENSE → LICENSE.md}
RENAMED
File without changes
|
data/lib/diffend.rb
CHANGED
@@ -13,17 +13,22 @@ module Diffend
|
|
13
13
|
Bundler::Source::Gemspec,
|
14
14
|
Bundler::Source::Path
|
15
15
|
].freeze
|
16
|
-
|
16
|
+
# List of dependency types
|
17
|
+
DEPENDENCIES_TYPES = {
|
17
18
|
direct: 0,
|
18
|
-
|
19
|
+
dependency: 1
|
19
20
|
}.freeze
|
20
|
-
|
21
|
+
# List of sources types
|
22
|
+
SOURCES_TYPES = {
|
21
23
|
valid: 0,
|
22
24
|
multiple_primary: 1
|
23
25
|
}.freeze
|
24
|
-
|
26
|
+
# List of gem sources types
|
27
|
+
GEM_SOURCES_TYPES = {
|
25
28
|
local: 0,
|
26
|
-
|
29
|
+
gemfile_source: 1,
|
30
|
+
gemfile_git: 2,
|
31
|
+
gemfile_path: 3
|
27
32
|
}.freeze
|
28
33
|
|
29
34
|
class << self
|
@@ -54,6 +59,9 @@ module Diffend
|
|
54
59
|
@locked_specs = @definition.locked_gems ? @definition.locked_gems.specs : []
|
55
60
|
end
|
56
61
|
|
62
|
+
# Build install specification
|
63
|
+
#
|
64
|
+
# @return [Hash]
|
57
65
|
def build_install
|
58
66
|
hash = build_main
|
59
67
|
|
@@ -75,7 +83,9 @@ module Diffend
|
|
75
83
|
hash
|
76
84
|
end
|
77
85
|
|
78
|
-
#
|
86
|
+
# Build update specification
|
87
|
+
#
|
88
|
+
# @return [Hash]
|
79
89
|
def build_update
|
80
90
|
hash = build_main
|
81
91
|
|
@@ -97,6 +107,9 @@ module Diffend
|
|
97
107
|
|
98
108
|
private
|
99
109
|
|
110
|
+
# Build default specification
|
111
|
+
#
|
112
|
+
# @return [Hash]
|
100
113
|
def build_main
|
101
114
|
{
|
102
115
|
'dependencies' => {},
|
@@ -106,6 +119,12 @@ module Diffend
|
|
106
119
|
}
|
107
120
|
end
|
108
121
|
|
122
|
+
# Build gem versions
|
123
|
+
#
|
124
|
+
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
125
|
+
# @param locked_spec [Bundler::LazySpecification, Gem::Specification, NilClass]
|
126
|
+
#
|
127
|
+
# @return [Array<String>]
|
109
128
|
def build_versions(spec, locked_spec = nil)
|
110
129
|
locked_spec ? [locked_spec.version.to_s, spec.version.to_s] : [spec.version.to_s]
|
111
130
|
end
|
@@ -115,45 +134,105 @@ module Diffend
|
|
115
134
|
#
|
116
135
|
# @return [Boolean] dependency type
|
117
136
|
def build_dependency_type(name)
|
118
|
-
@direct_dependencies.key?(name)
|
137
|
+
if @direct_dependencies.key?(name)
|
138
|
+
DEPENDENCIES_TYPES[:direct]
|
139
|
+
else
|
140
|
+
DEPENDENCIES_TYPES[:dependency]
|
141
|
+
end
|
119
142
|
end
|
120
143
|
|
144
|
+
# Build gem platform
|
145
|
+
#
|
146
|
+
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
147
|
+
#
|
148
|
+
# @return [String]
|
121
149
|
def build_spec_platform(spec)
|
122
150
|
spec.platform || spec.send(:generic_local_platform)
|
123
151
|
end
|
124
152
|
|
153
|
+
# Build gem source type
|
154
|
+
#
|
155
|
+
# @param source [Bundler::Source] gem source type
|
156
|
+
#
|
157
|
+
# @return [Integer] internal gem source type
|
158
|
+
def build_spec_gem_source_type(source)
|
159
|
+
case source
|
160
|
+
when Bundler::Source::Metadata
|
161
|
+
GEM_SOURCES_TYPES[:local]
|
162
|
+
when Bundler::Source::Rubygems
|
163
|
+
GEM_SOURCES_TYPES[:gemfile_source]
|
164
|
+
when Bundler::Source::Git
|
165
|
+
GEM_SOURCES_TYPES[:gemfile_git]
|
166
|
+
when Bundler::Source::Path
|
167
|
+
GEM_SOURCES_TYPES[:gemfile_path]
|
168
|
+
else
|
169
|
+
raise ArgumentError, "unknown source #{source.class}"
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Build gem source
|
174
|
+
#
|
175
|
+
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
176
|
+
#
|
177
|
+
# @return [Hash]
|
125
178
|
def build_spec_source(spec)
|
126
|
-
|
127
|
-
dep_spec = @direct_dependencies[spec.name]
|
179
|
+
source = source_for_spec(spec)
|
128
180
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
181
|
+
{
|
182
|
+
'type' => build_spec_gem_source_type(source),
|
183
|
+
'value' => source_name_from_source(source)
|
184
|
+
}
|
185
|
+
end
|
186
|
+
|
187
|
+
# Figure out source for gem
|
188
|
+
#
|
189
|
+
# @param spec [Bundler::StubSpecification, Bundler::LazySpecification, Gem::Specification]
|
190
|
+
#
|
191
|
+
# @return [Bundler::Source] gem source type
|
192
|
+
def source_for_spec(spec)
|
193
|
+
if @direct_dependencies.key?(spec.name)
|
194
|
+
@direct_dependencies[spec.name].source || @main_source
|
134
195
|
else
|
135
|
-
|
136
|
-
{ 'type' => GEM_SOURCES[:gemfile], 'url' => source_name_from_source(spec.source) }
|
137
|
-
else
|
138
|
-
{ 'type' => GEM_SOURCES[:local], 'url' => '' }
|
139
|
-
end
|
196
|
+
spec.source
|
140
197
|
end
|
141
198
|
end
|
142
199
|
|
200
|
+
# Build gem source name
|
201
|
+
#
|
202
|
+
# @param source [Bundler::Source] gem source type
|
203
|
+
#
|
204
|
+
# @return [String]
|
143
205
|
def source_name_from_source(source)
|
144
|
-
|
206
|
+
case source
|
207
|
+
when Bundler::Source::Metadata
|
208
|
+
''
|
209
|
+
when Bundler::Source::Rubygems
|
210
|
+
source_name(source.remotes.first)
|
211
|
+
when Bundler::Source::Git
|
212
|
+
source.uri
|
213
|
+
when Bundler::Source::Path
|
214
|
+
source.path
|
215
|
+
else
|
216
|
+
raise ArgumentError, "unknown source #{source.class}"
|
217
|
+
end
|
145
218
|
end
|
146
219
|
|
220
|
+
# @param name [Bundler::URI]
|
221
|
+
#
|
222
|
+
# @return [String] cleaned source name
|
147
223
|
def source_name(name)
|
148
224
|
name.to_s[0...-1]
|
149
225
|
end
|
150
226
|
|
227
|
+
# Build sources used in the Gemfile
|
228
|
+
#
|
229
|
+
# @return [Array<Hash>]
|
151
230
|
def build_sources
|
152
231
|
sources = @definition.send(:sources).rubygems_sources
|
153
232
|
hash = []
|
154
233
|
|
155
234
|
sources.each do |source|
|
156
|
-
type = source.remotes
|
235
|
+
type = build_source_type(source.remotes)
|
157
236
|
|
158
237
|
source.remotes.each do |src|
|
159
238
|
hash << { 'name' => source_name(src), 'type' => type }
|
@@ -163,30 +242,29 @@ module Diffend
|
|
163
242
|
hash
|
164
243
|
end
|
165
244
|
|
245
|
+
# Build gem source type
|
246
|
+
#
|
247
|
+
# @param remotes [Array<Bundler::URI>]
|
248
|
+
#
|
249
|
+
# @return [Integer] internal source type
|
250
|
+
def build_source_type(remotes)
|
251
|
+
remotes.count > 1 ? SOURCES_TYPES[:multiple_primary] : SOURCES_TYPES[:valid]
|
252
|
+
end
|
253
|
+
|
166
254
|
# Checks if we should skip a source
|
167
255
|
#
|
168
|
-
# @param source [Bundler::Source
|
256
|
+
# @param source [Bundler::Source] gem source type
|
169
257
|
#
|
170
258
|
# @return [Boolean] true if we should skip this source, false otherwise
|
171
259
|
def skip?(source)
|
172
|
-
return true if git?(source)
|
173
260
|
return true if me?(source)
|
174
261
|
|
175
262
|
false
|
176
263
|
end
|
177
264
|
|
178
|
-
# Checks if it's a git source
|
179
|
-
#
|
180
|
-
# @param source [Bundler::Source::Git, Bundler::Source::Rubygems]
|
181
|
-
#
|
182
|
-
# @return [Boolean] true if it's a git source, false otherwise
|
183
|
-
def git?(source)
|
184
|
-
source.instance_of?(Bundler::Source::Git)
|
185
|
-
end
|
186
|
-
|
187
265
|
# Checks if it's a self source, this happens for repositories that are a gem
|
188
266
|
#
|
189
|
-
# @param source [Bundler::Source
|
267
|
+
# @param source [Bundler::Source] gem source type
|
190
268
|
#
|
191
269
|
# @return [Boolean] true if it's a self source, false otherwise
|
192
270
|
def me?(source)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffend
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomasz Pajor
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
9MmF6uCQa1EjK2p8tYT0MnbHrFkoehxdX4VO9y99GAkhZyJNKPYPtyAUFV27sT2V
|
35
35
|
LfCJRk4ifKIN/FUCwDSn8Cz0m6oH265q0p6wdzI6qrWOjP8tGOMBTA==
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2020-08-
|
37
|
+
date: 2020-08-18 00:00:00.000000000 Z
|
38
38
|
dependencies:
|
39
39
|
- !ruby/object:Gem::Dependency
|
40
40
|
name: bundler
|
@@ -80,7 +80,7 @@ files:
|
|
80
80
|
- CHANGELOG.md
|
81
81
|
- Gemfile
|
82
82
|
- Gemfile.lock
|
83
|
-
- LICENSE
|
83
|
+
- LICENSE.md
|
84
84
|
- README.md
|
85
85
|
- bin/bundle
|
86
86
|
- bin/byebug
|
metadata.gz.sig
CHANGED
Binary file
|