uninstall: remove scoop from path

add sublime project with settings to use windows line endings by default
This commit is contained in:
Luke Sampson
2013-06-15 14:25:14 +10:00
parent acabed823d
commit ff3cd3e77b
6 changed files with 35 additions and 9 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
.DS_Store
._.DS_Store
._.DS_Store
scoop.sublime-workspace
+5
View File
@@ -0,0 +1,5 @@
{
"name": "runat",
"url": "https://gist.github.com/lukesampson/5778559/raw/runat.ps1",
"version": 0.1
}
+1 -1
View File
@@ -26,5 +26,5 @@ echo 'creating stub...'
stub "$abs_appdir\scoop-master\scoop.ps1"
ensure_scoop_in_path
success 'you successfully installed scoop!'
success 'scoop was successfully installed!'
echo 'type "scoop help" for instructions'
+5 -1
View File
@@ -12,6 +12,9 @@ function success($msg) { write-host $msg -b green -f black; }
function appdir($name) { "$scoopdir\apps\$name" }
function fname($path) { split-path $path -leaf }
function ensure($dir) { if(!(test-path $dir)) { mkdir $dir > $null }; resolve-path $dir }
function full_path($path) {
$executionContext.sessionState.path.getUnresolvedProviderPathFromPSPath($path)
}
function friendly_path($path) {
return "$path" -replace ([regex]::escape($home)), "~"
}
@@ -24,6 +27,7 @@ function unzip($path,$to) {
$zipfiles = $shell.namespace("$path").items()
$shell.namespace("$to").copyHere($zipFiles, 4) # 4 = don't show progress dialog
}
function coalesce($a, $b) { if($a) { return $a } $b }
function stub($path) {
if(!(test-path $path)) { abort "can't stub $(fname $path): couldn't find $path"}
@@ -39,7 +43,7 @@ function ensure_scoop_in_path {
$abs_bindir = ensure $bindir
if($userpath -notmatch [regex]::escape($abs_bindir)) {
# be aggressive (b-e-aggressive) and install scoop first in the path
echo "adding $(friendly_path $abs_bindir) to your user path"
echo "adding $(friendly_path $abs_bindir) to your path"
env 'path' "$abs_bindir;$userpath" # for future sessions
$env:path = "$abs_bindir;$env:path" # for this session
}
+11
View File
@@ -0,0 +1,11 @@
{
"folders":
[
{
"path": "."
}
],
"settings": {
"default_line_ending": "windows"
}
}
+11 -6
View File
@@ -1,12 +1,17 @@
. .\lib\init.ps1
if(test-path $scoopdir) {
rm -r $scoopdir
} else {
echo "couldn't find $(friendly_path $scoopdir)"
try {
rm -r $scoopdir -ea stop
} catch {
abort "couldn't remove $(friendly_path $scoopdir): it may be in use"
}
}
$bindir_regex = [regex]::escape((full_path $bindir))
if((env 'path') -match $bindir_regex) { # future sessions
echo "removing $(friendly_path $bindir) from your path"
env 'path' ((env 'path') -replace $bindir_regex, '')
}
# todo: remove scoop\bin from path
success "you successfully uninstalled scoop"
success "scoop has been uninstalled"