volllly / rotz

Fully cross platform dotfile manager and dev environment bootstrapper written in Rust.
https://volllly.github.io/rotz/
MIT License
353 stars 10 forks source link

Subdirectory {{ name }} includes path — creates issue for `defaults.yaml` in subdirectories #337

Open gwenwindflower opened 7 months ago

gwenwindflower commented 7 months ago

First off, fantastic package! My dotfiles are sooo much cleaner than when my old dotbot iteration, zero regrets on making the jump, thanks for your hard work on this 💗✨.

One thing I just encountered in trying to refactor from using a giant Brewfile to relying on Rotz for my brew installs: it seems that the {{ name }} of a subdirectory within a subdirectory includes the parent subdirectory. This makes it impossible (? or tricky at least) to use a defaults.yaml with a package manager to install using the suggested pattern:

# defaults.yaml
installs:
  cmd: brew install {{ name }}
  depends:
    - brew

For example, with the below setup (tools dir is in the root of my dotfiles), the above pattern attempts to do this brew install tools/yazi, brew install tools/atuin...etc.

tools
├── atuin
│   ├── atuin.toml
│   └── dot.yaml
├── dbt
│   └── dot.yaml
├── defaults.yaml
├── dust
│   └── dot.yaml
├── karabiner
│   ├── dot.yaml
│   └── karabiner.json
├── sunbeam
│   ├── dot.yaml
│   └── xn.py
└── yazi
    ├── Catppuccin-frappe.tmTheme
    ├── dot.yaml
    ├── keymap.toml
    ├── theme.toml
    └── yazi.toml

This is on MacOS Sonoma 14.4.1, Rotz version 0.10.0. Let me know if you need other details. Thanks again!

gwenwindflower commented 7 months ago

Secondary but related question that I couldn't determine from from the docs: if you have a dot that completely follows the default — for example, in my dotfiles asciicinema is just a brew install asciicinema -- should you have a dot.yaml in the asciicinema directory with installs: true or just a .gitkeep? Or would both work?

gwenwindflower commented 6 months ago

figured out the answer to the follow-up question via trial and error for anybody who has the same question: pattern that works for me on MacOS is that you do need a dot.yaml file, but you need installs: null or installs: (blank, equivalent) to have it fall back to the default.