Class: Dependabot::UpdateCheckers::Elm::ElmPackage::CliParser

Inherits:
Object
  • Object
show all
Defined in:
lib/dependabot/update_checkers/elm/elm_package/cli_parser.rb

Constant Summary collapse

INSTALL_DEPENDENCY_REGEX =
%r{([^\s]+\/[^\s]+)\s+(\d+\.\d+\.\d+)}.freeze
UPGRADE_DEPENDENCY_REGEX =
%r{([^\s]+\/[^\s]+) \(\d+\.\d+\.\d+ => (\d+\.\d+\.\d+)\)}.freeze

Class Method Summary collapse

Class Method Details

.decode_install_preview(text) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dependabot/update_checkers/elm/elm_package/cli_parser.rb', line 16

def self.decode_install_preview(text)
  installs = {}

  # Parse new installs
  text.scan(INSTALL_DEPENDENCY_REGEX).
    each { |n, v| installs[n] = Utils::Elm::Version.new(v) }

  # Parse upgrades
  text.scan(UPGRADE_DEPENDENCY_REGEX).
    each { |n, v| installs[n] = Utils::Elm::Version.new(v) }

  installs
end