-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from QuantumVim/5-feat-move-qvim-to-the-state-…
…directory rework(#5): move qvim to rtp directory
- Loading branch information
Showing
8 changed files
with
99 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,52 @@ | ||
local a = require "plenary.async_lib.tests" | ||
local a = require("plenary.async_lib.tests") | ||
local uv = vim.loop | ||
local home_dir = uv.os_homedir() | ||
|
||
a.describe("initial start", function() | ||
local qvim_config_path = get_qvim_config_dir() | ||
local qvim_data_path = get_qvim_data_dir() | ||
local qvim_cache_path = get_qvim_cache_dir() | ||
local qvim_state_path = get_qvim_state_dir() | ||
local qvim_config_path = get_qvim_config_dir() | ||
local qvim_data_path = get_qvim_data_dir() | ||
local qvim_cache_path = get_qvim_cache_dir() | ||
local qvim_state_path = get_qvim_rtp_dir() | ||
|
||
a.it("NVIM_APPNAME variable should be set", function() | ||
assert.truthy(os.getenv("NVIM_APPNAME") ~= nil) | ||
end) | ||
a.it("NVIM_APPNAME variable should be set", function() | ||
assert.truthy(os.getenv("NVIM_APPNAME") ~= nil) | ||
end) | ||
|
||
a.it("should be able to use QuantumVim directories using vim.fn", function() | ||
assert.equal(qvim_config_path, vim.fn.stdpath("config")) | ||
assert.equal(qvim_data_path, vim.fn.stdpath("data")) | ||
assert.equal(qvim_cache_path, vim.fn.stdpath("cache")) | ||
assert.equal(qvim_state_path, vim.fn.stdpath("state")) | ||
end) | ||
a.it("should be able to use QuantumVim directories using vim.fn", function() | ||
assert.equal(qvim_config_path, vim.fn.stdpath("config")) | ||
assert.equal(qvim_data_path, vim.fn.stdpath("data")) | ||
assert.equal(qvim_cache_path, vim.fn.stdpath("cache")) | ||
assert.equal(qvim_state_path, vim.fn.stdpath("state")) | ||
end) | ||
|
||
a.it("should NOT be able to retrieve default neovim directories", function() | ||
local xdg_config = os.getenv "XDG_CONFIG_HOME" or join_paths(home_dir, ".config") | ||
assert.truthy(join_paths(xdg_config, "nvim") ~= vim.call("stdpath", "config")) | ||
end) | ||
a.it("should NOT be able to retrieve default neovim directories", function() | ||
local xdg_config = os.getenv("XDG_CONFIG_HOME") | ||
or join_paths(home_dir, ".config") | ||
assert.truthy( | ||
join_paths(xdg_config, "nvim") ~= vim.call("stdpath", "config") | ||
) | ||
end) | ||
|
||
a.it("should be able to read lazy directories from rtp", function() | ||
local rtp_list = vim.opt.rtp:get() | ||
assert.truthy(vim.tbl_contains(rtp_list, join_paths(get_lazy_rtp_dir(), "*"))) | ||
assert.truthy(vim.tbl_contains(rtp_list, get_lazy_rtp_dir() .. "/lazy.nvim")) | ||
end) | ||
a.it("should be able to read lazy directories from rtp", function() | ||
local rtp_list = vim.opt.rtp:get() | ||
assert.truthy( | ||
vim.tbl_contains(rtp_list, join_paths(get_lazy_rtp_dir(), "*")) | ||
) | ||
assert.truthy( | ||
vim.tbl_contains(rtp_list, get_lazy_rtp_dir() .. "/lazy.nvim") | ||
) | ||
end) | ||
|
||
a.it("should be able to run treesitter without errors", function() | ||
assert.truthy(vim.treesitter.highlighter.active) | ||
end) | ||
a.it("should be able to run treesitter without errors", function() | ||
assert.truthy(vim.treesitter.highlighter.active) | ||
end) | ||
|
||
a.it("should be able to pass basic checkhealth without errors", function() | ||
vim.cmd "set cmdheight&" | ||
vim.cmd "checkhealth nvim" | ||
local errmsg = vim.fn.eval "v:errmsg" | ||
local exception = vim.fn.eval "v:exception" | ||
assert.equal("", errmsg) -- v:errmsg was not updated. | ||
assert.equal("", exception) | ||
end) | ||
a.it("should be able to pass basic checkhealth without errors", function() | ||
vim.cmd("set cmdheight&") | ||
vim.cmd("checkhealth nvim") | ||
local errmsg = vim.fn.eval("v:errmsg") | ||
local exception = vim.fn.eval("v:exception") | ||
assert.equal("", errmsg) -- v:errmsg was not updated. | ||
assert.equal("", exception) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
export QUANTUMVIM_RTP_DIR="${QUANTUMVIM_RTP_DIR:-RTP_DIR_VAR}" | ||
export QUANTUMVIM_CONFIG_DIR="${QUANTUMVIM_CONFIG_DIR:-CONFIG_DIR_VAR}" | ||
export QUANTUMVIM_STATE_DIR="${QUANTUMVIM_CACHE_DIR:-DATA_DIR_VAR}" | ||
export QUANTUMVIM_DATA_DIR="${QUANTUMVIM_DATA_DIR:-STATE_DIR_VAR}" | ||
export QUANTUMVIM_DATA_DIR="${QUANTUMVIM_DATA_DIR:-DATA_DIR_VAR}" | ||
export QUANTUMVIM_CACHE_DIR="${QUANTUMVIM_CACHE_DIR:-CACHE_DIR_VAR}" | ||
export NVIM_APPNAME="${NVIM_APPNAME:-APPNAME_VAR}" | ||
|
||
exec -a qvim nvim -u "$QUANTUMVIM_CONFIG_DIR/init.lua" "$@" | ||
exec -a qvim nvim -u "$QUANTUMVIM_RTP_DIR/init.lua" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,36 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
export XDG_STATE_HOME="$HOME/.local/state" | ||
|
||
export QV_FIRST_TIME_SETUP=1 | ||
export QUANTUMVIM_CONFIG_DIR="${QUANTUMVIM_CONFIG_DIR:-"$HOME/.config/qvim"}" | ||
export NVIM_APPNAME="${NVIM_APPNAME:-"qvim"}" | ||
export QUANTUMVIM_RTP_DIR="${QUANTUMVIM_RTP_DIR:-"$XDG_STATE_HOME/$NVIM_APPNAME"}" | ||
|
||
QUANTUMVIM_CACHE_DIR="$(mktemp -d)" | ||
QUANTUMVIM_STATE_DIR="$(mktemp -d)" | ||
QUANTUMVIM_DATA_DIR="$(mktemp -d)" | ||
QUANTUMVIM_CONFIG_DIR="$(mktemp -d)" | ||
|
||
export QUANTUMVIM_CACHE_DIR QUANTUMVIM_STATE_DIR QUANTUMVIM_DATA_DIR | ||
export QUANTUMVIM_CACHE_DIR QUANTUMVIM_STATE_DIR QUANTUMVIM_DATA_DIR QUANTUMVIM_CONFIG_DIR | ||
|
||
echo "rtp: $QUANTUMVIM_RTP_DIR" | ||
echo "cache: $QUANTUMVIM_CACHE_DIR" | ||
echo "state: $QUANTUMVIM_STATE_DIR" | ||
echo "data: $QUANTUMVIM_DATA_DIR" | ||
echo "config: $QUANTUMVIM_CONFIG_DIR" | ||
|
||
# TODO log dir | ||
|
||
mkdir -p "$QUANTUMVIM_STATE_DIR/after/pack/lazy/opt" | ||
git clone https://github.com/nvim-lua/plenary.nvim.git "$QUANTUMVIM_STATE_DIR/after/pack/lazy/opt/plenary" | ||
mkdir -p "$QUANTUMVIM_RTP_DIR/after/pack/lazy/opt" | ||
git clone https://github.com/nvim-lua/plenary.nvim.git "$QUANTUMVIM_RTP_DIR/after/pack/lazy/opt/plenary" | ||
|
||
qvim() { | ||
exec -a qvim nvim -u "$QUANTUMVIM_CONFIG_DIR/tests/minimal_init.lua" \ | ||
--cmd "set runtimepath+=$QUANTUMVIM_STATE_DIR/after/pack/lazy/opt/plenary" \ | ||
"$@" | ||
exec -a qvim nvim -u "$QUANTUMVIM_RTP_DIR/tests/minimal_init.lua" \ | ||
--cmd "set runtimepath+=$QUANTUMVIM_RTP_DIR/after/pack/lazy/opt/plenary" \ | ||
"$@" | ||
} | ||
|
||
if [ -n "$1" ]; then | ||
qvim --headless -c "lua require('plenary.busted').run('$1')" | ||
qvim --headless -c "lua require('plenary.busted').run('$1')" | ||
else | ||
qvim --headless -c "PlenaryBustedDirectory tests/specs { minimal_init = './tests/minimal_init.lua' }" | ||
qvim --headless -c "PlenaryBustedDirectory tests/specs { minimal_init = './tests/minimal_init.lua' }" | ||
fi |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,9 @@ declare -xr INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" | |
declare -xr XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" | ||
declare -xr XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" | ||
declare -xr XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" | ||
declare -xr XDG_STATE_HOME="${XDG_STATE_HOME:-"$HOME/.local/state"}" | ||
|
||
declare -xr QUANTUMVIM_RTP_DIR="${QUANTUMVIM_RTP_DIR:-"$XDG_STATE_HOME/$NVIM_APPNAME"}" | ||
declare -xr QUANTUMVIM_CACHE_DIR="${QUANTUMVIM_CACHE_DIR:-"$XDG_CACHE_HOME/$NVIM_APPNAME"}" | ||
declare -xr QUANTUMVIM_CONFIG_DIR="${QUANTUMVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/$NVIM_APPNAME"}" | ||
declare -xr QUANTUMVIM_LOG_LEVEL="${QUANTUMVIM_LOG_LEVEL:-warn}" | ||
|
@@ -31,8 +33,10 @@ declare ADDITIONAL_WARNINGS="" | |
declare USE_SSH=0 | ||
|
||
declare -a __qvim_dirs=( | ||
"$QUANTUMVIM_RTP_DIR" | ||
"$QUANTUMVIM_CACHE_DIR" | ||
"$QUANTUMVIM_CONFIG_DIR" | ||
# TODO log dir | ||
) | ||
|
||
function usage() { | ||
|
@@ -51,9 +55,9 @@ function parse_arguments() { | |
--overwrite) | ||
ARGS_OVERWRITE=1 | ||
;; | ||
--ssh) | ||
USE_SSH=1 | ||
;; | ||
--ssh) | ||
USE_SSH=1 | ||
;; | ||
# Currently no supported dependencies | ||
#-y | --yes) | ||
# INTERACTIVE_MODE=0 | ||
|
@@ -225,22 +229,22 @@ function clone_qvim() { | |
|
||
if [ "$USE_SSH" -eq 0 ]; then | ||
|
||
if ! git clone --branch "$QV_BRANCH" \ | ||
"https://github.com/${QV_REMOTE}" "$QUANTUMVIM_CONFIG_DIR"; then | ||
echo "Failed to clone repository. Installation failed." | ||
exit 1 | ||
fi | ||
else | ||
if ! git clone --branch "$QV_BRANCH" \ | ||
"[email protected]:${QV_REMOTE}" "$QUANTUMVIM_CONFIG_DIR"; then | ||
echo "Failed to clone repository. Installation failed." | ||
exit 1 | ||
fi | ||
if ! git clone --branch "$QV_BRANCH" \ | ||
"https://github.com/${QV_REMOTE}" "$QUANTUMVIM_RTP_DIR"; then | ||
echo "Failed to clone repository. Installation failed." | ||
exit 1 | ||
fi | ||
else | ||
if ! git clone --branch "$QV_BRANCH" \ | ||
"[email protected]:${QV_REMOTE}" "$QUANTUMVIM_RTP_DIR"; then | ||
echo "Failed to clone repository. Installation failed." | ||
exit 1 | ||
fi | ||
fi | ||
} | ||
|
||
function setup_exec() { | ||
make -C "$QUANTUMVIM_CONFIG_DIR" install-bin | ||
make -C "$QUANTUMVIM_RTP_DIR" install-bin | ||
} | ||
|
||
function remove_old_cache_files() { | ||
|
@@ -271,13 +275,13 @@ function create_desktop_file() { | |
([ "$OS" != "Linux" ] || ! command -v xdg-desktop-menu &>/dev/null) && return | ||
echo "Creating desktop file" | ||
|
||
for d in "$QUANTUMVIM_CONFIG_DIR"/utils/desktop/*/; do | ||
for d in "$QUANTUMVIM_RTP_DIR"/utils/desktop/*/; do | ||
size_folder=$(basename "$d") | ||
mkdir -p "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps/" | ||
cp "$QUANTUMVIM_CONFIG_DIR/utils/desktop/$size_folder/$NVIM_APPNAME.svg" "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps" | ||
cp "$QUANTUMVIM_RTP_DIR/utils/desktop/$size_folder/$NVIM_APPNAME.svg" "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps" | ||
done | ||
|
||
xdg-desktop-menu install --novendor "$QUANTUMVIM_CONFIG_DIR/utils/desktop/$NVIM_APPNAME.desktop" || true | ||
xdg-desktop-menu install --novendor "$QUANTUMVIM_RTP_DIR/utils/desktop/$NVIM_APPNAME.desktop" || true | ||
} | ||
|
||
function print_logo() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters