Module: Cask::Staged Private

Includes:
Kernel
Included in:
DSL::Postflight, DSL::Preflight, DSL::UninstallPreflight
Defined in:
cask/staged.rb,
cask/staged.rbi

Overview

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Helper functions for staged casks.

Constant Summary collapse

Paths =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

T.type_alias { T.any(String, Pathname, T::Array[T.any(String, Pathname)]) }

Instance Method Summary collapse

Methods included from Kernel

#disk_usage_readable, #ensure_executable!, #ensure_formula_installed!, #exec_browser, #exec_editor, #ignore_interrupts, #interactive_shell, #number_readable, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #paths, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #quiet_system, #redact_secrets, #redirect_stdout, #require?, #safe_system, #tap_and_name_comparison, #truncate_text_to_approximate_size, #which, #which_all, #which_editor, #with_custom_locale, #with_env, #with_homebrew_path

Instance Method Details

#set_ownership(paths, user: T.must(User.current), group: "staff") ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

This method returns an undefined value.

Parameters:

  • paths (Paths)
  • user (String, User) (defaults to: T.must(User.current))
  • group (String) (defaults to: "staff")


24
25
26
27
28
29
30
31
# File 'cask/staged.rb', line 24

def set_ownership(paths, user: T.must(User.current), group: "staff")
  full_paths = remove_nonexistent(paths)
  return if full_paths.empty?

  ohai "Changing ownership of paths required by #{@cask} with sudo; the password may be necessary."
  @command.run!("/usr/sbin/chown", args: ["-R", "--", "#{user}:#{group}", *full_paths],
                                   sudo: true)
end

#set_permissions(paths, permissions_str) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



15
16
17
18
19
20
21
# File 'cask/staged.rb', line 15

def set_permissions(paths, permissions_str)
  full_paths = remove_nonexistent(paths)
  return if full_paths.empty?

  @command.run!("/bin/chmod", args: ["-R", "--", permissions_str, *full_paths],
                              sudo: false)
end