comtrya / comtrya

Configuration Management for Localhost / dotfiles
https://comtrya.dev
MIT License
480 stars 45 forks source link

Bug: can't copy file from custom location #267

Open airtonix opened 1 year ago

airtonix commented 1 year ago

Description

if my dotfiles repo looks like


./
  manifests/
    linux/
      starship.yml
      asdf.yml
      zsh.yml
    windows/
      starship.yml
    macosx/
      starship.yml
      asdf.yml
  profiles/
    asdf/
      setup.bash
    xresources/
      Xresources.tpl
      Xresources.theme
      Xresources.xterm
      Xresources.xvrt
    zsh/
      zshrc
      zshenv
      zprofile
      parts/
      lib/
    ps/
      profile.ps1
      parts/
      lib/

and my manifests/linux/zsh.yml wants to copy a file from the profiles/zsh directory... it can't because:

---
where: os.name == "linux"

actions:
 - action: file.link
   source: profile/zsh/.zshrc
   target: ~/.zshrc

means: symlink manifests/linux/files/profile/zsh/.zshrc to ~/.zshrc

and

---
where: os.name == "linux"

actions:
 - action: file.link
   source: ../../profile/zsh/.zshrc
   target: ~/.zshrc

results in an error

 INFO execute:{manifest="manifest.git"}:{action=file.copy}: Action failed to get plan: Failed to get contents for FileCopy action: Failed because ~/Projects/Dotfiles/manifest/files/../../../profile/gitconfig was not found

I guess im'm only allowe to have a folder structure of :


./
  manifests/
    starship.yml
    asdf.yml
    zsh.yml
    files/
      tools/
        asdf/
          setup.bash
      profiles/
        xresources/
          Xresources.tpl
          Xresources.theme
          Xresources.xterm
          Xresources.xvrt
        zsh/
          zshrc
          zshenv
          zprofile
          parts/
          lib/
        ps/
          profile.ps1
          parts/
          lib/

Additional information Add more context which didn't fit in the fields above.

icepuma commented 1 year ago

I'm torn between declaring it a bug or missing functionality, as it is clearly a convention to be in files relative to the root dir of the manifest.

rawkode commented 1 year ago

This is a limitation at the moment because we need to improve Comtrya manifest detection from random YAML in the repo. It’s a huge pain point for me too.

Let me come up with a solution this week and I’ll share on the community call Thursday for quick feedback