Module: Cask::Staged Private

Extended by:
T::Helpers
Includes:
Utils::Output::Mixin
Included in:
DSL::Postflight, DSL::Preflight, DSL::UninstallPreflight
Defined in:
cask/staged.rb

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 Utils::Output::Mixin

#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled

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")


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

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` (which may request your password)..."
  @command.run!("/usr/sbin/chown", args: ["-R", "--", "#{user}:#{group}", *full_paths],
                                   sudo: true)
end

#set_permissions(paths, permissions_str) ⇒ 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:



17
18
19
20
21
22
23
# File 'cask/staged.rb', line 17

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