Module: Cask::Staged

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

Instance Method Summary collapse

Instance Method Details

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



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

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



7
8
9
10
11
12
13
# File 'brew/Library/Homebrew/cask/staged.rb', line 7

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