| 1 |
.Dd July 28, 2013 |
| 2 |
.Dt RCM 7 |
| 3 |
.Os |
| 4 |
.Sh NAME |
| 5 |
.Nm rcm |
| 6 |
.Nd dotfile management |
| 7 |
.Sh SYNOPSIS |
| 8 |
.Nm lsrc |
| 9 |
.Nm mkrc |
| 10 |
.Nm rcdn |
| 11 |
.Nm rcup |
| 12 |
.Sh DESCRIPTION |
| 13 |
The rcm suite of tools is for managing dotfiles directories. This is a |
| 14 |
directory containing all the |
| 15 |
.Li .*rc |
| 16 |
files in your home directory |
| 17 |
.Sm off |
| 18 |
.Po |
| 19 |
.Pa .zshrc , |
| 20 |
.Sm on |
| 21 |
.Pa .vimrc , |
| 22 |
and so on |
| 23 |
.Pc . |
| 24 |
These files have gone by many |
| 25 |
names in history, such as |
| 26 |
.Do |
| 27 |
rc files |
| 28 |
.Dc |
| 29 |
because they typically end in |
| 30 |
.Li rc |
| 31 |
or |
| 32 |
.Do |
| 33 |
dotfiles |
| 34 |
.Dc |
| 35 |
because they begin with a period. |
| 36 |
.Pp |
| 37 |
This suite is useful for committing your rc files to a central repository |
| 38 |
to share, but it also scales to a more complex situation such as |
| 39 |
multiple source directories shared between computers with some |
| 40 |
host-specific or task-specific files. |
| 41 |
.Pp |
| 42 |
This guide serves as a tutorial motivating the suite. For a list of |
| 43 |
quick reference documentation see the |
| 44 |
.Sx SEE ALSO |
| 45 |
section below. |
| 46 |
. |
| 47 |
.Sh QUICK START FOR EXISTING DOTFILES DIRECTORIES |
| 48 |
This section is for those who already have an existing dotfiles |
| 49 |
directory; this directory is |
| 50 |
.Pa ~/.dotfiles ; |
| 51 |
the directory only contains rc files; and these rc filenames do not |
| 52 |
begin with a period. See the caveats below if this is not you. |
| 53 |
.Bl -enum |
| 54 |
.It |
| 55 |
Dry run with |
| 56 |
.Xr lsrc 1 . |
| 57 |
Look for anything unexpected in here, such as |
| 58 |
.Pa ~/.install |
| 59 |
or |
| 60 |
.Pa ~/.Makefile , |
| 61 |
or an empty list of dotfiles. |
| 62 |
.Pp |
| 63 |
.Dl lsrc |
| 64 |
.It |
| 65 |
Update any symlinks with |
| 66 |
.Xr rcup 1 . |
| 67 |
This is likely to do nothing, since your dotfiles already exist. |
| 68 |
.Pp |
| 69 |
.Dl rcup -v |
| 70 |
.It |
| 71 |
When necessary, add new rc files to the dotfiles directory with |
| 72 |
.Xr mkrc 1 . |
| 73 |
.Pp |
| 74 |
.Dl mkrc ~/.tigrc |
| 75 |
.Pp |
| 76 |
In the other direction, you can use |
| 77 |
.Xr rcup 1 |
| 78 |
to create the symlinks from |
| 79 |
.Pa ~/.dotfiles |
| 80 |
to your home directory. |
| 81 |
.Pp |
| 82 |
.Dl rcup tigrc |
| 83 |
.El |
| 84 |
.Ss COMMON PROBLEM: EXISTING INSTALL SCRIPTS |
| 85 |
Many existing dotfile directories have scripts named |
| 86 |
.Pa install |
| 87 |
or |
| 88 |
.Pa Makefile |
| 89 |
in the directory. This will cause a |
| 90 |
.Pa ~/.install |
| 91 |
or |
| 92 |
.Pa ~/.Makefile |
| 93 |
symlink to be created in your home |
| 94 |
directory. Use an exclusion pattern to ignore these. |
| 95 |
.Pp |
| 96 |
.Dl rcup -x install -x Rakefile -x Makefile -x install.sh |
| 97 |
.Ss COMMON PROBLEM: DOTTED FILENAMES IN DOTFILES DIRECTORY |
| 98 |
A less common situation is for all the filenames in your dotfiles |
| 99 |
directory to be prefixed with a period. These files are skipped by the |
| 100 |
rcm suite, and thus would result in nothing happening. The only option |
| 101 |
in this case is to rename all the files, for example by using a shell |
| 102 |
command like the following. |
| 103 |
.Pp |
| 104 |
.Dl find ~/.dotfiles -name '.*' -exec echo mv {} `echo {} | sed 's/\.//'` \; |
| 105 |
.Pp |
| 106 |
Note that this will break any existing symlinks. Those can be safely |
| 107 |
removed using the |
| 108 |
.Xr rcdn 1 |
| 109 |
command. |
| 110 |
.Pp |
| 111 |
.Dl rcdn -v |
| 112 |
.Ss COMMON PROBLEM: DOTFILES DIRECTORY NOT IN Pa ~/.dotfiles |
| 113 |
This all assumes that your dotfiles directory is |
| 114 |
.Pa ~/.dotfiles . |
| 115 |
If it is elsewhere and you do not want to move it you can use the |
| 116 |
.Fl d Ar DIR |
| 117 |
option to |
| 118 |
.Xr rcup 1 |
| 119 |
or modify |
| 120 |
.Ev DOTFILES_DIRS |
| 121 |
in |
| 122 |
.Xr rcrc 5 . |
| 123 |
.Pp |
| 124 |
.Dl rcup -d configs -v |
| 125 |
. |
| 126 |
.Ss COMMON PROBLEM: CONFIGURATION FILES/DIRECTORIES WITHOUT DOTS |
| 127 |
By default, the rcm suite will prefix every file and directory it manages |
| 128 |
with a dot. If that is not desired, for example in the case of |
| 129 |
.Pa ~/bin |
| 130 |
or |
| 131 |
.Pa ~/texmf , |
| 132 |
you can add that file or directory to |
| 133 |
.Ev UNDOTTED |
| 134 |
in |
| 135 |
.Xr rcrc 5 |
| 136 |
or use the |
| 137 |
.Fl U |
| 138 |
option. For example: |
| 139 |
.Pp |
| 140 |
.Dl mkrc -U bin |
| 141 |
. |
| 142 |
.Sh QUICK START FOR EMPTY DOTFILES DIRECTORIES |
| 143 |
This section is for those who do not have an existing dotfiles |
| 144 |
directory and whose dotfiles are standard. |
| 145 |
.Bl -enum |
| 146 |
.It |
| 147 |
Add your rc files to a dotfiles directory with |
| 148 |
.Xr mkrc 1 . |
| 149 |
.Pp |
| 150 |
.Dl mkrc .zshrc .gitconfig .tigrc |
| 151 |
.It |
| 152 |
Synchronize your home directory with |
| 153 |
.Xr rcup 1 |
| 154 |
.Pp |
| 155 |
.Dl rcup -v |
| 156 |
.El |
| 157 |
.Pp |
| 158 |
This will give you a directory named |
| 159 |
.Pa ~/.dotfiles |
| 160 |
with your dotfiles in it. Your original dotfiles will be symlinks into |
| 161 |
this directory. For example, |
| 162 |
.Pa ~/.zshrc |
| 163 |
will be a symlink to |
| 164 |
.Pa ~/.dotfiles/zshrc . |
| 165 |
. |
| 166 |
.Sh TAGGED DOTFILES |
| 167 |
This suite becomes more powerful if you share your dotfiles directory |
| 168 |
between computers, either because multiple people share the same |
| 169 |
directory or because you have multiple computers. |
| 170 |
.Pp |
| 171 |
If you share the dotfiles directory between people, you may end up with |
| 172 |
some irrelevant or even incorrect rc files. For example, you may have a |
| 173 |
.Pa .zshrc |
| 174 |
while your other contributor has a |
| 175 |
.Pa .bashrc . |
| 176 |
This situation can be handled with tags. |
| 177 |
.Bl -enum |
| 178 |
.It |
| 179 |
A tag is a directory under the dotfiles directory that starts with the |
| 180 |
letters |
| 181 |
.Li tag- . |
| 182 |
We can handle the competing shell example by |
| 183 |
making a |
| 184 |
.Pa tag-zsh |
| 185 |
directory and moving the |
| 186 |
.Pa .zshrc |
| 187 |
file into it using |
| 188 |
.Xr mkrc 1 |
| 189 |
and passing the |
| 190 |
.Fl t |
| 191 |
option. |
| 192 |
.Pp |
| 193 |
.Dl mkrc -t zsh .zshrc |
| 194 |
.It |
| 195 |
When updating with |
| 196 |
.Xr rcup 1 |
| 197 |
you can pass the |
| 198 |
.Fl t |
| 199 |
option to |
| 200 |
include the tags you want. This can also be set in the |
| 201 |
.Xr rcrc 5 |
| 202 |
configuration file with the |
| 203 |
.Ev TAGS |
| 204 |
variable. |
| 205 |
.Pp |
| 206 |
.Dl rcup -t zsh |
| 207 |
.El |
| 208 |
. |
| 209 |
.Sh MULTIPLE DOTFILE DIRECTORIES |
| 210 |
Another common situation is combining multiple dotfiles directories that |
| 211 |
people have shared with you. For this we have the |
| 212 |
.Fl d |
| 213 |
flag or the |
| 214 |
.Ev DOTFILES_DIRS |
| 215 |
option in |
| 216 |
.Pa .rcrc . |
| 217 |
.Pp |
| 218 |
The following rcup invocation will go in sequence through the three dotfiles |
| 219 |
directories, updating any symlinks as needed. Any overlapping rc files |
| 220 |
will use the first result, not the last; that is, |
| 221 |
.Pa .dotfiles/vimrc |
| 222 |
will take precedence over |
| 223 |
.Pa marriage-dotfiles/vimrc . |
| 224 |
.Pp |
| 225 |
.Dl rcup -d .dotfiles -d marriage-dotfiles -d thoughtbot-dotfiles |
| 226 |
.Pp |
| 227 |
An exclusion pattern can be tied to a specific dotfiles directory. |
| 228 |
.Pp |
| 229 |
.Dl rcup -d .dotfiles -d work-dotfiles -x 'work-dotfiles:powrc' |
| 230 |
. |
| 231 |
.Sh HOST-SPECIFIC DOTFILES |
| 232 |
You can also mark host-specific files. This will go by the hostname. The |
| 233 |
.Xr rcrc 5 |
| 234 |
configuration |
| 235 |
file is a popular candidate for a host-specific file, since the tags and |
| 236 |
dotfile directories listed in there are often specific to a single |
| 237 |
machine. |
| 238 |
.Pp |
| 239 |
.Dl mkrc -o .rcrc |
| 240 |
.Pp |
| 241 |
If your hostname is difficult to compute, or you otherwise want to use a |
| 242 |
different hostname, you can use the |
| 243 |
.Fl B |
| 244 |
flag. |
| 245 |
.Pp |
| 246 |
.Dl mkrc -B eggplant .rcrc |
| 247 |
. |
| 248 |
.Sh STANDALONE INSTALLATION SCRIPT |
| 249 |
. |
| 250 |
The |
| 251 |
.Xr rcup 1 |
| 252 |
tool can be used to generate a portable shell script. |
| 253 |
Instead of running a command such as |
| 254 |
.Xr ln 1 |
| 255 |
or |
| 256 |
.Xr rm 1 , |
| 257 |
it will print the command to |
| 258 |
.Li stdout . |
| 259 |
This is controlled with the |
| 260 |
.Fl g |
| 261 |
flag. |
| 262 |
Note that this will generate a script to create an exact replica of the |
| 263 |
synchronization, including tags, host-specific files, and dotfiles directories. |
| 264 |
.Pp |
| 265 |
.Dl env RCRC=/dev/null rcup -B 0 -g > install.sh |
| 266 |
.Pp |
| 267 |
Using the above command, you can now run |
| 268 |
.Li install.sh |
| 269 |
to install (or re-install) your rc files. |
| 270 |
The |
| 271 |
.Li install.sh |
| 272 |
script can be stored in your dotfiles directory, copied between computers, and |
| 273 |
so on. |
| 274 |
. |
| 275 |
.Sh RATIONALE |
| 276 |
The rcm suite was built as an abstraction over the shell, Ruby, Python, and |
| 277 |
make scripts people were writing and sharing. It is intended to run on any unix |
| 278 |
system and support the range from simple to complex dotfile directories. |
| 279 |
.Pp |
| 280 |
As such, this suite is useful as a common base. Through this we can |
| 281 |
share tools and develop this further as a first-class entity. It is also |
| 282 |
our hope that a common set of tools will encourage others to share their |
| 283 |
dotfiles, too. |
| 284 |
.Sh FILES |
| 285 |
.Pa ~/.dotfiles |
| 286 |
.Pa ~/.rcrc |
| 287 |
.Sh SEE ALSO |
| 288 |
.Xr lsrc 1 , |
| 289 |
.Xr mkrc 1 , |
| 290 |
.Xr rcdn 1 , |
| 291 |
.Xr rcup 1 , |
| 292 |
.Xr rcrc 5 |
| 293 |
.Sh AUTHORS |
| 294 |
.Nm |
| 295 |
is maintained by |
| 296 |
.An "Mike Burns" Aq Mt [email protected] |
| 297 |
and |
| 298 |
.Lk http://thoughtbot.com thoughtbot |
| 299 |
.Sh CONTRIBUTORS |
| 300 |
.An -split |
| 301 |
{{#contributors}} |
| 302 |
.An "{{{name}}}" Aq Mt {{{email}}} |
| 303 |
{{/contributors}} |