Class: RubyInstaller::Build::Components::PacmanUpdate

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_installer/build/components/02_pacman_update.rb

Constant Summary

Constants included from RubyInstaller::Build::Colors

RubyInstaller::Build::Colors::ColorMap, RubyInstaller::Build::Colors::ESC, RubyInstaller::Build::Colors::NND

Instance Attribute Summary

Attributes inherited from Base

#msys, #pacman_args, #task_index

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize, #puts, #run_verbose, #shell_escape, #shell_join

Methods included from RubyInstaller::Build::Colors

#colored, #disable_colors, #enable_colors

Constructor Details

This class inherits a constructor from RubyInstaller::Build::Components::Base

Class Method Details

.dependsObject



5
6
7
# File 'lib/ruby_installer/build/components/02_pacman_update.rb', line 5

def self.depends
  %w[msys2]
end

Instance Method Details

#descriptionObject



9
10
11
# File 'lib/ruby_installer/build/components/02_pacman_update.rb', line 9

def description
  "MSYS2 system update (optional)"
end

#execute(args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ruby_installer/build/components/02_pacman_update.rb', line 13

def execute(args)
  msys.with_msys_apps_enabled do
    puts "Remove catgets to avoid conflicts while update  ..."
    # See https://github.com/Alexpux/MSYS2-packages/issues/1141
    run_verbose("pacman", "-Rdd", "catgets", "libcatgets", "--noconfirm")

    puts "#{description} part 1  ..."
    # Update the package database and core system packages
    res = run_verbose("pacman", "-Syu", *pacman_args)
    puts "#{description} #{res ? green("succeeded") : red("failed")}"
    raise "pacman failed" unless res

    # Update the rest
    puts "#{description} part 2 ..."
    res = run_verbose("pacman", "-Su", *pacman_args)
    puts "#{description} #{res ? green("succeeded") : red("failed")}"
    raise "pacman failed" unless res
  end
end