Current section
Files
Jump to
Current section
Files
lib/reactor/file/dsl/chmod.ex
defmodule Reactor.File.Dsl.Chmod do
@moduledoc """
A `chown` DSL entity for the `Reactor.File` DSL extension.
"""
alias Reactor.{Dsl.Argument, Dsl.WaitFor, Template}
defstruct __identifier__: nil,
arguments: [],
description: nil,
mode: nil,
name: nil,
path: nil,
revert_on_undo?: false
@type t :: %__MODULE__{
__identifier__: any,
arguments: [Argument.t()],
description: nil | String.t(),
mode: Template.t(),
name: any,
path: Template.t(),
revert_on_undo?: boolean
}
@doc false
def __entity__,
do: %Spark.Dsl.Entity{
name: :chmod,
describe: """
Change the permissions of a file or directory.
Uses `File.chmod/2` behind the scenes.
""",
target: __MODULE__,
identifier: :name,
args: [:name],
recursive_as: :steps,
entities: [arguments: [WaitFor.__entity__()]],
imports: [Argument],
schema: [
name: [
type: :atom,
required: true,
doc:
"A unique name for the step. Used when choosing the return value of the Reactor and for arguments into other steps"
],
description: [
type: :string,
required: false,
doc: "An optional description for the step"
],
path: [
type: Template.type(),
required: true,
doc: "The path to the file or directory"
],
mode: [
type: Template.type(),
required: true,
doc: "The mode to set the file permissions to"
],
revert_on_undo?: [
type: :boolean,
required: false,
default: false,
doc: "Change the permissions back to the original value on undo?"
]
]
}
end