dependabot-bundler 0.229.0 → 0.231.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/v1/lib/functions/conflicting_dependency_resolver.rb +1 -0
  3. data/helpers/v1/lib/functions/dependency_source.rb +10 -9
  4. data/helpers/v1/lib/functions/file_parser.rb +8 -7
  5. data/helpers/v1/lib/functions/force_updater.rb +22 -21
  6. data/helpers/v1/lib/functions/lockfile_updater.rb +12 -11
  7. data/helpers/v1/lib/functions/version_resolver.rb +7 -6
  8. data/helpers/v1/lib/functions.rb +16 -15
  9. data/helpers/v1/monkey_patches/definition_bundler_version_patch.rb +3 -2
  10. data/helpers/v1/monkey_patches/definition_ruby_version_patch.rb +1 -0
  11. data/helpers/v1/monkey_patches/fileutils_keyword_splat_patch.rb +4 -3
  12. data/helpers/v1/monkey_patches/git_source_patch.rb +3 -2
  13. data/helpers/v1/monkey_patches/resolver_spec_group_sane_eql.rb +1 -0
  14. data/helpers/v1/run.rb +1 -0
  15. data/helpers/v1/spec/functions/conflicting_dependency_resolver_spec.rb +1 -0
  16. data/helpers/v1/spec/functions/dependency_source_spec.rb +66 -65
  17. data/helpers/v1/spec/functions/file_parser_spec.rb +1 -0
  18. data/helpers/v1/spec/functions/force_updater_spec.rb +1 -0
  19. data/helpers/v1/spec/functions/version_resolver_spec.rb +15 -14
  20. data/helpers/v1/spec/native_spec_helper.rb +1 -0
  21. data/helpers/v1/spec/shared_contexts.rb +7 -6
  22. data/helpers/v2/lib/functions/conflicting_dependency_resolver.rb +1 -0
  23. data/helpers/v2/lib/functions/dependency_source.rb +10 -9
  24. data/helpers/v2/lib/functions/file_parser.rb +8 -7
  25. data/helpers/v2/lib/functions/force_updater.rb +10 -9
  26. data/helpers/v2/lib/functions/lockfile_updater.rb +5 -4
  27. data/helpers/v2/lib/functions/version_resolver.rb +7 -6
  28. data/helpers/v2/lib/functions.rb +16 -15
  29. data/helpers/v2/monkey_patches/definition_bundler_version_patch.rb +1 -0
  30. data/helpers/v2/monkey_patches/definition_ruby_version_patch.rb +1 -0
  31. data/helpers/v2/monkey_patches/git_source_patch.rb +3 -2
  32. data/helpers/v2/run.rb +1 -0
  33. data/helpers/v2/spec/functions/conflicting_dependency_resolver_spec.rb +1 -0
  34. data/helpers/v2/spec/functions/dependency_source_spec.rb +67 -66
  35. data/helpers/v2/spec/functions/file_parser_spec.rb +1 -0
  36. data/helpers/v2/spec/functions/force_updater_spec.rb +1 -0
  37. data/helpers/v2/spec/functions/version_resolver_spec.rb +19 -18
  38. data/helpers/v2/spec/functions_spec.rb +1 -0
  39. data/helpers/v2/spec/native_spec_helper.rb +1 -0
  40. data/helpers/v2/spec/shared_contexts.rb +7 -6
  41. data/lib/dependabot/bundler/file_fetcher/child_gemfile_finder.rb +1 -0
  42. data/lib/dependabot/bundler/file_fetcher/gemspec_finder.rb +3 -2
  43. data/lib/dependabot/bundler/file_fetcher/path_gemspec_finder.rb +3 -2
  44. data/lib/dependabot/bundler/file_fetcher/require_relative_finder.rb +1 -0
  45. data/lib/dependabot/bundler/file_fetcher.rb +25 -24
  46. data/lib/dependabot/bundler/file_parser/file_preparer.rb +15 -14
  47. data/lib/dependabot/bundler/file_parser/gemfile_declaration_finder.rb +1 -0
  48. data/lib/dependabot/bundler/file_parser/gemspec_declaration_finder.rb +1 -0
  49. data/lib/dependabot/bundler/file_parser.rb +23 -22
  50. data/lib/dependabot/bundler/file_updater/gemfile_updater.rb +19 -18
  51. data/lib/dependabot/bundler/file_updater/gemspec_dependency_name_finder.rb +1 -0
  52. data/lib/dependabot/bundler/file_updater/gemspec_sanitizer.rb +8 -7
  53. data/lib/dependabot/bundler/file_updater/gemspec_updater.rb +7 -6
  54. data/lib/dependabot/bundler/file_updater/git_pin_replacer.rb +4 -3
  55. data/lib/dependabot/bundler/file_updater/git_source_remover.rb +1 -0
  56. data/lib/dependabot/bundler/file_updater/lockfile_updater.rb +22 -21
  57. data/lib/dependabot/bundler/file_updater/requirement_replacer.rb +5 -4
  58. data/lib/dependabot/bundler/file_updater/ruby_requirement_setter.rb +5 -4
  59. data/lib/dependabot/bundler/file_updater.rb +16 -15
  60. data/lib/dependabot/bundler/helpers.rb +1 -0
  61. data/lib/dependabot/bundler/metadata_finder.rb +24 -23
  62. data/lib/dependabot/bundler/native_helpers.rb +4 -3
  63. data/lib/dependabot/bundler/requirement.rb +3 -2
  64. data/lib/dependabot/bundler/update_checker/conflicting_dependency_resolver.rb +1 -0
  65. data/lib/dependabot/bundler/update_checker/file_preparer.rb +33 -32
  66. data/lib/dependabot/bundler/update_checker/force_updater.rb +4 -3
  67. data/lib/dependabot/bundler/update_checker/latest_version_finder/dependency_source.rb +5 -4
  68. data/lib/dependabot/bundler/update_checker/latest_version_finder.rb +5 -4
  69. data/lib/dependabot/bundler/update_checker/requirements_updater.rb +6 -5
  70. data/lib/dependabot/bundler/update_checker/shared_bundler_helpers.rb +15 -14
  71. data/lib/dependabot/bundler/update_checker/version_resolver.rb +4 -3
  72. data/lib/dependabot/bundler/update_checker.rb +27 -26
  73. data/lib/dependabot/bundler/version.rb +3 -2
  74. data/lib/dependabot/bundler.rb +3 -2
  75. metadata +19 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aebdf859dd5aea604a8c209c7e74ed216ccafc206c5cd19c225ee0c8971e0896
