Skip to content

Commit

Permalink
refactor to use libexec instead of lib/cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesampson committed Jul 2, 2013
1 parent 26297be commit f73e96b
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bin/refresh.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $dest = ensure (versiondir 'scoop' 'current')
if("$src" -eq "$dest") { abort "$(strip_ext $myinvocation.mycommand.name) is for development only" }

'copying files...'
cp "$src\*" $dest -recurse -force -exclude '.git', 'tests'
robocopy $src $dest /mir /njh /njs /nfl /ndl /xd .git /xf .DS_Store

echo 'creating shim...'
shim "$dest\bin\scoop.ps1"
Expand Down
4 changes: 2 additions & 2 deletions lib/commands.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function command_files {
gci (resolve 'cmd') | where { $_.name.endswith('.ps1') }
gci (resolve '..\libexec') | where { $_.name.endswith('.ps1') }
}

function commands {
Expand All @@ -9,5 +9,5 @@ function commands {
function command_name($filename) { $filename.name -replace '\.ps1$', '' }

function exec($cmd, $arguments) {
& (resolve "cmd\$cmd.ps1") @arguments
& (resolve "..\libexec\$cmd.ps1") @arguments
}
6 changes: 3 additions & 3 deletions lib/cmd/help.ps1 → libexec/help.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Summary: Show help for a command
param($cmd)

. "$(split-path $myinvocation.mycommand.path)\..\core.ps1"
. (resolve ..\commands.ps1)
. (resolve ..\help.ps1)
. "$(split-path $myinvocation.mycommand.path)\..\lib\core.ps1"
. (resolve ..\lib\commands.ps1)
. (resolve ..\lib\help.ps1)

function print_help($cmd) {
$file = gc (resolve ".\$cmd.ps1") -raw
Expand Down
10 changes: 5 additions & 5 deletions lib/cmd/install.ps1 → libexec/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
# scoop install runat https://raw.github.com/lukesampson/scoop/master/bucket/runat.json
param($app, $url, $architecture)

. "$(split-path $myinvocation.mycommand.path)\..\core.ps1"
. (resolve ..\manifest.ps1)
. (resolve ..\install.ps1)
. (resolve ..\versions.ps1)
. (resolve ..\help.ps1)
. "$(split-path $myinvocation.mycommand.path)\..\lib\core.ps1"
. (resolve ..\lib\manifest.ps1)
. (resolve ..\lib\install.ps1)
. (resolve ..\lib\versions.ps1)
. (resolve ..\lib\help.ps1)

switch($architecture) {
'' { $architecture = architecture }
Expand Down
6 changes: 3 additions & 3 deletions lib/cmd/list.ps1 → libexec/list.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Summary: List installed apps
# Help: Lists all installed apps

. "$(split-path $myinvocation.mycommand.path)\..\core.ps1"
. (resolve '..\versions.ps1')
. (resolve '..\manifest.ps1')
. "$(split-path $myinvocation.mycommand.path)\..\lib\core.ps1"
. (resolve '..\lib\versions.ps1')
. (resolve '..\lib\manifest.ps1')

$apps = installed_apps

Expand Down
8 changes: 4 additions & 4 deletions lib/cmd/search.ps1 → libexec/search.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# If used with [query], shows app names that match the query.
# Without [query], shows all the available apps.
param($query)
. "$(split-path $myinvocation.mycommand.path)\..\core.ps1"
. (resolve '..\manifest.ps1')
. (resolve '..\versions.ps1')
. "$(split-path $myinvocation.mycommand.path)\..\lib\core.ps1"
. (resolve '..\lib\manifest.ps1')
. (resolve '..\lib\versions.ps1')

$bucket = resolve '..\..\bucket'
$bucket = resolve '..\bucket'
$apps = apps_in_bucket $bucket

if($query) { $apps = $apps | ? { $_ -like "*$query*" } }
Expand Down
10 changes: 5 additions & 5 deletions lib/cmd/uninstall.ps1 → libexec/uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# Help: e.g. scoop uninstall git
param($app)

. "$(split-path $myinvocation.mycommand.path)\..\core.ps1"
. (resolve ../manifest.ps1)
. (resolve ../help.ps1)
. (resolve ../install.ps1)
. (resolve ../versions.ps1)
. "$(split-path $myinvocation.mycommand.path)\..\lib\core.ps1"
. (resolve ..\lib\manifest.ps1)
. (resolve ..\lib\help.ps1)
. (resolve ..\lib\install.ps1)
. (resolve ..\lib\versions.ps1)

if(!$app) { 'ERROR: <app> missing'; my_usage; exit 1 }

Expand Down
8 changes: 4 additions & 4 deletions lib/cmd/update.ps1 → libexec/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# 'scoop update [app]' installs a new version of that app, if there is one.
param($app)

. "$(split-path $myinvocation.mycommand.path)\..\core.ps1"
. (resolve ..\install.ps1)
. (resolve ..\manifest.ps1)
. (resolve ..\versions.ps1)
. "$(split-path $myinvocation.mycommand.path)\..\lib\core.ps1"
. (resolve ..\lib\install.ps1)
. (resolve ..\lib\manifest.ps1)
. (resolve ..\lib\versions.ps1)

if(!$app) {
# update scoop
Expand Down
4 changes: 2 additions & 2 deletions lib/cmd/which.ps1 → libexec/which.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Summary: Locate a program path
# Help: Finds the path to a program that was installed with Scoop
param($command)
. "$(split-path $myinvocation.mycommand.path)\..\core.ps1"
. (resolve '..\help.ps1')
. "$(split-path $myinvocation.mycommand.path)\..\lib\core.ps1"
. (resolve '..\lib\help.ps1')

if(!$command) { 'ERROR: <command> missing'; my_usage; exit 1 }

Expand Down

0 comments on commit f73e96b

Please sign in to comment.