class NativePackageInstaller::Platform::MSYS2

Public Class Methods

current_platform?() click to toggle source
# File lib/native-package-installer/platform/msys2.rb, line 22
def current_platform?
  return false if package_prefix.nil?
  not pacman_path.nil?
end
package_prefix() click to toggle source
# File lib/native-package-installer/platform/msys2.rb, line 42
def package_prefix
  case RUBY_PLATFORM
  when "x86-mingw32"
    "mingw-w64-i686-"
  when "x64-mingw32"
    "mingw-w64-x86_64-"
  else
    nil
  end
end
pacman_path() click to toggle source
# File lib/native-package-installer/platform/msys2.rb, line 27
def pacman_path
  finder = ExecutableFinder.new("pacman")
  case RUBY_PLATFORM
  when "x86-mingw32"
    Dir.glob("c:/msys{64,32,*}/usr/bin") do |bin|
      finder.append_path(bin)
    end
  when "x64-mingw32"
    Dir.glob("c:/msys{64,*}/usr/bin") do |bin|
      finder.append_path(bin)
    end
  end
  finder.find
end

Public Instance Methods

install_command() click to toggle source
# File lib/native-package-installer/platform/msys2.rb, line 61
def install_command
  pacman_dir, pacman = File.split(self.class.pacman_path)
  ENV["PATH"] = [pacman_dir, ENV["PATH"]].join(File::PATH_SEPARATOR)
  "#{pacman} -S --noconfirm"
end
need_super_user_priviledge?() click to toggle source
# File lib/native-package-installer/platform/msys2.rb, line 67
def need_super_user_priviledge?
  false
end
package(spec) click to toggle source
# File lib/native-package-installer/platform/msys2.rb, line 54
def package(spec)
  base_name = spec[:msys2]
  return nil if base_name.nil?

  "#{self.class.package_prefix}#{base_name}"
end