4
- data.tar.gz: f3f2ec8fa7812e9d4e056e9ec22dbb6b76865aa1790461068c9617d1734cec5e
3
+ metadata.gz: 8631cf2ab576ccaef2da80d1bd94044d4d8a00424bfe92e691c821dc48bb72d8
4
+ data.tar.gz: b89f61a611b1989c8ff4d9c1c3a4606c3abe4b8a9249281f06a2674879dc5445
5
5
  SHA512:
6
- metadata.gz: 619a5a6c1ae140eda8468fb3b5a75893094d990b7f4e86860ee7601012cdc61197df57e7cae17f7c25980e844ab9a169f7c88f124d88219d5e612f358b285a37
7
- data.tar.gz: 6698d2264ce455a7181edda03d4b286e21070286865281982b48ae6044ad830afbbaceeb876999a2ecd3b07e9b5888205064f98c7bedef9f802fcb403939affb
6
+ metadata.gz: e408ac8674a6e65be74574cecd46901ec74a1f4e205f9954779a17ddb7cc628eb390229755c01d428527a0740703447dde01b7942aa164140bb5d3100a3645b7
7
+ data.tar.gz: f1cc908bb2eaf81ac24963fe55744b125549d17dbdb50c2e1ce0c079dce94539cefc6fe1a896079b7fa425583b41e26eecf00997cd96d9f1e17cac39d2941e9f
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Functions
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Functions
@@ -37,13 +38,13 @@ module Functions
37
38
  def private_registry_versions
38
39
  bundler_source = specified_source || default_source
39
40
 
40
- bundler_source.
41
- fetchers.flat_map do |fetcher|
42
- fetcher.
43
- specs_with_retry([dependency_name], bundler_source).
44
- search_all(dependency_name)
45
- end.
46
- map(&:version)
41
+ bundler_source
42
+ .fetchers.flat_map do |fetcher|
43
+ fetcher
44
+ .specs_with_retry([dependency_name], bundler_source)
45
+ .search_all(dependency_name)
46
+ end
47
+ .map(&:version)
47
48
  end
