Class: Dependabot::Elm::UpdateChecker::CliParser

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

Constant Summary collapse

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

Class Method Summary collapse

Class Method Details

.decode_install_preview(text) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dependabot/elm/update_checker/cli_parser.rb', line 14

def self.decode_install_preview(text)
  installs = {}

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

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

  installs
end