distributable:
  url: https://github.com/LunarVim/LunarVim/archive/{{ version }}.tar.gz
  strip-components: 1

versions:
  github: LunarVim/LunarVim

dependencies:
  gnu.org/bash: '*'
  crates.io/fd-find: '*'
  pip.pypa.io: '*'
  nodejs.org: '*'
  rust-lang.org/cargo: '*'
  neovim.io: '*'

build:
  dependencies:
    cmake.org: '*'
    gnu.org/bash: '*'
  script:
    - ./utils/installer/install.sh -y -l
    - ./utils/installer/install_bin.sh
    - ./utils/installer/install-neovim-from-release

    # {{prefix}}/share/lunarvim/lvim is a symlink to $SRCROOT
    - run: |
        rm lvim
        mkdir lvim
        cp -a "$SRCROOT"/* lvim/
      working-directory: ${{prefix}}/share/lunarvim
    - run: |
        sed -i.bak "s_{{prefix}}_\$(cd \$(dirname \$0)/.. \&\& pwd)_g" lvim
        rm lvim.bak
      working-directory: ${{prefix}}/bin
  env:
    INSTALL_PREFIX: '{{ prefix }}'
    LV_INSTALL_PREFIX: '{{ prefix }}'
    XDG_DATA_HOME: '{{ prefix }}/share'
    XDG_CACHE_HOME: '{{ prefix }}/.cache'
    XDG_CONFIG_HOME: '{{ prefix }}/.config'

provides:
  - bin/lvim
  - bin/nvim

test:
    lvim -v | grep "NVIM"