48
49
 
49
50
  private
@@ -67,8 +68,8 @@ module Functions
67
68
  def specified_source
68
69
  return @specified_source if defined? @specified_source
69
70
 
70
- @specified_source = definition.dependencies.
71
- find { |dep| dep.name == dependency_name }&.source
71
+ @specified_source = definition.dependencies
72
+ .find { |dep| dep.name == dependency_name }&.source
72
73
  end
73
74
 
74
75
  def default_source
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "uri"
@@ -11,16 +12,16 @@ module Functions
11
12
  attr_reader :lockfile_name
12
13
 
13
14
  def parsed_gemfile(gemfile_name:)
14
- Bundler::Definition.build(gemfile_name, nil, {}).
15
- dependencies.select(&:current_platform?).
16
- reject { |dep| local_sources.include?(dep.source.class) }.
17
- map { |dep| serialize_bundler_dependency(dep) }
15
+ Bundler::Definition.build(gemfile_name, nil, {})
16
+ .dependencies.select(&:current_platform?)
17
+ .reject { |dep| local_sources.include?(dep.source.class) }
18
+ .map { |dep| serialize_bundler_dependency(dep) }
18
19
  end
19
20
 
20
21
  def parsed_gemspec(gemspec_name:)
21
- Bundler.load_gemspec_uncached(gemspec_name).
22
- dependencies.
23
- map { |dep| serialize_bundler_dependency(dep) }
22
+ Bundler.load_gemspec_uncached(gemspec_name)
23
+ .dependencies
24
+ .map { |dep| serialize_bundler_dependency(dep) }
24
25
  end
25
26
 
26
27
  private
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Functions
@@ -62,9 +63,9 @@ module Functions
62
63
 
63
64
  def new_dependencies_to_unlock_from(error:, already_unlocked:)
64
65
  potentials_deps =
65
- relevant_conflicts(error, already_unlocked).
66
- flat_map(&:requirement_trees).
67
- reject do |tree|
66
+ relevant_conflicts(error, already_unlocked)
67
+ .flat_map(&:requirement_trees)
68
+ .reject do |tree|
68
69
  # If the final requirement wasn't specific, it can't be binding
69
70
  next true if tree.last.requirement == Gem::Requirement.new(">= 0")
70
71
 
@@ -79,10 +80,10 @@ module Functions
79
80
  )
80
81
  end.map(&:first)
81
82
 
82
- potentials_deps.
83
- reject { |dep| already_unlocked.map(&:name).include?(dep.name) }.
84
- reject { |dep| [dependency_name, "ruby\0"].include?(dep.name) }.
85
- uniq
83
+ potentials_deps
84
+ .reject { |dep| already_unlocked.map(&:name).include?(dep.name) }
85
+ .reject { |dep| [dependency_name, "ruby\0"].include?(dep.name) }
86
+ .uniq
86
87
  end
87
88
 
88
89
  def relevant_conflicts(error, dependencies_being_unlocked)
@@ -92,12 +93,12 @@ module Functions
92
93
  # 1) caused by a new requirement introduced by our unlocking, or
93
94
  # 2) caused by an old requirement that prohibits the update.
94
95
  # Hence, we look at the beginning and end of the requirement trees
95
- error.cause.conflicts.values.
96
- select do |conflict|
97
- conflict.requirement_trees.any? do |t|
98
- names.include?(t.last.name) || names.include?(t.first.name)
99
- end
96
+ error.cause.conflicts.values
97
+ .select do |conflict|
98
+ conflict.requirement_trees.any? do |t|
99
+ names.include?(t.last.name) || names.include?(t.first.name)
100
100
  end
101
+ end
101
102
  end
102
103
 
103
104
  def build_definition(dependencies_to_unlock:)
@@ -115,8 +116,8 @@ module Functions
115
116
  unlock_gem(definition: definition, gem_name: gem_name)
116
117
  end
117
118
 
118
- dep = definition.dependencies.
119
- find { |d| d.name == dependency_name }
119
+ dep = definition.dependencies
120
+ .find { |d| d.name == dependency_name }
120
121
 
