diff options
| author | kylo252 <[email protected]> | 2021-12-09 11:51:37 +0100 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-09 11:51:37 +0100 | 
| commit | 68cdb62f87543d5420e70c241ebd5942ed9c7b0e (patch) | |
| tree | a6240d9d7a138a3f5d72614759bdbfdd8305a53b /utils | |
| parent | c43ee9aa3a6353e74d577cb79e60c5c885bc02f5 (diff) | |
fix(bootstrap): remove hard-coded spellfile option (#2061)
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/installer/install.ps1 | 80 | ||||
| -rwxr-xr-x | utils/installer/install.sh | 26 | 
2 files changed, 61 insertions, 45 deletions
| diff --git a/utils/installer/install.ps1 b/utils/installer/install.ps1 index c46bbfc2..0823032a 100644 --- a/utils/installer/install.ps1 +++ b/utils/installer/install.ps1 @@ -64,20 +64,8 @@ function main($cliargs) {      backup_old_config      __add_separator "80"  -   -    if ($cliargs.Contains("--overwrite")) { -        Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag" -        $answer = Read-Host "Would you like to continue? [y]es or [n]o " -        if ("$answer" -ne "y" -and "$answer" -ne "Y") { -            exit 1 -        }  -		 -        foreach ($dir in $__lvim_dirs) { -            if (Test-Path "$dir") { -                Remove-Item -Force -Recurse "$dir" -            } -        } -    } +  +    verify_lvim_dirs      if (Test-Path "$env:LUNARVIM_RUNTIME_DIR\site\pack\packer\start\packer.nvim") {          Write-Output "Packer already installed" @@ -153,7 +141,7 @@ function check_system_deps() {  function install_nodejs_deps() {      try {          check_system_dep "node" -        Invoke-Command npm install -g neovim tree-sitter-cli  -ErrorAction Break +        Invoke-Command npm install -g neovim tree-sitter-cli -ErrorAction Break      }      catch {          print_missing_dep_msg "$dep" @@ -211,6 +199,29 @@ function setup_shim() {      Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\bin\lvim.ps1" -Destination "$INSTALL_PREFIX\bin\lvim.ps1" -Force  } +function verify_lvim_dirs() { +    if ($cliargs.Contains("--overwrite")) { +        Write-Output "!!Warning!! -> Removing all lunarvim related config because of the --overwrite flag" +        $answer = Read-Host "Would you like to continue? [y]es or [n]o " +        if ("$answer" -ne "y" -and "$answer" -ne "Y") { +            exit 1 +        }  + +        foreach ($dir in $__lvim_dirs) { +            if (Test-Path "$dir") { +                Remove-Item -Force -Recurse "$dir" +            } +        } +    } + +    foreach ($dir in $__lvim_dirs) { +        if ((Test-Path "$dir") -eq $false) { +            New-Item "$dir" -ItemType Directory +        } +    } + +} +  function setup_lvim() {      Write-Output "Installing LunarVim shim" @@ -218,30 +229,26 @@ function setup_lvim() {      Write-Output "Preparing Packer setup" -    if ((Test-Path "$env:LUNARVIM_CONFIG_DIR") -eq $false) { -        New-Item "$env:LUNARVIM_CONFIG_DIR" -ItemType Directory -    } -      if (Test-Path "$env:LUNARVIM_CONFIG_DIR\config.lua") {          Remove-Item -Force "$env:LUNARVIM_CONFIG_DIR\config.lua"      }      Out-File -FilePath "$env:LUNARVIM_CONFIG_DIR\config.lua" -	Write-Output "Packer setup complete" +    Write-Output "Packer setup complete" -	__add_separator "80" +    __add_separator "80" -	Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua" +    Copy-Item "$env:LUNARVIM_RUNTIME_DIR\lvim\utils\installer\config.example.lua" "$env:LUNARVIM_CONFIG_DIR\config.lua" -	$answer = Read-Host $(` -	"Would you like to create an alias inside your Powershell profile?`n" +` -	"(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" ) -	if ("$answer" -eq "y" -and "$answer" -eq "Y") { -		create_alias -	}  +    $answer = Read-Host $(` +            "Would you like to create an alias inside your Powershell profile?`n" + ` +            "(This enables you to start lvim with the command 'lvim') [y]es or [n]o (default: no)" ) +    if ("$answer" -eq "y" -and "$answer" -eq "Y") { +        create_alias +    }  -	__add_separator "80" +    __add_separator "80"      Write-Output "Thank you for installing LunarVim!!"      Write-Output "You can start it by running: $INSTALL_PREFIX\bin\lvim.ps1" @@ -267,15 +274,16 @@ function __add_separator($div_width) {  }  function create_alias { -	if($null -eq $(Get-Alias | Select-String "lvim")){ -		Add-Content -Path $PROFILE -Value $(-join @('Set-Alias lvim "', "$INSTALL_PREFIX", '\bin\lvim.ps1"')) +    if ($null -eq $(Get-Alias | Select-String "lvim")) { +        Add-Content -Path $PROFILE -Value $( -join @('Set-Alias lvim "', "$INSTALL_PREFIX", '\bin\lvim.ps1"')) -		Write-Output "" -		Write-Host 'To use the new alias in this window reload your profile with ". $PROFILE".' -ForegroundColor Yellow +        Write-Output "" +        Write-Host 'To use the new alias in this window reload your profile with ". $PROFILE".' -ForegroundColor Yellow -	}else { -		Write-Output "Alias is already set and will not be reset." -	} +    } +    else { +        Write-Output "Alias is already set and will not be reset." +    }  }  main "$args" 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"  } | 
