|
1 | 1 | [tools] |
2 | | -cargo-binstall = "latest" |
3 | | -"cargo:emmylua_check" = "latest" |
4 | | -"cargo:emmylua_ls" = "latest" |
5 | 2 | lua-language-server = "latest" |
| 3 | + |
| 4 | +[tasks.test] |
| 5 | +run = """ |
| 6 | +#!/usr/bin/env bash |
| 7 | +nvim --headless --noplugin -u tests/mininit.lua -c "lua require('plenary.test_harness').test_directory('tests/neo-tree/', {minimal_init='tests/mininit.lua',sequential=true})" |
| 8 | +""" |
| 9 | + |
| 10 | +[tasks.test-docker] |
| 11 | +run = [ |
| 12 | + "docker build -t neo-tree .", |
| 13 | + "docker run --rm neo-tree mise test" |
| 14 | +] |
| 15 | +hide = true # hide this task from the list |
| 16 | + |
| 17 | +[tasks.format] |
| 18 | +run = "stylua --glob '*.lua' --glob '!defaults.lua' ." |
| 19 | + |
| 20 | +[vars] |
| 21 | +deps_dir = '.dependencies/pack/vendor/start' |
| 22 | + |
| 23 | +[env] |
| 24 | +NEOTREE_LUARC = ".luarc.json" |
| 25 | + |
| 26 | +[tasks.update-dependencies] |
| 27 | +alias = 'deps' |
| 28 | +run = """ |
| 29 | +#!/usr/bin/env bash |
| 30 | +update() { |
| 31 | + local git_url="$1" |
| 32 | + local repo_name="$2" |
| 33 | +
|
| 34 | + mkdir -p "{{vars.deps_dir}}" |
| 35 | +
|
| 36 | + local target_dir="{{vars.deps_dir}}/$repo_name" |
| 37 | + if [ -d "$target_dir" ]; then |
| 38 | + echo "==> Directory '$target_dir' exists. Updating $repo_name..." |
| 39 | + git -C $target_dir fetch --tags -f |
| 40 | + git -C $target_dir pull |
| 41 | +
|
| 42 | + # Check the exit code of the subshell command |
| 43 | + if [ $? -ne 0 ]; then |
| 44 | + echo "Error: Failed to pull updates for '$repo_name'." >&2 |
| 45 | + return 1 |
| 46 | + fi |
| 47 | + echo "==> Successfully updated '$repo_name'." |
| 48 | +
|
| 49 | + else |
| 50 | + echo "==> Directory '$target_dir' not found. Cloning repository..." |
| 51 | + git clone "$git_url" "$target_dir" |
| 52 | +
|
| 53 | + if [ $? -ne 0 ]; then |
| 54 | + echo "Error: Failed to clone '$git_url'." >&2 |
| 55 | + return 1 |
| 56 | + fi |
| 57 | + echo "==> Successfully cloned '$repo_name'." |
| 58 | + fi |
| 59 | +} |
| 60 | +update https://github.com/3rd/image.nvim image.nvim |
| 61 | +update https://github.com/folke/snacks.nvim snacks.nvim |
| 62 | +update https://github.com/MunifTanjim/nui.nvim nui.nvim |
| 63 | +update https://github.com/nvim-tree/nvim-web-devicons nvim-web-devicons |
| 64 | +update https://github.com/nvim-lua/plenary.nvim plenary.nvim |
| 65 | +""" |
| 66 | + |
| 67 | +[tasks.luals-check] |
| 68 | +run = """ |
| 69 | +#!/usr/bin/env bash |
| 70 | +VIMRUNTIME_PATH=$(nvim --clean --headless --cmd 'lua io.write(vim.env.VIMRUNTIME)' --cmd 'quit') |
| 71 | +VIMRUNTIME="${VIMRUNTIME_PATH}" lua-language-server --configpath=$NEOTREE_LUARC --check=. |
| 72 | +""" |
| 73 | +depends = ['deps'] |
| 74 | + |
| 75 | +[tasks.emmylua-check] |
| 76 | +run = """ |
| 77 | +#!/usr/bin/env bash |
| 78 | +VIMRUNTIME_PATH=$(nvim --clean --headless --cmd 'lua io.write(vim.env.VIMRUNTIME)' --cmd 'quit') |
| 79 | +VIMRUNTIME="${VIMRUNTIME_PATH}" emmylua_check -c $NEOTREE_LUARC -i ".dependencies/**" -- . |
| 80 | +""" |
| 81 | +depends = ['deps'] |
| 82 | + |
| 83 | +[tasks.clean] |
| 84 | +run = [ |
| 85 | + "rm {{vars.deps_dir}} -rf" |
| 86 | +] |
0 commit comments