mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-09-29 08:47:10 +00:00
Merge pull request #357 from lukesampson/revert-355-feature/scoop-reset-scoop
Revert "Add ability to reset scoop (also adds Git Bash support)"
This commit is contained in:
@@ -32,18 +32,6 @@ rm $zipfile
|
||||
echo 'creating shim...'
|
||||
shim "$dir\bin\scoop.ps1" $false
|
||||
|
||||
if(!(test-path ~/.bashrc)) {
|
||||
'creating ~/.bashrc'
|
||||
new-item -type file ~/.bashrc | out-null
|
||||
}
|
||||
if (!(get-content ~/.bashrc | select-string 'alias scoop' -quiet)) {
|
||||
'creating bash alias for scoop...'
|
||||
'alias scoop="powershell scoop.ps1"' | out-file ~/.bashrc -en oem -append
|
||||
}
|
||||
else {
|
||||
'bash alias for scoop already exists... skipping...'
|
||||
}
|
||||
|
||||
ensure_scoop_in_path
|
||||
success 'scoop was installed successfully!'
|
||||
echo "type 'scoop help' for instructions"
|
||||
|
||||
+8
-25
@@ -13,31 +13,14 @@ param($app)
|
||||
|
||||
if(!$app) { 'ERROR: <app> missing'; my_usage; exit 1 }
|
||||
|
||||
if ($app -eq "scoop") {
|
||||
"resetting scoop"
|
||||
if(!(installed $app)) { abort "$app isn't installed" }
|
||||
|
||||
if(!(test-path ~/.bashrc)) {
|
||||
'creating ~/.bashrc'
|
||||
new-item -type file ~/.bashrc | out-null
|
||||
}
|
||||
if (!(get-content ~/.bashrc | select-string 'alias scoop' -quiet)) {
|
||||
'creating bash alias for scoop...'
|
||||
'alias scoop="powershell scoop.ps1"' | out-file ~/.bashrc -en oem -append
|
||||
}
|
||||
else {
|
||||
'bash alias for scoop already exists... skipping...'
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!(installed $app)) { abort "$app isn't installed" }
|
||||
$version = current_version $app
|
||||
"resetting $app ($version)"
|
||||
|
||||
$version = current_version $app
|
||||
"resetting $app ($version)"
|
||||
$dir = resolve-path (versiondir $app $version)
|
||||
$manifest = installed_manifest $app $version
|
||||
|
||||
$dir = resolve-path (versiondir $app $version)
|
||||
$manifest = installed_manifest $app $version
|
||||
|
||||
create_shims $manifest $dir $false
|
||||
env_add_path $manifest $dir
|
||||
env_set $manifest $dir
|
||||
}
|
||||
create_shims $manifest $dir $false
|
||||
env_add_path $manifest $dir
|
||||
env_set $manifest $dir
|
||||
@@ -1,70 +0,0 @@
|
||||
set-alias scoop "$psscriptroot/../bin/scoop.ps1"
|
||||
|
||||
describe "'scoop reset scoop'" {
|
||||
beforeall {
|
||||
remove-item "~/.bashrc.scoop" -ea ignore
|
||||
}
|
||||
|
||||
function alias_count {
|
||||
(gc "~/.bashrc" | where { $_ -eq 'alias scoop="powershell scoop.ps1"' } | measure).count
|
||||
}
|
||||
|
||||
function backup_bashrc_if_exists {
|
||||
# back up .bashrc if it exists
|
||||
if(test-path "~/.bashrc") {
|
||||
move-item "~/.bashrc" "~/.bashrc.scoop"
|
||||
}
|
||||
}
|
||||
|
||||
function restore_bashrc_if_exists {
|
||||
# restore backup
|
||||
if(test-path "~/.bashrc.scoop") {
|
||||
move-item "~/.bashrc.scoop" "~/.bashrc"
|
||||
|
||||
"~/.bashrc.scoop" | should not exist
|
||||
"~/.bashrc" | should exist
|
||||
}
|
||||
}
|
||||
|
||||
context "no .bashrc" {
|
||||
it "creates .bashrc when it doesn't exist" {
|
||||
backup_bashrc_if_exists
|
||||
|
||||
"~/.bashrc" | should not exist
|
||||
scoop reset scoop
|
||||
"~/.bashrc" | should exist
|
||||
alias_count | should be 1
|
||||
|
||||
# cleanup
|
||||
remove-item "~/.bashrc"
|
||||
|
||||
restore_bashrc_if_exists
|
||||
}
|
||||
}
|
||||
|
||||
context "bash scoop alias exists" {
|
||||
it "does not create another bash scoop alias" {
|
||||
# call it once to create it if it doesn't exist
|
||||
scoop reset scoop
|
||||
alias_count | should be 1
|
||||
|
||||
scoop reset scoop
|
||||
alias_count | should be 1
|
||||
}
|
||||
}
|
||||
|
||||
context "bash scoop alias doesn't exist" {
|
||||
it "creates bash scoop alias" {
|
||||
backup_bashrc_if_exists
|
||||
new-item -type file "~/.bashrc"
|
||||
|
||||
alias_count | should be 0
|
||||
|
||||
scoop reset scoop
|
||||
alias_count | should be 1
|
||||
|
||||
remove-item "~/.bashrc"
|
||||
restore_bashrc_if_exists
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user