The extend Wright::DSL line makes wright DSL methods such as
directory available, which are a shorthand for instantiating a
resource and performing its default action. If you do not want to use
the DSL, you can also use the underlying resources in the following
way.

This is especially handy, since you can name a resource so that you
can re-use it later in the update action of another resource.

Update actions

If you want to perform a specific action every time a resource
changes, you can use the on_update attribute. Since wright is just
Ruby, you can simply set on_update to a proc or a lambda (or
anything else that responds to call message, for that matter).

Dry-run mode

Since wright scripts are just Ruby, wright’s dry-run mode only affects
wright resources. If you want to make sure not to shoot yourself in
the foot, it’s probably a good idea to respect dry-run mode whenever
you manipulate your system’s state in your scripts using Ruby.

This script does not respect dry-run mode and will happily delete
/tmp/foo, even when run in dry-run mode:

#!/usr/bin/env wrightFile.delete('/tmp/foo')

In order to change this script so that it does not touch your system
in dry-run mode, you can use the Wright::dry_run? method.

#!/usr/bin/env wrightFile.delete('/tmp/foo')unlessWright.dry_run?

Of course, the best way to achieve dry-run awareness in this situation
would be to restrict yourself to using only wright’s built-in
resources, which all support dry-run mode out of the box.

#!/usr/bin/env wrightfile'/tmp/foo',action::remove

Distributing wright scripts

Looking for a way to package and distribute your wright scripts? Since
wright is just Ruby, you can simply use Ruby gems to package, version
and distribute your wright scripts. (Don’t forget to add wright as a
runtime dependency to your gemspec!)