Module: Cask::Staged Private

Included in:
DSL::Postflight, DSL::Preflight, DSL::UninstallPreflight, Installer
Defined in:
Library/Homebrew/cask/staged.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper functions for staged casks.

Instance Method Summary collapse

Instance Method Details

#set_ownership(paths, user: User.current, group: "staff") ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


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

def set_ownership(paths, user: 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. You should avoid using this method if possible, as it may be removed or be changed in the future.


11
12
13
14
15
16
17
# File 'Library/Homebrew/cask/staged.rb', line 11

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