devenvious 0.1.0

Apply & update git-based devenv templates
version: '3'

vars:
  TMP: /tmp
  TEST_DROP_SHA: f7f92c8df8c4d9cdbcb6d8e6c3f86f268492eff2

tasks:
  default: task --list-all

  build: cargo b
  dev: bacon 
  
  test:init-empty:
    deps: ["build"]
    dir: '{{ .TMP }}/devenvious-test_empty'
    cmds:
      - rm -rf {.*,*.*}
      - 'direnv deny 2>&1 >/dev/null || true' # to not enable direnv it if the following fails:
      - cmd: 'echo; {{ .ROOT_DIR }}/target/debug/devenvious init {{ .CLI_ARGS }} && direnv allow'
        ignore_error: true
      - 'exec fish'

  test:init-existing:
    deps: ["build"]
    dir: '{{ .TMP }}/devenvious-test_existing'
    cmds:
      - rm -rf {.*,*.*}
      - rsync -a {{ .ROOT_DIR }}/test/_basic-base/ ./
      - mv .test-git .git # https://stackoverflow.com/a/57393586
      - 'direnv deny 2>&1 >/dev/null || true' # to not enable direnv it if the following fails:
      - cmd: 'echo; {{ .ROOT_DIR }}/target/debug/devenvious init {{ .CLI_ARGS }}' # && direnv allow'
        ignore_error: true
      - 'exec fish'

  _test:setup_update:
    deps: ["build"]
    internal: true
    dir: '{{ .TMP }}/devenvious-test_update'
    cmds:
      - rm -rf {.*,*.*}
      - 'direnv deny 2>&1 >/dev/null || true' # to not enable direnv it if the folgalowing fails:
      - '{{ .ROOT_DIR }}/target/debug/devenvious init {{ .INIT_ARGS }}'
      # - nix develop --impure -c echo && git add flake.lock && git commit -m 'flake.lock'
      # - git log #| head -30
  test:update:
    deps: ["_test:setup_update"]
    dir: '{{ .TMP }}/devenvious-test_update'
    cmds:
      - task: _test:setup_update
        vars:
          INIT_ARGS: -b test-old
      - cmd: 'echo; {{ .ROOT_DIR }}/target/debug/devenvious update {{ .CLI_ARGS }} && direnv allow'
        ignore_error: true
      - 'exec fish'
  test:update-dirty:
    deps: ["build"]
    dir: '{{ .TMP }}/devenvious-test_update'
    cmds:
      - task: _test:setup_update
        vars:
          INIT_ARGS: -b test-old2 -s
      - echo dirty > dirty-file.txt
      # - sd '24.05' '23.11' flake.nix
      - '{{ .ROOT_DIR }}/target/debug/devenvious update {{ .CLI_ARGS }}'
      - 'exec fish'
  test:update-squashed:
    deps: ["_test:setup_update"]
    dir: '{{ .TMP }}/devenvious-test_update'
    cmds:
      - task: _test:setup_update
        vars:
          INIT_ARGS: -b test-old2 -s
      - cmd: '{{ .ROOT_DIR }}/target/debug/devenvious update {{ .CLI_ARGS }} && direnv allow'
        ignore_error: true
      - 'exec fish'
  test:update-squashed-conflict:
    deps: ["_test:setup_update"]
    dir: '{{ .TMP }}/devenvious-test_update'
    cmds:
      - task: _test:setup_update
        vars:
          INIT_ARGS: -b test-old -s
      - sd '2.3.0' '2.3.4' .envrc && git add .envrc && git commit -m 'patchversion envrc'
      - cmd: 'echo; {{ .ROOT_DIR }}/target/debug/devenvious update {{ .CLI_ARGS }} && direnv allow'
        ignore_error: true
      - 'exec fish'