Skip to content

Commit

Permalink
Make permissions public
Browse files Browse the repository at this point in the history
  • Loading branch information
surminus committed Aug 14, 2023
1 parent 3e47f75 commit 607cf9e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion resources/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ type Directory struct {
// Delete removes the directory if set to true.
Delete bool

permissions
// Permissions manages permissions for the directory
Permissions
}

// Dir creates a new directory
Expand Down
3 changes: 2 additions & 1 deletion resources/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ type Download struct {
// NotIfExists will not download the file if it already exists
NotIfExists bool

permissions
// Permissions manages permissions for the downloaded content
Permissions
}

func Wget(url, path string) *Download {
Expand Down
3 changes: 2 additions & 1 deletion resources/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type File struct {
// Delete will delete the file rather than create it if set to true.
Delete bool

permissions
// Permissions manages permissions for the file
Permissions
}

// Touch simply touches an empty file to disk
Expand Down
3 changes: 2 additions & 1 deletion resources/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ type Git struct {
// Delete will remove the Git directory.
Delete bool

permissions
// Permissions manages permissions for the repository
Permissions
}

// Repo will add a new repository, and ensure that it stays up to date.
Expand Down
12 changes: 6 additions & 6 deletions resources/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/surminus/viaduct"
)

// permissions is a private struct to make it easy to include permission
// set functionality
type permissions struct {
// Permissions can be used with some resources to manage how they set
// permissions on files
type Permissions struct {
// Mode is the permissions set of the file
Mode os.FileMode
// User sets the user permissions by user name
Expand All @@ -39,7 +39,7 @@ const (
DefaultFilePermissions fs.FileMode = 0o644
)

func (p *permissions) preflightPermissions(t ptype) error {
func (p *Permissions) preflightPermissions(t ptype) error {
if p.Mode == 0 {
if t == pdir {
p.Mode = DefaultDirectoryPermissions
Expand Down Expand Up @@ -75,7 +75,7 @@ func (p *permissions) preflightPermissions(t ptype) error {
}

// Set permissions for a directory
func (p *permissions) setDirectoryPermissions(
func (p *Permissions) setDirectoryPermissions(
log *viaduct.Logger,
path string,
recursiveChown bool,
Expand Down Expand Up @@ -163,7 +163,7 @@ func (p *permissions) setDirectoryPermissions(
}

// Set permissions for a file
func (p *permissions) setFilePermissions(
func (p *Permissions) setFilePermissions(
log *viaduct.Logger,
path string,
) error {
Expand Down

0 comments on commit 607cf9e

Please sign in to comment.