'\" t
.\" Title: wright
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1
.\" Date: 06/03/2015
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "WRIGHT" "1" "06/03/2015" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
wright \- lightweight config management utility
.SH "SYNOPSIS"
.sp
\fBwright\fR [\fIOPTIONS\fR] \fIFILE\fR [\fIARGUMENT\fR\&...]
.sp
\fBwright\fR [\fIOPTIONS\fR] \fB\-e\fR \fICOMMAND\fR [\fIARGUMENT\fR\&...]
.SH "DESCRIPTION"
.sp
wright is a lightweight configuration management utility\&. It can be used to perform common sysadmin tasks such as installing packages, creating files, setting up groups and users and so on by running short Ruby scripts\&.
.sp
Although wright is typically used to run script files, it can also execute short code snippets passed on the command line\&. Another way to run wright scripts is to make your script executable and use wright as the interpreter by setting an appropriate "#!" line\&.
.SH "OPTIONS"
.PP
\fB\-e\fR \fICOMMAND\fR
.RS 4
Run
\fICOMMAND\fR
as a wright script\&. When multiple commands are passed, they are joined and run in sequence\&.
.RE
.PP
\fB\-r\fR \fILIBRARY\fR
.RS 4
Require
\fILIBRARY\fR
before running the wright script\&. When multiple libraries are passed, they are loaded in sequence\&.
.RE
.PP
\fB\-n, \-\-dry\-run\fR
.RS 4
Enable dry\-run mode\&. In dry\-run mode, wright resources do not modify the system, but you still have to make sure your own code does not cause any unwanted changes\&.
.RE
.PP
\fB\-v, \-\-verbose\fR
.RS 4
Print debugging information\&.
.RE
.PP
\fB\-q, \-\-quiet\fR
.RS 4
Suppress non\-error output\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print wright version\&.
.RE
.SH "EXAMPLES"
.sp
Install tmux via the system package manager:
.sp
.if n \{\
.RS 4
.\}
.nf
wright \-e \*(Aqpackage "tmux"\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
Create a system user named "foobard":
.sp
.if n \{\
.RS 4
.\}
.nf
wright \-e \*(Aquser("foobard") { |u| u\&.system = true }\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
Create a system group named "foobard":
.sp
.if n \{\
.RS 4
.\}
.nf
wright \-e \*(Aqgroup("foobard") { |u| u\&.system = true }\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
Create a file named \fI/etc/issue\fR containing the current wright version:
.sp
.if n \{\
.RS 4
.\}
.nf
wright \-e \*(Aqfile("/etc/issue") { |f| f\&.content = Wright::VERSION }\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
Create a directory named \fI/tmp/foo/bar/baz\fR:
.sp
.if n \{\
.RS 4
.\}
.nf
wright \-e \*(Aqdirectory "/tmp/foo/bar/baz"\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
Create a symlink from \fI\&.bash_profile\fR to \fI\&.profile\fR in the current user\(cqs home directory:
.sp
.if n \{\
.RS 4
.\}
.nf
wright \-e \*(Aqsymlink("~/\&.bash_profile") { |s| s\&.to = "~/\&.profile" }\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
To install tmux and update its config file from a wright script, create the following file:
.sp
.if n \{\
.RS 4
.\}
.nf
package \*(Aqtmux\*(Aq
file \*(Aq/etc/tmux\&.conf\*(Aq do |f|
f\&.content = < { puts \*(AqUpdated /etc/tmux\&.conf\*(Aq }
end
.fi
.if n \{\
.RE
.\}
.sp
When saved as \fIinstall\-tmux\&.rb\fR, the script can then be run via
.sp
.if n \{\
.RS 4
.\}
.nf
wright \-\-quiet install\-tmux\&.rb
.fi
.if n \{\
.RE
.\}
.sp
wright can also be used as an interpreter\&. The example below creates and runs a standalone wright script:
.sp
.if n \{\
.RS 4
.\}
.nf
cat < create\-dir\&.rb
#!/usr/bin/env wright
directory \*(Aq/tmp/foo/bar/baz\*(Aq
EOF
chmod +x create\-dir\&.rb
\&./create\-dir\&.rb
.fi
.if n \{\
.RE
.\}
.SH "AUTHOR"
.sp
Sebastian Boehm
.SH "COPYING"
.sp
Copyright (C) 2012\-2015 Sebastian Boehm\&. Free use of this software is granted under the terms of the MIT License (also known as the "Expat License")\&.