Class: Dependabot::Bun::Utils

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dependabot/bun.rb

Class Method Summary collapse

Class Method Details

.extract_node_versions(error_message) ⇒ Object



137
138
139
140
141
142
143
144
145
# File 'lib/dependabot/bun.rb', line 137

def self.extract_node_versions(error_message)
  match_data = error_message.match(NODE_VERSION_NOT_SATISFY_REGEX)
  return {} unless match_data

  {
    current_version: match_data[:current_version],
    required_version: match_data[:required_version]
  }
end

.extract_var(error_message) ⇒ Object



148
149
150
151
152
153
# File 'lib/dependabot/bun.rb', line 148

def self.extract_var(error_message)
  match_data = T.must(error_message.match(ENV_VAR_NOT_RESOLVABLE)).named_captures["var"]
  return "" unless match_data

  match_data
end

.sanitize_resolvability_message(error_message, dependencies, yarn_lock) ⇒ Object



162
163
164
165
# File 'lib/dependabot/bun.rb', line 162

def self.sanitize_resolvability_message(error_message, dependencies, yarn_lock)
  dependency_names = dependencies.map(&:name).join(", ")
  "Error whilst updating #{dependency_names} in #{yarn_lock.path}:\n#{error_message}"
end