121
122
  # If the dependency is not found in the Gemfile it means this is a
122
123
  # transitive dependency that we can't force update.
@@ -146,19 +147,19 @@ module Functions
146
147
  # subdependencies
147
148
  return [] unless lockfile
148
149
 
149
- all_deps = Bundler::LockfileParser.new(lockfile).
150
- specs.map { |x| x.name.to_s }
151
- top_level = Bundler::Definition.
152
- build(gemfile_name, lockfile_name, {}).
153
- dependencies.map { |x| x.name.to_s }
150
+ all_deps = Bundler::LockfileParser.new(lockfile)
151
+ .specs.map { |x| x.name.to_s }
152
+ top_level = Bundler::Definition
153
+ .build(gemfile_name, lockfile_name, {})
154
+ .dependencies.map { |x| x.name.to_s }
154
155
 
155
156
  all_deps - top_level
156
157
  end
157
158
 
158
159
  def unlock_gem(definition:, gem_name:)
159
160
  dep = definition.dependencies.find { |d| d.name == gem_name }
160
- version = definition.locked_gems.specs.
161
- find { |d| d.name == gem_name }.version
161
+ version = definition.locked_gems.specs
162
+ .find { |d| d.name == gem_name }.version
162
163
 
163
164
  dep&.instance_variable_set(
164
165
  :@requirement,
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "fileutils"
@@ -63,8 +64,8 @@ module Functions
63
64
  def cache_vendored_gems(definition)
64
65
  # Dependencies that have been unlocked for the update (including
65
66
  # sub-dependencies)
66
- unlocked_gems = definition.instance_variable_get(:@unlock).
67
- fetch(:gems)
67
+ unlocked_gems = definition.instance_variable_get(:@unlock)
68
+ .fetch(:gems)
68
69
  bundler_opts = {
69
70
  cache_all: true,
70
71
  cache_all_platforms: true,
@@ -129,18 +130,18 @@ module Functions
129
130
  def unlock_yanked_gem(dependencies_to_unlock, error)
130
131
  raise unless error.message.match?(GEM_NOT_FOUND_ERROR_REGEX)
131
132
 
132
- gem_name = error.message.match(GEM_NOT_FOUND_ERROR_REGEX).
133
- named_captures["name"]
133
+ gem_name = error.message.match(GEM_NOT_FOUND_ERROR_REGEX)
134
+ .named_captures["name"]
134
135
  raise if dependencies_to_unlock.include?(gem_name)
135
136
 
136
137
  dependencies_to_unlock << gem_name
137
138
  end
138
139
 
139
140
  def unlock_blocking_subdeps(dependencies_to_unlock, error)
140
- all_deps = Bundler::LockfileParser.new(lockfile).
141
- specs.map { |x| x.name.to_s }
142
- top_level = build_definition([]).dependencies.
143
- map { |x| x.name.to_s }
141
+ all_deps = Bundler::LockfileParser.new(lockfile)
142
+ .specs.map { |x| x.name.to_s }
143
+ top_level = build_definition([]).dependencies
144
+ .map { |x| x.name.to_s }
144
145
  allowed_new_unlocks = all_deps - top_level - dependencies_to_unlock
145
146
 
146
147
  raise if allowed_new_unlocks.none?
@@ -148,9 +149,9 @@ module Functions
148
149
  # Unlock any sub-dependencies that Bundler reports caused the
149
150
  # conflict
150
151
  potentials_deps =
151
- error.cause.conflicts.values.
152
- flat_map(&:requirement_trees).
153
- filter_map do |tree|
152
+ error.cause.conflicts.values
153
+ .flat_map(&:requirement_trees)
154
+ .filter_map do |tree|
154
155
  tree.find { |req| allowed_new_unlocks.include?(req.name) }
155
156
  end.map(&:name)
156
157
 
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Functions
@@ -81,10 +82,10 @@ module Functions
81
82
  # subdependencies
82
83
  return [] unless lockfile
83
84
 
84
- all_deps = ::Bundler::LockfileParser.new(lockfile).
85
- specs.map { |x| x.name.to_s }.uniq
86
- top_level = build_definition([]).dependencies.
87
- map { |x| x.name.to_s }
85
+ all_deps = ::Bundler::LockfileParser.new(lockfile)
86
+ .specs.map { |x| x.name.to_s }.uniq
87
+ top_level = build_definition([]).dependencies
88
+ .map { |x| x.name.to_s }
88
89
 
89
90
  all_deps - top_level
90
91
  end
@@ -104,8 +105,8 @@ module Functions
104
105
  def unlock_yanked_gem(dependencies_to_unlock, error)
105
106
  raise unless error.message.match?(GEM_NOT_FOUND_ERROR_REGEX)
106
107
 
107
- gem_name = error.message.match(GEM_NOT_FOUND_ERROR_REGEX).
108
- named_captures["name"]
108
+ gem_name = error.message.match(GEM_NOT_FOUND_ERROR_REGEX)
109
+ .named_captures["name"]
109
110
  raise if dependencies_to_unlock.include?(gem_name)
110
111
 
111
112
  dependencies_to_unlock << gem_name
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "functions/file_parser"
@@ -10,14 +11,14 @@ require "functions/conflicting_dependency_resolver"
10
11
  module Functions
11
12
  def self.parsed_gemfile(**args)
12
13
  set_bundler_flags_and_credentials(dir: args.fetch(:dir), credentials: [])
13
- FileParser.new(lockfile_name: args.fetch(:lockfile_name)).
14
- parsed_gemfile(gemfile_name: args.fetch(:gemfile_name))
14
+ FileParser.new(lockfile_name: args.fetch(:lockfile_name))
15
+ .parsed_gemfile(gemfile_name: args.fetch(:gemfile_name))
15
16
  end
16
17
 
17
18
  def self.parsed_gemspec(**args)
18
19
  set_bundler_flags_and_credentials(dir: args.fetch(:dir), credentials: [])
19
- FileParser.new(lockfile_name: args.fetch(:lockfile_name)).
20
- parsed_gemspec(gemspec_name: args.fetch(:gemspec_name))
20
+ FileParser.new(lockfile_name: args.fetch(:lockfile_name))
21
+ .parsed_gemspec(gemspec_name: args.fetch(:gemspec_name))
21
22
  end
22
23
 
23
24
  def self.vendor_cache_dir(**args)
@@ -88,18 +89,18 @@ module Functions
88
89
  # Set flags and credentials
89
90
  set_bundler_flags_and_credentials(dir: args.fetch(:dir), credentials: args.fetch(:credentials))
90
91
 
91
- Bundler::Definition.build(args.fetch(:gemfile_name), nil, {}).
92
- send(:sources).
93
- rubygems_remotes.
94
- find { |uri| uri.host.include?("jfrog") }&.
95
- host
92
+ Bundler::Definition.build(args.fetch(:gemfile_name), nil, {})
93
+ .send(:sources)
94
+ .rubygems_remotes
95
+ .find { |uri| uri.host.include?("jfrog") }
96
+ &.host
96
97
  end
97
98
 
98
99
  def self.git_specs(**args)
99
100
  set_bundler_flags_and_credentials(dir: args.fetch(:dir), credentials: args.fetch(:credentials))
100
101
 
101
- git_specs = Bundler::Definition.build(args.fetch(:gemfile_name), nil, {}).dependencies.
102
- select do |spec|
102
+ git_specs = Bundler::Definition.build(args.fetch(:gemfile_name), nil, {}).dependencies
103
+ .select do |spec|
103
104
  spec.source.is_a?(Bundler::Source::Git)
104
105
  end
105
106
  git_specs.map do |spec|
@@ -157,12 +158,12 @@ module Functions
157
158
  end
158
159
 
159
160
  def self.private_registry_credentials(credentials)
160
- credentials.
161
- select { |cred| cred["type"] == "rubygems_server" }
161
+ credentials
162
+ .select { |cred| cred["type"] == "rubygems_server" }
162
163
  end
163
164
 
164
165
  def self.git_source_credentials(credentials)
165
- credentials.
166
- select { |cred| cred["type"] == "git_source" }
166
+ credentials
167
+ .select { |cred| cred["type"] == "git_source" }
167
168
  end
168
169
  end
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "bundler/definition"
@@ -7,8 +8,8 @@ require "bundler/definition"
7
8
  module BundlerDefinitionBundlerVersionPatch
8
9
  def expanded_dependencies
9
10
  @expanded_dependencies ||=
10
- expand_dependencies(dependencies + metadata_dependencies, @remote).
11
- reject { |d| d.name == "bundler" }
11
+ expand_dependencies(dependencies + metadata_dependencies, @remote)
12
+ .reject { |d| d.name == "bundler" }
12
13
  end
13
14
  end
14
15
 
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "bundler/definition"
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "bundler/vendor/fileutils/lib/fileutils"
@@ -10,9 +11,9 @@ module BundlerFileUtilsKeywordSplatPatch
10
11
  def entries
11
12
  opts = {}
12
13
  opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
13
- Dir.entries(path, **opts).
14
- reject { |n| n == "." || n == ".." }.
15
- map { |n| self.class.new(prefix, join(rel, n.untaint)) }
14
+ Dir.entries(path, **opts)
15
+ .reject { |n| n == "." || n == ".." }
16
+ .map { |n| self.class.new(prefix, join(rel, n.untaint)) }
16
17
  end
17
18
  end
18
19
 
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "bundler/source"
@@ -35,8 +36,8 @@ module Bundler
35
36
 
36
37
  def serialize_gemspecs_in(destination)
37
38
  original_load_paths = $LOAD_PATH.dup
38
- reduced_load_paths = original_load_paths.
39
- reject { |p| p.include?("/gems/") }
39
+ reduced_load_paths = original_load_paths
40
+ .reject { |p| p.include?("/gems/") }
40
41
 
41
42
  $LOAD_PATH.shift until $LOAD_PATH.empty?
42
43
  reduced_load_paths.each { |p| $LOAD_PATH << p }
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "bundler/resolver/spec_group"
data/helpers/v1/run.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  gem "bundler", "~> 1.17"
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "native_spec_helper"
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "native_spec_helper"
@@ -22,15 +23,15 @@ RSpec.describe Functions::DependencySource do
22
23
  end
23
24
 
24
25
  before do
25
- stub_request(:get, registry_url + "versions").
26
- with(basic_auth: ["SECRET_CODES", ""]).
27
- to_return(status: 404)
28
- stub_request(:get, registry_url + "api/v1/dependencies").
29
- with(basic_auth: ["SECRET_CODES", ""]).
30
- to_return(status: 200)
31
- stub_request(:get, gemfury_business_url).
32
- with(basic_auth: ["SECRET_CODES", ""]).
33
- to_return(status: 200, body: fixture("ruby", "gemfury_response"))
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"))
34
35
  end
35
36
 
36
37
  describe "#private_registry_versions" do
@@ -60,22 +61,22 @@ RSpec.describe Functions::DependencySource do
60
61
 
61
62
  context "that we don't have authentication details for" do
62
63
  before do
63
- stub_request(:get, registry_url + "versions").
64
- with(basic_auth: ["SECRET_CODES", ""]).
65
- to_return(status: 401)
66
- stub_request(:get, registry_url + "api/v1/dependencies").
67
- with(basic_auth: ["SECRET_CODES", ""]).
68
- to_return(status: 401)
69
- stub_request(:get, registry_url + "specs.4.8.gz").
70
- with(basic_auth: ["SECRET_CODES", ""]).
71
- to_return(status: 401)
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)
72
73
  end
73
74
 
74
75
  it "blows up with a useful error" do
75
76
  error_class = Bundler::Fetcher::AuthenticationRequiredError
76
77
  error_message = "Authentication is required for repo.fury.io"
77
- expect { private_registry_versions }.
78
- to raise_error do |error|
78
+ expect { private_registry_versions }
79
+ .to raise_error do |error|
79
80
  expect(error).to be_a(error_class)
80
81
  expect(error.message).to include(error_message)
81
82
  end
@@ -84,65 +85,65 @@ RSpec.describe Functions::DependencySource do
84
85
 
85
86
  context "that we have bad authentication details for" do
86
87
  before do
87
- stub_request(:get, registry_url + "versions").
88
- with(basic_auth: ["SECRET_CODES", ""]).
89
- to_return(status: 403)
90
- stub_request(:get, registry_url + "api/v1/dependencies").
91
- with(basic_auth: ["SECRET_CODES", ""]).
92
- to_return(status: 403)
93
- stub_request(:get, registry_url + "specs.4.8.gz").
94
- with(basic_auth: ["SECRET_CODES", ""]).
95
- to_return(status: 403)
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)
96
97
  end
