Class: Moku::Task::BuildPermissions::Permissions

Inherits:
Object
  • Object
show all
Defined in:
lib/moku/task/build_permissions.rb

Overview

A set of permissions that can be applied to a directory and its descendants.

We assume that you # will want to allow other users to read and write to the files after the fact. This is enabled via enabling group read/write/execute; system administrators then need only to add the real user to the application user's group. Finally, we set both the setuid and setgid bits to ensure that users' actions never result in files that fall outside of this paradigm.

Instance Method Summary collapse

Constructor Details

#initialize(bin:, dir:, file:) ⇒ Permissions

Returns a new instance of Permissions.


23
24
25
26
27
# File 'lib/moku/task/build_permissions.rb', line 23

def initialize(bin:, dir:, file:)
  @bin = bin
  @dir = dir
  @file = file
end

Instance Method Details

#apply(base_dir) ⇒ Object

Parameters:

  • base_dir (Pathname)

30
31
32
33
34
35
# File 'lib/moku/task/build_permissions.rb', line 30

def apply(base_dir)
  FileUtils.mkdir_p base_dir
  Find.find(base_dir).map {|f| Pathname.new(f) }.each do |path|
    FileUtils.chmod(mode(path), path)
  end
end