Skip to content

Commit

Permalink
📝
Browse files Browse the repository at this point in the history
  • Loading branch information
volllly committed Jun 29, 2022
1 parent 32b1d01 commit ae4aded
Showing 1 changed file with 5 additions and 183 deletions.
188 changes: 5 additions & 183 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,196 +58,18 @@ To use another format install Rotz using one of the following comands:

If you already have a `dotfiles` repo you can clone it with the `rotz clone` command.

To bootstrap your dev environment use `rotz install`. *`[in development]`*
```sh
rotz clone git@github.com:<user>/<repo>.git
```

To bootstrap your dev environment use `rotz install`.

To link your `dotfiles` use `rotz link`.

---
## Usage

Run `rotz --help` to see all commands Rotz has.

## Configuration

Rotz uses a git repo containing the`dotfiles` and [`yaml`](https://yaml.org/) files for configuration.

> ***Note:** To use another file format see [Other File Formats](#other-file-formats).*

This git repo should be located at `~/.dotfiles`. Different paths can be specified using the `--dotfiles` cli flag or in the Rotz [config file](#configyaml).

> ***Note:** The location of the config file can be overridden using the `--config` cli flag. To get the default location of the config run `rotz --help`*

Each managed application has a subfolder containing its `dotfiles` and a `dot.yaml` file.

> ***Example:***
> ```
> └── vscode
> ├── dot.yaml
> ├── keybindings.json
> └── settings.json
> ```

The file `dot.yaml` contains information about how to install the application and where to link the dotfiles.

## `config.yaml`

The following settings are configurable in the config file like so:

```yaml
dotfiles: <path to dotfiles>
link_type: <"symbolic"|"hard">
repo: <git repo url>
```

Those settings can be overridden in the cli when applicable (see `rotz --help` and `rotz <command> --help` to get more information).

## `dot.yaml`

The `dot.yaml` file consists of four optional keys:

| key | requirement | function |
|------------|-------------|-------------------------------------------------------|
| `links` | `optional` | Defines where to link which `dotfile` |
| `installs` | `optional` | Defines the install command and install dependencies. |
| `depends` | `optional` | Defines dependencies this application needs to work. |

### `links`

The `links` section specifies where the dotfiles should be linked.

It consists of multiple `key: value` pairs where the `key` is the filename of the `dotfile` and the `value` is the link path.

> ***Example:***
>
> *`vscode/dot.yaml`*
> ```yaml
> ...
> links:
> keybindings.json: ~\AppData\Roaming\Code\User\keybindings.json
> settings.json: ~\AppData\Roaming\Code\User\settings.json
> ```

### `installs`

The `installs` section contains the install command and optional install dependencies.

It can either be a `string` containing the install command or have two sub keys.

| key | requirement | function |
|-----------|-------------|------------------------------------|
| `cmd` | `required` | Contains the install command. |
| `depends` | `optional` | Contains an array of dependencies. |

> ***Examples:***
>
> *`nodejs/dot.yaml`*
> ```yaml
> ...
> installs:
> cmd: scoop install nodejs
> depends: [scoop]
> ```
> *`scoop/dot.yaml`*
>
> ```yaml
> ...
> installs: iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
> ```

### depends

The `depends` section contains an array of dependencies needed for the application to work correctly.

These dependencies will also be installed when the application is installed.

> ***Example:***
>
> *`zsh/dot.yaml`*
> ```yaml
> ...
> depends: [starship]
> ```

## Defaults

The repo can also contain a default file `dots.yaml` in the root folder of the repo.

This file contains defaults which are automatically used for empty keys in the `dot.yaml` files.

You can use template strings (`{{ name }}`) to substitute the name of the application (the name of the folder the `dot.yaml` file is located in).

> ***Example:***
>
> *`dots.yaml`*
> ```yaml
> installs:
> cmd: scoop install {{ name }}
> depends:
> - scoop
> - extras
> ```

## OS Specific Configuration

You can specify different behaviors per OS in all configuration files.

Rotz can differentiate between Windows, Linux and MacOS.

To specify OS Specific behavior you need to add top level keys named `linux`, `windows`, `darwin` (for MacOS) and `general` (applied to all OSs).

> ***Examples:***
>
> *`dots.yaml`*
> ```yaml
> windows:
> installs:
> cmd: scoop install {{ name }}
> depends:
> - scoop
> - extras
> darwin:
> installs:
> cmd: brew install {{ name }}
> depends:
> - brew
> ```
> *`neovim/dot.yaml`*
> ```yaml
> windows:
> links:
> ginit.vim: ~\AppData\Local\nvim\ginit.vim
> init.vim: ~\AppData\Local\nvim\init.vim
>
> global:
> links:
> ginit.vim: ~/.config/nvim/init.vim
> init.vim: ~/.config/nvim/ginit.vim
> ```

You can also combine multiple OSs per key separating them with a `|`.

> ***Example:***
>
> *`dots.yaml`*
> ```yaml
> windows:
> installs:
> cmd: scoop install {{ name }}
> depends:
> - scoop
> - extras
> darwin|linux:
> installs:
> cmd: brew install {{ name }}
> depends:
> - brew
> ```


## Example Repository

You can see all of this functionality used in my [own dotfiles repository](https://github.com/volllly/.dotfiles).

## Contribute

Feel free to create pull requests and issues for bugs, features or questions.

0 comments on commit ae4aded

Please sign in to comment.