97
98
 
98
99
  it "blows up with a useful error" do
99
100
  error_class = Bundler::Fetcher::BadAuthenticationError
100
- expect { private_registry_versions }.
101
- to raise_error do |error|
101
+ expect { private_registry_versions }
102
+ .to raise_error do |error|
102
103
  expect(error).to be_a(error_class)
103
- expect(error.message).
104
- to include("Bad username or password for")
104
+ expect(error.message)
105
+ .to include("Bad username or password for")
105
106
  end
106
107
  end
107
108
  end
108
109
 
109
110
  context "that bad-requested, but was a private repo" do
110
111
  before do
111
- stub_request(:get, registry_url + "versions").
112
- with(basic_auth: ["SECRET_CODES", ""]).
113
- to_return(status: 400)
114
- stub_request(:get, registry_url + "api/v1/dependencies").
115
- with(basic_auth: ["SECRET_CODES", ""]).
116
- to_return(status: 400)
117
- stub_request(:get, registry_url + "specs.4.8.gz").
118
- with(basic_auth: ["SECRET_CODES", ""]).
119
- to_return(status: 400)
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)
120
121
  end
121
122
 
122
123
  it "blows up with a useful error" do
123
- expect { private_registry_versions }.
124
- to raise_error do |error|
124
+ expect { private_registry_versions }
125
+ .to raise_error do |error|
125
126
  expect(error).to be_a(Bundler::HTTPError)
