Module: Cask::Staged Private

Extended by:
T::Sig
Included in:
DSL::Postflight, DSL::Preflight, DSL::UninstallPreflight, Installer
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

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


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

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}; your 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.



19
20
21
22
23
24
25
# File 'cask/staged.rb', line 19

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