From 24be0ef1ef36b8cc725655e920104e9676b72f25 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 27 Nov 2021 15:22:43 +0100 Subject: chore: bump core-plugins version (#1989) --- utils/installer/install.sh | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index e7631999..b6b7bc31 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -14,7 +14,6 @@ declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvi declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" # TODO: Use a dedicated cache directory #1256 declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" -declare -r LUNARVIM_PACK_DIR="$LUNARVIM_RUNTIME_DIR/site/pack" declare BASEDIR BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" @@ -114,8 +113,6 @@ function main() { done fi - install_packer - if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then update_lvim else @@ -280,18 +277,6 @@ function backup_old_config() { echo "Backup operation complete" } -function install_packer() { - if [ -e "$LUNARVIM_PACK_DIR/packer/start/packer.nvim" ]; then - msg "Packer already installed" - else - if ! git clone --depth 1 "https://github.com/wbthomason/packer.nvim" \ - "$LUNARVIM_PACK_DIR/packer/start/packer.nvim"; then - msg "Failed to clone Packer. Installation failed." - exit 1 - fi - fi -} - function clone_lvim() { msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ @@ -351,10 +336,10 @@ function setup_lvim() { setup_shim - echo "Preparing Packer setup" - cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + echo "Preparing Packer setup" + "$INSTALL_PREFIX/bin/lvim" --headless \ -c 'autocmd User PackerComplete quitall' \ -c 'PackerSync' -- cgit v1.2.3 From 6770808bec1ffcada425ae514747f9380e3d3b8d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 6 Dec 2021 17:04:46 +0100 Subject: feat: full compatibility with neovim v0.6 (#2037) --- utils/installer/install.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index b6b7bc31..88c3e550 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -174,6 +174,17 @@ function print_missing_dep_msg() { fi } +function check_neovim_min_version() { + # TODO: consider locking the requirement to 0.6+ + local verify_version_cmd='if !has("nvim-0.5.1") | cquit | else | quit | endif' + + # exit with an error if min_version not found + if ! nvim --headless -u NONE -c "$verify_version_cmd"; then + echo "[ERROR]: LunarVim requires at least Neovim v0.5.1 or higher" + exit 1 + fi +} + function check_system_deps() { if ! command -v git &>/dev/null; then print_missing_dep_msg "git" @@ -183,6 +194,7 @@ function check_system_deps() { print_missing_dep_msg "neovim" exit 1 fi + check_neovim_min_version } function __install_nodejs_deps_npm() { -- cgit v1.2.3 From 68cdb62f87543d5420e70c241ebd5942ed9c7b0e Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 9 Dec 2021 11:51:37 +0100 Subject: fix(bootstrap): remove hard-coded spellfile option (#2061) --- utils/installer/install.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 88c3e550..722144e3 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -107,11 +107,7 @@ function main() { msg "Backing up old LunarVim configuration" backup_old_config - if [ "$ARGS_OVERWRITE" -eq 1 ]; then - for dir in "${__lvim_dirs[@]}"; do - [ -d "$dir" ] && rm -rf "$dir" - done - fi + verify_lvim_dirs if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then update_lvim @@ -262,11 +258,24 @@ function install_rust_deps() { echo "All Rust dependencies are successfully installed" } +function verify_lvim_dirs() { + if [ "$ARGS_OVERWRITE" -eq 1 ]; then + for dir in "${__lvim_dirs[@]}"; do + [ -d "$dir" ] && rm -rf "$dir" + done + fi + + for dir in "${__lvim_dirs[@]}"; do + mkdir -p "$dir" + done +} + function backup_old_config() { for dir in "${__lvim_dirs[@]}"; do - # we create an empty folder for subsequent commands \ - # that require an existing directory - mkdir -p "$dir" "$dir.bak" + if [ ! -d "$dir" ]; then + continue + fi + mkdir -p "$dir.bak" touch "$dir/ignore" if command -v rsync &>/dev/null; then rsync --archive -hh --partial --progress --cvs-exclude \ @@ -307,7 +316,6 @@ function link_local_lvim() { rm -rf "$LUNARVIM_RUNTIME_DIR/lvim" fi - mkdir -p "$LUNARVIM_RUNTIME_DIR" echo " - $BASEDIR -> $LUNARVIM_RUNTIME_DIR/lvim" ln -s -f "$BASEDIR" "$LUNARVIM_RUNTIME_DIR/lvim" } -- cgit v1.2.3 From 872061e179a9e887a0bf8da5d0f2b2f57df1fc66 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 11 Dec 2021 19:52:34 +0100 Subject: fix(installer): better handling of existing files (#2066) --- utils/installer/install.sh | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 722144e3..66205b10 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -12,6 +12,8 @@ declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" +declare -r LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" + # TODO: Use a dedicated cache directory #1256 declare -r LUNARVIM_CACHE_DIR="$XDG_CACHE_HOME/nvim" @@ -109,17 +111,16 @@ function main() { verify_lvim_dirs - if [ -e "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" ]; then - update_lvim + if [ "$ARGS_LOCAL" -eq 1 ]; then + link_local_lvim + elif [ -e "$LUNARVIM_BASE_DIR/init.lua" ]; then + validate_lunarvim_files else - if [ "$ARGS_LOCAL" -eq 1 ]; then - link_local_lvim - else - clone_lvim - fi - setup_lvim + clone_lvim fi + setup_lvim + msg "Thank you for installing LunarVim!!" echo "You can start it by running: $INSTALL_PREFIX/bin/lvim" echo "Do not forget to use a font with glyphs (icons) support [https://github.com/ryanoasis/nerd-fonts]" @@ -181,6 +182,15 @@ function check_neovim_min_version() { fi } +function validate_lunarvim_files() { + local verify_version_cmd='if v:errmsg != "" | cquit | else | quit | endif' + if ! "$INSTALL_PREFIX/bin/lvim" --headless -c 'LvimUpdate' -c "$verify_version_cmd" &>/dev/null; then + msg "Removing old installation files" + rm -rf "$LUNARVIM_BASE_DIR" + clone_lvim + fi +} + function check_system_deps() { if ! command -v git &>/dev/null; then print_missing_dep_msg "git" @@ -301,7 +311,7 @@ function backup_old_config() { function clone_lvim() { msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ - --depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_RUNTIME_DIR/lvim"; then + --depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then echo "Failed to clone repository. Installation failed." exit 1 fi @@ -311,13 +321,13 @@ function link_local_lvim() { echo "Linking local LunarVim repo" # Detect whether it's a symlink or a folder - if [ -d "$LUNARVIM_RUNTIME_DIR/lvim" ]; then + if [ -d "$LUNARVIM_BASE_DIR" ]; then echo "Removing old installation files" - rm -rf "$LUNARVIM_RUNTIME_DIR/lvim" + rm -rf "$LUNARVIM_BASE_DIR" fi - echo " - $BASEDIR -> $LUNARVIM_RUNTIME_DIR/lvim" - ln -s -f "$BASEDIR" "$LUNARVIM_RUNTIME_DIR/lvim" + echo " - $BASEDIR -> $LUNARVIM_BASE_DIR" + ln -s -f "$BASEDIR" "$LUNARVIM_BASE_DIR" } function setup_shim() { @@ -356,7 +366,7 @@ function setup_lvim() { setup_shim - cp "$LUNARVIM_RUNTIME_DIR/lvim/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" echo "Preparing Packer setup" @@ -367,10 +377,6 @@ function setup_lvim() { echo "Packer setup complete" } -function update_lvim() { - "$INSTALL_PREFIX/bin/lvim" --headless +'LvimUpdate' +q -} - function print_logo() { cat <<'EOF' -- cgit v1.2.3 From f7d883b6b92d66c222fd0d4e3d398c1f4fcea882 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:08:25 +0100 Subject: feat(installer): nicer rsync output (#2067) --- utils/installer/install.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'utils/installer/install.sh') diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 66205b10..d420baed 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -106,14 +106,13 @@ function main() { [ "$answer" != "${answer#[Yy]}" ] && install_rust_deps fi - msg "Backing up old LunarVim configuration" backup_old_config verify_lvim_dirs if [ "$ARGS_LOCAL" -eq 1 ]; then link_local_lvim - elif [ -e "$LUNARVIM_BASE_DIR/init.lua" ]; then + elif [ -d "$LUNARVIM_BASE_DIR" ]; then validate_lunarvim_files else clone_lvim @@ -287,9 +286,9 @@ function backup_old_config() { fi mkdir -p "$dir.bak" touch "$dir/ignore" + msg "Backing up old $dir to $dir.bak" if command -v rsync &>/dev/null; then - rsync --archive -hh --partial --progress --cvs-exclude \ - --modify-window=1 "$dir"/ "$dir.bak" + rsync --archive -hh --stats --partial --cvs-exclude "$dir"/ "$dir.bak" else OS="$(uname -s)" case "$OS" in @@ -305,7 +304,7 @@ function backup_old_config() { esac fi done - echo "Backup operation complete" + msg "Backup operation complete" } function clone_lvim() { -- cgit v1.2.3