2014-03-20 22:33:37 -04:00
|
|
|
Dotbot
|
|
|
|
======
|
|
|
|
|
|
|
|
Dotbot is a tool that bootstraps your dotfiles (it's a [Dot]files
|
|
|
|
[bo]o[t]strapper, get it?). It does *less* than you think, because version
|
|
|
|
control systems do more than you think.
|
|
|
|
|
|
|
|
Dotbot is designed to be lightweight and self-contained, with no external
|
2015-04-26 19:52:24 -04:00
|
|
|
dependencies and no installation required. Dotbot can also be a drop-in
|
|
|
|
replacement for any other tool you were using to manage your dotfiles, and
|
|
|
|
Dotbot is VCS-agnostic -- it doesn't make any attempt to manage your dotfiles.
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
If you want an in-depth tutorial about organizing your dotfiles, see this [blog
|
|
|
|
post][managing-dotfiles-post].
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
Get Running in 5 Minutes
|
2015-05-04 11:33:16 -04:00
|
|
|
------------------------
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
### Starting Fresh?
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
Great! Just run the following command and start adding your customizations. If
|
|
|
|
you're looking for [some inpiration][inspiration], we've got you covered.
|
2014-08-19 00:07:24 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
```bash
|
2015-05-22 13:33:10 -04:00
|
|
|
git clone git@github.com:anishathalye/dotfiles_template dotfiles
|
2015-04-26 19:52:24 -04:00
|
|
|
```
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
### Integrate with Existing Dotfiles
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
The following will help you get set up using Dotbot in just a few steps.
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-05-22 13:33:10 -04:00
|
|
|
If you're using Git, you can add Dotbot as a submodule:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
# replace with the path to your dotfiles
|
|
|
|
cd ~/.dotfiles
|
|
|
|
git submodule add https://github.com/anishathalye/dotbot
|
|
|
|
cp dotbot/tools/git-submodule/install .
|
|
|
|
touch install.conf.yaml
|
|
|
|
```
|
|
|
|
|
|
|
|
If you're using Mercurial, you can add Dotbot as a subrepo:
|
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
```bash
|
2015-05-22 13:33:10 -04:00
|
|
|
# replace with the path to your dotfiles
|
|
|
|
echo "dotbot = [git]https://github.com/anishathalye/dotbot" > .hgsub
|
|
|
|
hg add .hgsub
|
|
|
|
git clone https://github.com/anishathalye/dotbot
|
|
|
|
cp dotbot/tools/hg-subrepo/install .
|
|
|
|
touch install.conf.yaml
|
2015-04-26 19:52:24 -04:00
|
|
|
```
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-05-22 13:33:10 -04:00
|
|
|
To get started, you just need to fill in the `install.conf.yaml` and Dotbot
|
|
|
|
will take care of the rest. To help you get started we have [an
|
2015-04-26 19:52:24 -04:00
|
|
|
example](#full-example) config file as well as [configuration
|
|
|
|
documentation](#configuration) for the accepted parameters.
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
Note: The `install` script is merely a shim that checks out the appropriate
|
|
|
|
version of Dotbot and calls the full Dotbot installer. By default, the script
|
|
|
|
assumes that the configuration is located in `install.conf.yaml` the Dotbot
|
|
|
|
submodule is located in `dotbot`. You can change either of these parameters by
|
|
|
|
editing the variables in the `install` script appropiately.
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-06-03 01:46:39 -04:00
|
|
|
Setting up Dotbot as a submodule or subrepo locks it on the current version.
|
|
|
|
You can upgrade Dotbot at any point. If using a submodule, run `git submodule
|
|
|
|
update --remote dotbot`, substituting `dotbot` with the path to the Dotbot
|
|
|
|
submodule. If using a subrepo, run `git fetch && git checkout origin/master` in
|
|
|
|
the Dotbot directory.
|
2014-10-22 11:10:49 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
### Full Example
|
|
|
|
|
|
|
|
Here's an example of a complete configuration.
|
|
|
|
|
|
|
|
The conventional name for the configuration file is `install.conf.yaml`.
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- clean: ['~']
|
|
|
|
|
|
|
|
- link:
|
|
|
|
~/.dotfiles: ''
|
|
|
|
~/.tmux.conf: tmux.conf
|
|
|
|
~/.vim: vim/
|
|
|
|
~/.vimrc: vimrc
|
|
|
|
|
|
|
|
- shell:
|
|
|
|
- [git submodule update --init --recursive, Installing submodules]
|
2014-10-22 11:10:49 -04:00
|
|
|
```
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
The configuration file can also be written in JSON. Here is the JSON equivalent
|
|
|
|
of the YAML configuration given above.
|
|
|
|
|
|
|
|
The conventional name for this file is `install.conf.json`.
|
2015-02-12 21:56:38 -05:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"clean": ["~"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"link": {
|
|
|
|
"~/.dotfiles": "",
|
|
|
|
"~/.tmux.conf": "tmux.conf",
|
|
|
|
"~/.vim": "vim/",
|
|
|
|
"~/.vimrc": "vimrc"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"shell": [
|
|
|
|
["git submodule update --init --recursive", "Installing submodules"]
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
2015-02-12 21:56:38 -05:00
|
|
|
```
|
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
## Configuration
|
|
|
|
|
|
|
|
Dotbot uses YAML or JSON formatted configuration files to let you specify how to
|
|
|
|
set up your dotfiles. Currently, Dotbot knows how to [link](#link) files and
|
|
|
|
folders, execute [shell](#shell) commands, and [clean](#clean) directories of
|
|
|
|
broken symbolic links.
|
2014-03-20 22:33:37 -04:00
|
|
|
|
|
|
|
**Ideally, bootstrap configurations should be idempotent. That is, the
|
|
|
|
installer should be able to be run multiple times without causing any
|
2014-10-22 11:10:49 -04:00
|
|
|
problems.** This makes a lot of things easier to do (in particular, syncing
|
|
|
|
updates between machines becomes really easy).
|
2014-03-20 22:33:37 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
Dotbot configuration files are arrays of tasks, where each task
|
2014-10-27 20:04:00 -04:00
|
|
|
is a dictionary that contains a command name mapping to data for that command.
|
|
|
|
Tasks are run in the order in which they are specified. Commands within a task
|
|
|
|
do not have a defined ordering.
|
2014-10-22 11:10:49 -04:00
|
|
|
|
2015-03-26 22:41:49 -04:00
|
|
|
When writing nested constructs, keep in mind that YAML is whitespace-sensitive.
|
|
|
|
Following the formatting used in the examples is a good idea.
|
|
|
|
|
2014-10-22 11:10:49 -04:00
|
|
|
### Link
|
|
|
|
|
|
|
|
Link commands specify how files and directories should be symbolically linked.
|
2014-10-22 13:27:34 -04:00
|
|
|
If desired, items can be specified to be forcibly linked, overwriting existing
|
2015-05-12 20:04:42 -04:00
|
|
|
files if necessary. Environment variables in paths are automatically expanded.
|
2014-10-22 11:10:49 -04:00
|
|
|
|
|
|
|
#### Format
|
|
|
|
|
|
|
|
Link commands are specified as a dictionary mapping targets to source
|
|
|
|
locations. Source locations are specified relative to the base directory (that
|
|
|
|
is specified when running the installer). Source directory names should contain
|
|
|
|
a trailing "/" character.
|
|
|
|
|
2014-10-22 13:27:34 -04:00
|
|
|
Link commands support an (optional) extended configuration. In this type of
|
|
|
|
configuration, instead of specifying source locations directly, targets are
|
2015-04-26 19:52:24 -04:00
|
|
|
mapped to extended configuration dictionaries. These dictionaries map `path` to
|
|
|
|
the source path, specify `create` as `true` if the parent directory should be
|
2015-05-02 22:27:05 -04:00
|
|
|
created if necessary, specify `relink` as `true` if incorrect symbolic links
|
|
|
|
should be automatically overwritten, and specify `force` as `true` if the file
|
|
|
|
or directory should be forcibly linked.
|
2014-10-22 13:27:34 -04:00
|
|
|
|
2015-02-10 18:33:37 -05:00
|
|
|
#### Example
|
2014-10-27 20:04:00 -04:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
- link:
|
|
|
|
~/.config/terminator:
|
|
|
|
create: true
|
|
|
|
path: config/terminator/
|
|
|
|
~/.vim: vim/
|
2015-05-02 22:27:05 -04:00
|
|
|
~/.vimrc:
|
|
|
|
relink: true
|
|
|
|
path: vimrc
|
2014-10-27 20:04:00 -04:00
|
|
|
~/.zshrc:
|
|
|
|
force: true
|
|
|
|
path: zshrc
|
|
|
|
```
|
|
|
|
|
2014-10-22 11:10:49 -04:00
|
|
|
### Shell
|
|
|
|
|
|
|
|
Shell commands specify shell commands to be run. Shell commands are run in the
|
|
|
|
base directory (that is specified when running the installer).
|
|
|
|
|
|
|
|
#### Format
|
|
|
|
|
2015-02-03 11:53:05 -05:00
|
|
|
Shell commands can be specified in several different ways. The simplest way is
|
2015-04-26 19:52:24 -04:00
|
|
|
just to specify a command as a string containing the command to be run.
|
|
|
|
|
|
|
|
Another way is to specify a two element array where the first element is the
|
|
|
|
shell command and the second is an optional human-readable description.
|
|
|
|
|
|
|
|
Shell commands support an extended syntax as well, which provides more
|
|
|
|
fine-grained control. A command can be specified as a dictionary that contains
|
|
|
|
the command to be run, a description, and whether `stdin`, `stdout`, and
|
|
|
|
`stderr` are enabled. In this syntax, all keys are optional except for the
|
|
|
|
command itself.
|
2014-10-22 11:10:49 -04:00
|
|
|
|
2015-02-10 18:33:37 -05:00
|
|
|
#### Example
|
2014-10-27 20:04:00 -04:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
- shell:
|
2015-02-03 11:53:05 -05:00
|
|
|
- mkdir -p ~/src
|
2014-10-27 20:04:00 -04:00
|
|
|
- [mkdir -p ~/downloads, Creating downloads directory]
|
2015-02-03 11:53:05 -05:00
|
|
|
-
|
|
|
|
command: read var && echo Your variable is $var
|
|
|
|
stdin: true
|
|
|
|
stdout: true
|
|
|
|
-
|
|
|
|
command: read fail
|
|
|
|
stderr: true
|
2014-10-27 20:04:00 -04:00
|
|
|
```
|
|
|
|
|
2014-10-22 11:10:49 -04:00
|
|
|
### Clean
|
|
|
|
|
|
|
|
Clean commands specify directories that should be checked for dead symbolic
|
|
|
|
links. These dead links are removed automatically. Only dead links that point
|
|
|
|
to the dotfiles directory are removed.
|
|
|
|
|
|
|
|
#### Format
|
|
|
|
|
|
|
|
Clean commands are specified as an array of directories to be cleaned.
|
|
|
|
|
2015-02-10 18:33:37 -05:00
|
|
|
#### Example
|
2014-10-27 20:04:00 -04:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
- clean: ['~']
|
|
|
|
```
|
|
|
|
|
2014-12-20 00:55:17 -05:00
|
|
|
Contributing
|
|
|
|
------------
|
|
|
|
|
|
|
|
Do you have a feature request, bug report, or patch? Great! See
|
|
|
|
[CONTRIBUTING.md][contributing] for information on what you can do about that.
|
|
|
|
|
2014-03-21 00:48:42 -04:00
|
|
|
License
|
|
|
|
-------
|
|
|
|
|
2015-01-19 19:05:49 -05:00
|
|
|
Copyright (c) 2014-2015 Anish Athalye. Released under the MIT License. See
|
2014-07-22 23:01:54 -04:00
|
|
|
[LICENSE.md][license] for details.
|
2014-03-21 00:48:42 -04:00
|
|
|
|
2015-04-26 19:52:24 -04:00
|
|
|
[inspiration]: https://github.com/anishathalye/dotfiles_template#inspiration
|
2014-08-19 00:07:24 -04:00
|
|
|
[managing-dotfiles-post]: http://www.anishathalye.com/2014/08/03/managing-your-dotfiles/
|
2014-12-20 00:55:17 -05:00
|
|
|
[contributing]: CONTRIBUTING.md
|
|
|
|
[license]: LICENSE.md
|