126
- expect(error.message).
127
- to include("Could not fetch specs from")
127
+ expect(error.message)
128
+ .to include("Could not fetch specs from")
128
129
  end
129
130
  end
130
131
  end
131
132
 
132
133
  context "that doesn't have details of the gem" do
133
134
  before do
134
- stub_request(:get, gemfury_business_url).
135
- with(basic_auth: ["SECRET_CODES", ""]).
136
- to_return(status: 404)
135
+ stub_request(:get, gemfury_business_url)
136
+ .with(basic_auth: ["SECRET_CODES", ""])
137
+ .to_return(status: 404)
137
138
 
138
139
  # Stub indexes to return details of other gems (but not this one)
139
- stub_request(:get, registry_url + "specs.4.8.gz").
140
- to_return(
140
+ stub_request(:get, registry_url + "specs.4.8.gz")
141
+ .to_return(
141
142
  status: 200,
142
143
  body: fixture("ruby", "contribsys_old_index_response")
143
144
  )
144
- stub_request(:get, registry_url + "prerelease_specs.4.8.gz").
145
- to_return(
145
+ stub_request(:get, registry_url + "prerelease_specs.4.8.gz")
146
+ .to_return(
146
147
  status: 200,
147
148
  body: fixture("ruby", "contribsys_old_index_prerelease_response")
148
149
  )
@@ -157,21 +158,21 @@ RSpec.describe Functions::DependencySource do
157
158
  let(:registry_url) { "https://gems.contribsys.com/" }
158
159
 
159
160
  before do
160
- stub_request(:get, registry_url + "versions").
161
- with(basic_auth: %w(username password)).
162
- to_return(status: 404)
163
- stub_request(:get, registry_url + "api/v1/dependencies").
164
- with(basic_auth: %w(username password)).
165
- to_return(status: 404)
166
- stub_request(:get, registry_url + "specs.4.8.gz").
167
- with(basic_auth: %w(username password)).
168
- to_return(
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(
169
170
  status: 200,
170
171
  body: fixture("ruby", "contribsys_old_index_response")
171
172
  )
172
- stub_request(:get, registry_url + "prerelease_specs.4.8.gz").
173
- with(basic_auth: %w(username password)).
174
- to_return(
173
+ stub_request(:get, registry_url + "prerelease_specs.4.8.gz")
174
+ .with(basic_auth: %w(username password))
175
+ .to_return(
175
176
  status: 200,
176
177
  body: fixture("ruby", "contribsys_old_index_prerelease_response")
177
178
  )
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "native_spec_helper"
@@ -1,3 +1,4 @@
1
+ # typed: false
1
2
  # frozen_string_literal: true
2
3
 
3
4
  require "native_spec_helper"