dependabot-bundler 0.280.0 → 0.282.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/bundler/helpers.rb +1 -13
- data/lib/dependabot/bundler/package_manager.rb +6 -6
- data/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb +1 -2
- metadata +12 -37
- data/helpers/v1/.gitignore +0 -8
- data/helpers/v1/Gemfile +0 -7
- data/helpers/v1/build +0 -29
- data/helpers/v1/lib/functions/conflicting_dependency_resolver.rb +0 -89
- data/helpers/v1/lib/functions/dependency_source.rb +0 -90
- data/helpers/v1/lib/functions/file_parser.rb +0 -119
- data/helpers/v1/lib/functions/force_updater.rb +0 -173
- data/helpers/v1/lib/functions/lockfile_updater.rb +0 -218
- data/helpers/v1/lib/functions/version_resolver.rb +0 -141
- data/helpers/v1/lib/functions.rb +0 -172
- data/helpers/v1/monkey_patches/definition_bundler_version_patch.rb +0 -16
- data/helpers/v1/monkey_patches/definition_ruby_version_patch.rb +0 -22
- data/helpers/v1/monkey_patches/fileutils_keyword_splat_patch.rb +0 -20
- data/helpers/v1/monkey_patches/git_source_patch.rb +0 -62
- data/helpers/v1/monkey_patches/object_untaint_patch.rb +0 -17
- data/helpers/v1/monkey_patches/resolver_spec_group_sane_eql.rb +0 -18
- data/helpers/v1/patched_bundler +0 -34
- data/helpers/v1/run.rb +0 -38
- data/helpers/v1/spec/functions/conflicting_dependency_resolver_spec.rb +0 -118
- data/helpers/v1/spec/functions/dependency_source_spec.rb +0 -188
- data/helpers/v1/spec/functions/file_parser_spec.rb +0 -75
- data/helpers/v1/spec/functions/force_updater_spec.rb +0 -59
- data/helpers/v1/spec/functions/version_resolver_spec.rb +0 -105
- data/helpers/v1/spec/native_spec_helper.rb +0 -56
- data/helpers/v1/spec/shared_contexts.rb +0 -60
@@ -1,16 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/definition"
|
5
|
-
|
6
|
-
# Ignore the Bundler version specified in the Gemfile (since the only Bundler
|
7
|
-
# version available to us is the one we're using).
|
8
|
-
module BundlerDefinitionBundlerVersionPatch
|
9
|
-
def expanded_dependencies
|
10
|
-
@expanded_dependencies ||=
|
11
|
-
expand_dependencies(dependencies + metadata_dependencies, @remote)
|
12
|
-
.reject { |d| d.name == "bundler" }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
Bundler::Definition.prepend(BundlerDefinitionBundlerVersionPatch)
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/definition"
|
5
|
-
|
6
|
-
module BundlerDefinitionRubyVersionPatch
|
7
|
-
def index
|
8
|
-
@index ||= super.tap do
|
9
|
-
if ruby_version
|
10
|
-
requested_version = ruby_version.to_gem_version_with_patchlevel
|
11
|
-
sources.metadata_source.specs <<
|
12
|
-
Gem::Specification.new("ruby\0", requested_version)
|
13
|
-
end
|
14
|
-
|
15
|
-
%w(2.5.3p105 2.6.10p210 2.7.6p219 3.0.7p220 3.1.5p252 3.2.4p170).each do |version|
|
16
|
-
sources.metadata_source.specs << Gem::Specification.new("ruby\0", version)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
Bundler::Definition.prepend(BundlerDefinitionRubyVersionPatch)
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/vendor/fileutils/lib/fileutils"
|
5
|
-
|
6
|
-
# Port
|
7
|
-
# https://github.com/ruby/fileutils/commit/a5eca84a4240e29bb7886c3ef7085d464a972dd0
|
8
|
-
# to fix keyword argument errors on Ruby 3.1
|
9
|
-
|
10
|
-
module BundlerFileUtilsKeywordSplatPatch
|
11
|
-
def entries
|
12
|
-
opts = {}
|
13
|
-
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
|
14
|
-
Dir.entries(path, **opts)
|
15
|
-
.reject { |n| n == "." || n == ".." }
|
16
|
-
.map { |n| self.class.new(prefix, join(rel, n.untaint)) }
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Bundler::FileUtils::Entry_.prepend(BundlerFileUtilsKeywordSplatPatch)
|
@@ -1,62 +0,0 @@
|
|
1
|
-
# typed: true
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/source"
|
5
|
-
|
6
|
-
module Bundler
|
7
|
-
class Source
|
8
|
-
class Git
|
9
|
-
class GitProxy
|
10
|
-
private
|
11
|
-
|
12
|
-
# Bundler allows ssh authentication when talking to GitHub but there's
|
13
|
-
# no way for Dependabot to do so (it doesn't have any ssh keys).
|
14
|
-
# Instead, we convert all `git@github.com:` URLs to use HTTPS.
|
15
|
-
def configured_uri_for(uri)
|
16
|
-
uri = uri.gsub(%r{git@(.*?):/?}, 'https://\1/')
|
17
|
-
if uri.match?(/https?:/)
|
18
|
-
remote = ::URI.parse(uri)
|
19
|
-
config_auth =
|
20
|
-
Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
|
21
|
-
remote.userinfo ||= config_auth
|
22
|
-
remote.to_s
|
23
|
-
else
|
24
|
-
uri
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
module Bundler
|
33
|
-
class Source
|
34
|
-
class Git < Path
|
35
|
-
private
|
36
|
-
|
37
|
-
def serialize_gemspecs_in(destination)
|
38
|
-
original_load_paths = $LOAD_PATH.dup
|
39
|
-
reduced_load_paths = original_load_paths
|
40
|
-
.reject { |p| p.include?("/gems/") }
|
41
|
-
|
42
|
-
$LOAD_PATH.shift until $LOAD_PATH.empty?
|
43
|
-
reduced_load_paths.each { |p| $LOAD_PATH << p }
|
44
|
-
|
45
|
-
destination = destination.expand_path(Bundler.root) if destination.relative?
|
46
|
-
Dir["#{destination}/#{@glob}"].each do |spec_path|
|
47
|
-
# Evaluate gemspecs and cache the result. Gemspecs
|
48
|
-
# in git might require git or other dependencies.
|
49
|
-
# The gemspecs we cache should already be evaluated.
|
50
|
-
spec = Bundler.load_gemspec(spec_path)
|
51
|
-
next unless spec
|
52
|
-
|
53
|
-
Bundler.rubygems.set_installed_by_version(spec)
|
54
|
-
Bundler.rubygems.validate(spec)
|
55
|
-
File.binwrite(spec_path, spec.to_ruby)
|
56
|
-
end
|
57
|
-
$LOAD_PATH.shift until $LOAD_PATH.empty?
|
58
|
-
original_load_paths.each { |p| $LOAD_PATH << p }
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# Bundler v1 uses the `untaint` method on objects in `Bundler::SharedHelpers`.
|
5
|
-
# This method has been deprecated for a long time, and is actually a no-op in
|
6
|
-
# ruby versions 2.7+. In Ruby 3.3 it was finally removed, and it's now causing
|
7
|
-
# bundler v1 to error.
|
8
|
-
#
|
9
|
-
# In order to keep the old behavior, we're monkey patching `Object` to add a
|
10
|
-
# no-op implementation of untaint.
|
11
|
-
module ObjectUntaintPatch
|
12
|
-
def untaint
|
13
|
-
self
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
Object.prepend(ObjectUntaintPatch)
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "bundler/resolver/spec_group"
|
5
|
-
|
6
|
-
# Port
|
7
|
-
# https://github.com/rubygems/bundler/commit/30a690edbdf5ee64ea54afc7d0c91d910ff2b80e
|
8
|
-
# to fix flaky failures on Bundler 1
|
9
|
-
|
10
|
-
module BundlerResolverSpecGroupSaneEql
|
11
|
-
def eql?(other)
|
12
|
-
return false unless other.is_a?(self.class)
|
13
|
-
|
14
|
-
super
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Bundler::Resolver::SpecGroup.prepend(BundlerResolverSpecGroupSaneEql)
|
data/helpers/v1/patched_bundler
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/local/bin/ruby
|
2
|
-
#
|
3
|
-
# This file was generated by RubyGems.
|
4
|
-
# It was then patched by Dependabot to add `Object#untaint` back
|
5
|
-
# in order to run bundler 1.17.3 using Ruby 3.3+.
|
6
|
-
#
|
7
|
-
# The application 'bundler' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
$LOAD_PATH.unshift(File.expand_path("./monkey_patches", __dir__))
|
12
|
-
require "object_untaint_patch"
|
13
|
-
|
14
|
-
require 'rubygems'
|
15
|
-
|
16
|
-
version = ">= 0.a"
|
17
|
-
|
18
|
-
str = ARGV.first
|
19
|
-
if str
|
20
|
-
str = str.b[/\A_(.*)_\z/, 1]
|
21
|
-
if str and Gem::Version.correct?(str)
|
22
|
-
version = str
|
23
|
-
ENV['BUNDLER_VERSION'] = str
|
24
|
-
|
25
|
-
ARGV.shift
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
if Gem.respond_to?(:activate_bin_path)
|
30
|
-
load Gem.activate_bin_path('bundler', 'bundle', version)
|
31
|
-
else
|
32
|
-
gem "bundler", version
|
33
|
-
load Gem.bin_path("bundler", "bundle", version)
|
34
|
-
end
|
data/helpers/v1/run.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# typed: strict
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
gem "bundler", "~> 1.17"
|
5
|
-
require "bundler"
|
6
|
-
require "json"
|
7
|
-
|
8
|
-
$LOAD_PATH.unshift(File.expand_path("./lib", __dir__))
|
9
|
-
$LOAD_PATH.unshift(File.expand_path("./monkey_patches", __dir__))
|
10
|
-
|
11
|
-
trap "HUP" do
|
12
|
-
puts JSON.generate(error: "timeout", error_class: "Timeout::Error", trace: [])
|
13
|
-
exit 2
|
14
|
-
end
|
15
|
-
|
16
|
-
# Bundler monkey patches
|
17
|
-
require "definition_ruby_version_patch"
|
18
|
-
require "definition_bundler_version_patch"
|
19
|
-
require "fileutils_keyword_splat_patch"
|
20
|
-
require "git_source_patch"
|
21
|
-
require "resolver_spec_group_sane_eql"
|
22
|
-
require "object_untaint_patch"
|
23
|
-
|
24
|
-
require "functions"
|
25
|
-
|
26
|
-
begin
|
27
|
-
request = JSON.parse($stdin.read)
|
28
|
-
|
29
|
-
function = request["function"]
|
30
|
-
args = request["args"].transform_keys(&:to_sym)
|
31
|
-
|
32
|
-
print JSON.dump({ result: Functions.send(function, **args) })
|
33
|
-
rescue StandardError => e
|
34
|
-
print JSON.dump(
|
35
|
-
{ error: e.message, error_class: e.class, trace: e.backtrace }
|
36
|
-
)
|
37
|
-
exit(1)
|
38
|
-
end
|
@@ -1,118 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "native_spec_helper"
|
5
|
-
require "shared_contexts"
|
6
|
-
|
7
|
-
RSpec.describe Functions::ConflictingDependencyResolver do
|
8
|
-
include_context "when in a temporary bundler directory"
|
9
|
-
|
10
|
-
let(:conflicting_dependency_resolver) do
|
11
|
-
described_class.new(
|
12
|
-
dependency_name: dependency_name,
|
13
|
-
target_version: target_version,
|
14
|
-
lockfile_name: "Gemfile.lock"
|
15
|
-
)
|
16
|
-
end
|
17
|
-
|
18
|
-
let(:dependency_name) { "dummy-pkg-a" }
|
19
|
-
let(:target_version) { "2.0.0" }
|
20
|
-
|
21
|
-
let(:project_name) { "blocked_by_subdep" }
|
22
|
-
|
23
|
-
describe "#conflicting_dependencies" do
|
24
|
-
subject(:conflicting_dependencies) do
|
25
|
-
in_tmp_folder { conflicting_dependency_resolver.conflicting_dependencies }
|
26
|
-
end
|
27
|
-
|
28
|
-
it "returns a list of dependencies that block the update" do
|
29
|
-
expect(conflicting_dependencies).to eq(
|
30
|
-
[{
|
31
|
-
"explanation" => "dummy-pkg-b (1.0.0) requires dummy-pkg-a (< 2.0.0)",
|
32
|
-
"name" => "dummy-pkg-b",
|
33
|
-
"version" => "1.0.0",
|
34
|
-
"requirement" => "< 2.0.0"
|
35
|
-
}]
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
context "when dealing with nested transitive dependencies" do
|
40
|
-
let(:project_name) { "transitive_blocking" }
|
41
|
-
let(:dependency_name) { "activesupport" }
|
42
|
-
let(:target_version) { "6.0.0" }
|
43
|
-
|
44
|
-
it "returns a list of dependencies that block the update" do
|
45
|
-
expect(conflicting_dependencies).to contain_exactly({
|
46
|
-
"explanation" => "rails (5.2.0) requires activesupport (= 5.2.0)",
|
47
|
-
"name" => "rails",
|
48
|
-
"requirement" => "= 5.2.0",
|
49
|
-
"version" => "5.2.0"
|
50
|
-
}, {
|
51
|
-
"explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via actionpack (5.2.0)",
|
52
|
-
"name" => "actionpack",
|
53
|
-
"version" => "5.2.0",
|
54
|
-
"requirement" => "= 5.2.0"
|
55
|
-
}, {
|
56
|
-
"explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via actionview (5.2.0)",
|
57
|
-
"name" => "actionview",
|
58
|
-
"version" => "5.2.0",
|
59
|
-
"requirement" => "= 5.2.0"
|
60
|
-
}, {
|
61
|
-
"explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via activejob (5.2.0)",
|
62
|
-
"name" => "activejob",
|
63
|
-
"version" => "5.2.0",
|
64
|
-
"requirement" => "= 5.2.0"
|
65
|
-
}, {
|
66
|
-
"explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via activemodel (5.2.0)",
|
67
|
-
"name" => "activemodel",
|
68
|
-
"version" => "5.2.0",
|
69
|
-
"requirement" => "= 5.2.0"
|
70
|
-
}, {
|
71
|
-
"explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via activerecord (5.2.0)",
|
72
|
-
"name" => "activerecord",
|
73
|
-
"version" => "5.2.0",
|
74
|
-
"requirement" => "= 5.2.0"
|
75
|
-
}, {
|
76
|
-
"explanation" => "rails (5.2.0) requires activesupport (= 5.2.0) via railties (5.2.0)",
|
77
|
-
"name" => "railties",
|
78
|
-
"version" => "5.2.0",
|
79
|
-
"requirement" => "= 5.2.0"
|
80
|
-
})
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context "with multiple blocking dependencies" do
|
85
|
-
let(:dependency_name) { "activesupport" }
|
86
|
-
let(:current_version) { "5.0.0" }
|
87
|
-
let(:target_version) { "6.0.0" }
|
88
|
-
let(:project_name) { "multiple_blocking" }
|
89
|
-
|
90
|
-
it "returns all of the blocking dependencies" do
|
91
|
-
expect(conflicting_dependencies).to contain_exactly({
|
92
|
-
"explanation" => "actionmailer (5.0.0) requires activesupport (= 5.0.0) via actionpack (5.0.0)",
|
93
|
-
"name" => "actionpack",
|
94
|
-
"version" => "5.0.0",
|
95
|
-
"requirement" => "= 5.0.0"
|
96
|
-
}, {
|
97
|
-
"explanation" => "actionview (5.0.0) requires activesupport (= 5.0.0)",
|
98
|
-
"name" => "actionview",
|
99
|
-
"version" => "5.0.0",
|
100
|
-
"requirement" => "= 5.0.0"
|
101
|
-
}, {
|
102
|
-
"explanation" => "actionmailer (5.0.0) requires activesupport (= 5.0.0) via activejob (5.0.0)",
|
103
|
-
"name" => "activejob",
|
104
|
-
"version" => "5.0.0",
|
105
|
-
"requirement" => "= 5.0.0"
|
106
|
-
})
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context "without any blocking dependencies" do
|
111
|
-
let(:target_version) { "1.0.0" }
|
112
|
-
|
113
|
-
it "returns an empty list" do
|
114
|
-
expect(conflicting_dependencies).to eq([])
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
@@ -1,188 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "native_spec_helper"
|
5
|
-
require "shared_contexts"
|
6
|
-
|
7
|
-
RSpec.describe Functions::DependencySource do
|
8
|
-
include_context "when in a temporary bundler directory"
|
9
|
-
|
10
|
-
let(:dependency_source) do
|
11
|
-
described_class.new(
|
12
|
-
gemfile_name: "Gemfile",
|
13
|
-
dependency_name: dependency_name
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
let(:dependency_name) { "business" }
|
18
|
-
|
19
|
-
let(:project_name) { "specified_source_no_lockfile" }
|
20
|
-
let(:registry_url) { "https://repo.fury.io/greysteil/" }
|
21
|
-
let(:gemfury_business_url) do
|
22
|
-
"https://repo.fury.io/greysteil/api/v1/dependencies?gems=business"
|
23
|
-
end
|
24
|
-
|
25
|
-
before do
|
26
|
-
stub_request(:get, registry_url + "versions")
|
27
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
28
|
-
.to_return(status: 404)
|
29
|
-
stub_request(:get, registry_url + "api/v1/dependencies")
|
30
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
31
|
-
.to_return(status: 200)
|
32
|
-
stub_request(:get, gemfury_business_url)
|
33
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
34
|
-
.to_return(status: 200, body: fixture("ruby", "gemfury_response"))
|
35
|
-
end
|
36
|
-
|
37
|
-
describe "#private_registry_versions" do
|
38
|
-
subject(:private_registry_versions) do
|
39
|
-
in_tmp_folder { dependency_source.private_registry_versions }
|
40
|
-
end
|
41
|
-
|
42
|
-
it "returns all versions from the private source" do
|
43
|
-
expect(private_registry_versions).to eq([
|
44
|
-
Gem::Version.new("1.5.0"),
|
45
|
-
Gem::Version.new("1.9.0"),
|
46
|
-
Gem::Version.new("1.10.0.beta")
|
47
|
-
])
|
48
|
-
end
|
49
|
-
|
50
|
-
context "when specified as the default source" do
|
51
|
-
let(:project_name) { "specified_default_source_no_lockfile" }
|
52
|
-
|
53
|
-
it "returns all versions from the private source" do
|
54
|
-
expect(private_registry_versions).to eq([
|
55
|
-
Gem::Version.new("1.5.0"),
|
56
|
-
Gem::Version.new("1.9.0"),
|
57
|
-
Gem::Version.new("1.10.0.beta")
|
58
|
-
])
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "when we don't have authentication details for" do
|
63
|
-
before do
|
64
|
-
stub_request(:get, registry_url + "versions")
|
65
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
66
|
-
.to_return(status: 401)
|
67
|
-
stub_request(:get, registry_url + "api/v1/dependencies")
|
68
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
69
|
-
.to_return(status: 401)
|
70
|
-
stub_request(:get, registry_url + "specs.4.8.gz")
|
71
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
72
|
-
.to_return(status: 401)
|
73
|
-
end
|
74
|
-
|
75
|
-
it "blows up with a useful error" do
|
76
|
-
error_class = Bundler::Fetcher::AuthenticationRequiredError
|
77
|
-
error_message = "Authentication is required for repo.fury.io"
|
78
|
-
expect { private_registry_versions }
|
79
|
-
.to raise_error do |error|
|
80
|
-
expect(error).to be_a(error_class)
|
81
|
-
expect(error.message).to include(error_message)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
context "when we have bad authentication details" do
|
87
|
-
before do
|
88
|
-
stub_request(:get, registry_url + "versions")
|
89
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
90
|
-
.to_return(status: 403)
|
91
|
-
stub_request(:get, registry_url + "api/v1/dependencies")
|
92
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
93
|
-
.to_return(status: 403)
|
94
|
-
stub_request(:get, registry_url + "specs.4.8.gz")
|
95
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
96
|
-
.to_return(status: 403)
|
97
|
-
end
|
98
|
-
|
99
|
-
it "blows up with a useful error" do
|
100
|
-
error_class = Bundler::Fetcher::BadAuthenticationError
|
101
|
-
expect { private_registry_versions }
|
102
|
-
.to raise_error do |error|
|
103
|
-
expect(error).to be_a(error_class)
|
104
|
-
expect(error.message)
|
105
|
-
.to include("Bad username or password for")
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context "when bad-requested, but is a private repo" do
|
111
|
-
before do
|
112
|
-
stub_request(:get, registry_url + "versions")
|
113
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
114
|
-
.to_return(status: 400)
|
115
|
-
stub_request(:get, registry_url + "api/v1/dependencies")
|
116
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
117
|
-
.to_return(status: 400)
|
118
|
-
stub_request(:get, registry_url + "specs.4.8.gz")
|
119
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
120
|
-
.to_return(status: 400)
|
121
|
-
end
|
122
|
-
|
123
|
-
it "blows up with a useful error" do
|
124
|
-
expect { private_registry_versions }
|
125
|
-
.to raise_error do |error|
|
126
|
-
expect(error).to be_a(Bundler::HTTPError)
|
127
|
-
expect(error.message)
|
128
|
-
.to include("Could not fetch specs from")
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
context "when it doesn't have details of the gem" do
|
134
|
-
before do
|
135
|
-
stub_request(:get, gemfury_business_url)
|
136
|
-
.with(basic_auth: ["SECRET_CODES", ""])
|
137
|
-
.to_return(status: 404)
|
138
|
-
|
139
|
-
# Stub indexes to return details of other gems (but not this one)
|
140
|
-
stub_request(:get, registry_url + "specs.4.8.gz")
|
141
|
-
.to_return(
|
142
|
-
status: 200,
|
143
|
-
body: fixture("ruby", "contribsys_old_index_response")
|
144
|
-
)
|
145
|
-
stub_request(:get, registry_url + "prerelease_specs.4.8.gz")
|
146
|
-
.to_return(
|
147
|
-
status: 200,
|
148
|
-
body: fixture("ruby", "contribsys_old_index_prerelease_response")
|
149
|
-
)
|
150
|
-
end
|
151
|
-
|
152
|
-
it { is_expected.to be_empty }
|
153
|
-
end
|
154
|
-
|
155
|
-
context "when it only implements the old Bundler index format" do
|
156
|
-
let(:project_name) { "sidekiq_pro" }
|
157
|
-
let(:dependency_name) { "sidekiq-pro" }
|
158
|
-
let(:registry_url) { "https://gems.contribsys.com/" }
|
159
|
-
|
160
|
-
before do
|
161
|
-
stub_request(:get, registry_url + "versions")
|
162
|
-
.with(basic_auth: %w(username password))
|
163
|
-
.to_return(status: 404)
|
164
|
-
stub_request(:get, registry_url + "api/v1/dependencies")
|
165
|
-
.with(basic_auth: %w(username password))
|
166
|
-
.to_return(status: 404)
|
167
|
-
stub_request(:get, registry_url + "specs.4.8.gz")
|
168
|
-
.with(basic_auth: %w(username password))
|
169
|
-
.to_return(
|
170
|
-
status: 200,
|
171
|
-
body: fixture("ruby", "contribsys_old_index_response")
|
172
|
-
)
|
173
|
-
stub_request(:get, registry_url + "prerelease_specs.4.8.gz")
|
174
|
-
.with(basic_auth: %w(username password))
|
175
|
-
.to_return(
|
176
|
-
status: 200,
|
177
|
-
body: fixture("ruby", "contribsys_old_index_prerelease_response")
|
178
|
-
)
|
179
|
-
end
|
180
|
-
|
181
|
-
it "returns all versions from the private source" do
|
182
|
-
expect(private_registry_versions.length).to be(70)
|
183
|
-
expect(private_registry_versions.min).to eql(Gem::Version.new("1.0.0"))
|
184
|
-
expect(private_registry_versions.max).to eql(Gem::Version.new("3.5.2"))
|
185
|
-
end
|
186
|
-
end
|
187
|
-
end
|
188
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "native_spec_helper"
|
5
|
-
require "shared_contexts"
|
6
|
-
|
7
|
-
RSpec.describe Functions::FileParser do
|
8
|
-
include_context "when in a temporary bundler directory"
|
9
|
-
|
10
|
-
let(:dependency_source) do
|
11
|
-
described_class.new(
|
12
|
-
lockfile_name: "Gemfile.lock"
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "#parsed_gemfile" do
|
17
|
-
subject(:parsed_gemfile) do
|
18
|
-
in_tmp_folder do
|
19
|
-
dependency_source.parsed_gemfile(gemfile_name: "Gemfile")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:project_name) { "gemfile" }
|
24
|
-
|
25
|
-
it "parses gemfile" do
|
26
|
-
parsed_gemfile = [
|
27
|
-
{
|
28
|
-
groups: [:default],
|
29
|
-
name: "business",
|
30
|
-
requirement: Gem::Requirement.new("~> 1.4.0"),
|
31
|
-
source: nil,
|
32
|
-
type: :runtime
|
33
|
-
},
|
34
|
-
{
|
35
|
-
groups: [:default],
|
36
|
-
name: "statesman",
|
37
|
-
requirement: Gem::Requirement.new("~> 1.2.0"),
|
38
|
-
source: nil,
|
39
|
-
type: :runtime
|
40
|
-
}
|
41
|
-
]
|
42
|
-
expect(parsed_gemfile).not_to be_nil # to get past IdenticalEqualityAssertion
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "#parsed_gemspec" do
|
47
|
-
subject(:parsed_gemspec) do
|
48
|
-
in_tmp_folder do |_tmp_path|
|
49
|
-
dependency_source.parsed_gemspec(gemspec_name: "example.gemspec")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
let(:project_name) { "gemfile_exact" }
|
54
|
-
|
55
|
-
it "parses gemspec" do
|
56
|
-
parsed_gemspec = [
|
57
|
-
{
|
58
|
-
groups: nil,
|
59
|
-
name: "business",
|
60
|
-
requirement: Gem::Requirement.new("= 1.0.0"),
|
61
|
-
source: nil,
|
62
|
-
type: :runtime
|
63
|
-
},
|
64
|
-
{
|
65
|
-
groups: nil,
|
66
|
-
name: "statesman",
|
67
|
-
requirement: Gem::Requirement.new("= 1.0.0"),
|
68
|
-
source: nil,
|
69
|
-
type: :runtime
|
70
|
-
}
|
71
|
-
]
|
72
|
-
expect(parsed_gemspec).not_to be_nil # to get past IdenticalEqualityAssertion
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# typed: false
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require "native_spec_helper"
|
5
|
-
require "shared_contexts"
|
6
|
-
|
7
|
-
RSpec.describe Functions::ForceUpdater do
|
8
|
-
include_context "when in a temporary bundler directory"
|
9
|
-
include_context "when stubbing rubygems compact index"
|
10
|
-
|
11
|
-
let(:force_updater) do
|
12
|
-
described_class.new(
|
13
|
-
dependency_name: dependency_name,
|
14
|
-
target_version: target_version,
|
15
|
-
gemfile_name: gemfile_name,
|
16
|
-
lockfile_name: lockfile_name,
|
17
|
-
update_multiple_dependencies: update_multiple_dependencies
|
18
|
-
)
|
19
|
-
end
|
20
|
-
let(:gemfile_name) { "Gemfile" }
|
21
|
-
let(:lockfile_name) { "Gemfile.lock" }
|
22
|
-
let(:update_multiple_dependencies) { true }
|
23
|
-
|
24
|
-
describe "#run" do
|
25
|
-
subject(:force_update) do
|
26
|
-
in_tmp_folder { force_updater.run }
|
27
|
-
end
|
28
|
-
|
29
|
-
context "with a version conflict" do
|
30
|
-
let(:target_version) { "3.6.0" }
|
31
|
-
let(:dependency_name) { "rspec-support" }
|
32
|
-
let(:project_name) { "version_conflict" }
|
33
|
-
|
34
|
-
it "updates the conflicting dependencies" do
|
35
|
-
updated_deps, _specs = force_update
|
36
|
-
expect(updated_deps).to eq([{ name: "rspec-support" }, { name: "rspec-mocks" }])
|
37
|
-
end
|
38
|
-
|
39
|
-
context "when updating a single dependency" do
|
40
|
-
let(:update_multiple_dependencies) { false }
|
41
|
-
|
42
|
-
it { expect { force_update }.to raise_error(Bundler::VersionConflict) }
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "with a version conflict in gems rb" do
|
47
|
-
let(:target_version) { "3.6.0" }
|
48
|
-
let(:dependency_name) { "rspec-support" }
|
49
|
-
let(:project_name) { "version_conflict_gems_rb" }
|
50
|
-
let(:gemfile_name) { "gems.rb" }
|
51
|
-
let(:lockfile_name) { "gems.locked" }
|
52
|
-
|
53
|
-
it "updates the conflicting dependencies" do
|
54
|
-
updated_deps, _specs = force_update
|
55
|
-
expect(updated_deps).to eq([{ name: "rspec-support" }, { name: "rspec-mocks" }])
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|