Module: Cask::Staged Private

Extended by:
T::Helpers
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

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) ⇒ 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:



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