Class: Dependabot::NpmAndYarn::UpdateChecker::RegistryFinder
- Inherits:
-
Object
- Object
- Dependabot::NpmAndYarn::UpdateChecker::RegistryFinder
- Defined in:
- lib/dependabot/npm_and_yarn/update_checker/registry_finder.rb
Constant Summary collapse
- CENTRAL_REGISTRIES =
%w( https://registry.npmjs.org http://registry.npmjs.org https://registry.yarnpkg.com ).freeze
- NPM_AUTH_TOKEN_REGEX =
%r{//(?<registry>.*)/:_authToken=(?<token>.*)$}.freeze
- NPM_GLOBAL_REGISTRY_REGEX =
/^registry\s*=\s*['"]?(?<registry>.*?)['"]?$/.freeze
- YARN_GLOBAL_REGISTRY_REGEX =
/^(?:--)?registry\s+['"](?<registry>.*)['"]/.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #auth_headers ⇒ Object
- #dependency_url ⇒ Object
-
#initialize(dependency:, credentials:, npmrc_file: nil, yarnrc_file: nil) ⇒ RegistryFinder
constructor
A new instance of RegistryFinder.
- #registry ⇒ Object
Constructor Details
#initialize(dependency:, credentials:, npmrc_file: nil, yarnrc_file: nil) ⇒ RegistryFinder
Returns a new instance of RegistryFinder.
23 24 25 26 27 28 29 |
# File 'lib/dependabot/npm_and_yarn/update_checker/registry_finder.rb', line 23 def initialize(dependency:, credentials:, npmrc_file: nil, yarnrc_file: nil) @dependency = dependency @credentials = credentials @npmrc_file = npmrc_file @yarnrc_file = yarnrc_file end |
Class Method Details
.central_registry?(registry) ⇒ Boolean
43 44 45 46 47 |
# File 'lib/dependabot/npm_and_yarn/update_checker/registry_finder.rb', line 43 def self.central_registry?(registry) CENTRAL_REGISTRIES.any? do |r| r.include?(registry) end end |
Instance Method Details
#auth_headers ⇒ Object
35 36 37 |
# File 'lib/dependabot/npm_and_yarn/update_checker/registry_finder.rb', line 35 def auth_headers auth_header_for(auth_token) end |
#dependency_url ⇒ Object
39 40 41 |
# File 'lib/dependabot/npm_and_yarn/update_checker/registry_finder.rb', line 39 def dependency_url "#{registry_url.gsub(%r{/+$}, '')}/#{escaped_dependency_name}" end |
#registry ⇒ Object
31 32 33 |
# File 'lib/dependabot/npm_and_yarn/update_checker/registry_finder.rb', line 31 def registry locked_registry || first_registry_with_dependency_details end |