diff options
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | README | 4 | ||||
-rwxr-xr-x | bin/checklinks | 6 | ||||
-rwxr-xr-x | bin/ct (renamed from bin/pkg) | 26 | ||||
-rw-r--r-- | description | 4 | ||||
-rwxr-xr-x | include/bootstrap | 28 | ||||
-rwxr-xr-x | include/newpackage | 2 | ||||
-rwxr-xr-x | include/pkglist | 2 | ||||
-rw-r--r-- | man/1/ct.pod (renamed from man/1/pkg.pod) | 26 | ||||
-rw-r--r-- | man/5/caretaker.conf.pod (renamed from man/5/pkg.conf.pod) | 20 | ||||
-rw-r--r-- | man/7/caretaker-setup.pod (renamed from man/7/pkg-setup.pod) | 6 | ||||
-rw-r--r-- | man/7/caretaker.pod (renamed from man/7/pkg.pod) | 60 | ||||
-rw-r--r-- | provides/zsh/alias | 1 | ||||
-rw-r--r-- | provides/zsh/completions/_ct (renamed from provides/zsh/completions/_pkg) | 39 | ||||
-rw-r--r-- | test/add | 18 | ||||
-rwxr-xr-x | test/main | 44 | ||||
-rw-r--r-- | test/pull | 4 | ||||
-rw-r--r-- | test/push | 2 | ||||
-rw-r--r-- | test/remove | 20 | ||||
-rw-r--r-- | test/setup | 4 |
20 files changed, 160 insertions, 158 deletions
@@ -1 +1 @@ -/pkg.conf +/caretaker.conf @@ -1,6 +1,6 @@ -pkg - distributed dotfile and script manager +caretaker - distributed dotfile and script manager -For setup: perldoc -F man/7/pkg-setup +For setup: perldoc -F man/7/caretaker-setup.pod Requires: - zsh diff --git a/bin/checklinks b/bin/checklinks index 765e5c7..307e246 100755 --- a/bin/checklinks +++ b/bin/checklinks @@ -164,9 +164,9 @@ which have a status of "ok" or "absolute", level 2 will filter anything except =item B<-p>, B<--parameter> I<parameter>=I<value> While reading the links file, replace $I<parameter> with I<value>. -When used in conjuction with pkg(1), $package will be set to the current -package's relative path (as seen from $HOME, like C<packages/pkg>), -and $etc will be set to $package/etc (like C<packages/pkg/etc>) +When used in conjuction with ct(1), $package will be set to the current +package's relative path (as seen from $HOME, like C<packages/caretaker>), +and $etc will be set to $package/etc (like C<packages/caretaker/etc>) =item B<-q>, B<--quiet> @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -## pkg - /home package manager and zsh playground +## caretaker - /home package manager and zsh playground ## Copyright © 2008-2009 by Daniel Friesel <derf@derf.homelinux.org> ## ## Permission to use, copy, modify, and/or distribute this software for any @@ -45,9 +45,15 @@ function clear_line { # Read local configuration : ${XDG_CONFIG_HOME=$HOME/.config} -if [[ -r $XDG_CONFIG_HOME/pkg/pkg.conf ]] { +if [[ -r $XDG_CONFIG_HOME/caretaker/caretaker.conf ]] { + source $XDG_CONFIG_HOME/caretaker/caretaker.conf +} elif [[ -r $HOME/.caretaker.conf ]] { + source $HOME/.caretaker.conf +} elif [[ -r $XDG_CONFIG_HOME/pkg/pkg.conf ]] { + warn "pkg was renamed to caretaker, so move your config to $XDG_CONFIG_HOME/caretaker/caretaker.conf" source $XDG_CONFIG_HOME/pkg/pkg.conf } elif [[ -r $HOME/.pkg.conf ]] { + warn "pkg was renamed to caretaker, so move your config to $HOME/.caretaker.conf" source $HOME/.pkg.conf } @@ -75,7 +81,7 @@ while [[ $1 == --* ]] { action=$1 ((#)) && shift -[[ -n $PKG_ROOT ]] || die "No PKG_ROOT specified. Please edit your pkg.conf\n" +[[ -n $PKG_ROOT ]] || die "No PKG_ROOT specified. Please edit your caretaker.conf\n" : ${PKG_DIR:="$HOME/packages"} : ${PKGLIST_LOCAL=0} : ${CL_OPTIONS:=--quiet} @@ -161,11 +167,11 @@ if [[ $PKG_PROTO == (git|ssh) ]] { : ${PKGLIST_PATH:=$PKG_PATH/pkglist} if ((DEBUG)) { - info "pkg: running in debug mode. Infos follow:\n" + info "caretaker: running in debug mode. Infos follow:\n" echo "--- running ---" echo " zsh $ZSH_VERSION" echo " git "${$(git --version)[3]} - echo " pkg "${$(git --git-dir=$PKG_DIR/${${(s:/:)$(readlink $0)}[-3]}/.git/ log -n 1)[2]} + echo " caretaker "${$(git --git-dir=$PKG_DIR/${${(s:/:)$(readlink $0)}[-3]}/.git/ log -n 1)[2]} echo "--- settings ---" echo " PKG_ROOT $PKG_ROOT" echo " PKG_PROTO $PKG_PROTO" @@ -276,7 +282,7 @@ function vcs_branch_is_master ( } if [[ $branch != master ]] { warn "$1: The currently checked out branch is not master, but '$branch'\n" \ - "Currently, with GIT_USE_ORIGIN=0, pkg can only operate on the branch master\n" \ + "Currently, with GIT_USE_ORIGIN=0, caretaker can only operate on the branch master\n" \ " -> skipping repo, please fix manually\n" return 1 } @@ -820,13 +826,13 @@ cd $PKG_DIR || die "Cannot cd $PKG_DIR" case $action in a|add|install) if [[ $action == install ]] { - warn "pkg install is deprecated, use pkg add instead\n" + warn "ct install is deprecated, use ct add instead\n" } pkg_add $* ;; rm|delete|remove) if [[ $action == delete ]] { - warn "pkg delete is deprecated, use pkg remove instead\n" + warn "ct delete is deprecated, use ct remove instead\n" } pkg_remove $* ;; @@ -842,13 +848,13 @@ case $action in u|update) pkg_update $* ;; f|upgrade|pull) if [[ $action == upgrade ]] { - warn "pkg updgrade is deprecated, use pkg pull instead\n" + warn "ct updgrade is deprecated, use ct pull instead\n" } (( AUTOUPDATE )) && pkg_update remote wrap pkg_upgrade "$1" 'Looking for updates' ;; e|eval) eval $* ;; - *) die "wait, what?\npkg: unknown action: '$action'\n" ;; + *) die "wait, what?\nct: unknown action: '$action'\n" ;; esac apply_triggers diff --git a/description b/description index 89bdd85..3a2db36 100644 --- a/description +++ b/description @@ -1,2 +1,2 @@ -The pkg package -Contains the 'pkg' utility itself, 'checklinks' and the 'bootstrap' script. +The caretaker package +Contains the 'ct' utility itself, 'checklinks' and the 'bootstrap' script. diff --git a/include/bootstrap b/include/bootstrap index 07d8c4f..880fa13 100755 --- a/include/bootstrap +++ b/include/bootstrap @@ -1,7 +1,7 @@ #!/usr/bin/env zsh # bootstrap - populate a home with the most necessary scripts -# After running this, other packages can be installed using 'pkg' -# Note: Since pkg is written in zsh, this script also is. +# After running this, other packages can be installed using 'ct' +# Note: Since caretaker is written in zsh, this script also is. # This way, I don't have to check for zsh somewhere in the script, # and also have an excuse for using zsh here :P @@ -19,7 +19,7 @@ if [[ -n $1 ]] { Usage: ./bootstrap PKG_ROOT [PKG_DIR] PKG_ROOT is an URI, either of the form proto://host/path, or just /path Note: The path must be absolute, it may not contain a literal ~ - PKG_DIR is the path where pkg and all further packages will be installed, + PKG_DIR is the path where caretaker and all further packages will be installed, by default $default_path meow exit 100 @@ -45,25 +45,25 @@ if ! which git &> /dev/null; then exit 200 fi -echo 'Fetching the pkg package...' +echo 'Fetching the caretaker package...' cd $PKG_DIR -git clone $PKG_ROOT/pkg -cd pkg +git clone $PKG_ROOT/caretaker caretaker +cd caretaker -echo 'Writing pkg.conf' -mkdir -p $XDG_CONFIG_HOME/pkg -cat > $XDG_CONFIG_HOME/pkg/pkg.conf <<- flurbl +echo 'Writing caretaker.conf' +mkdir -p $XDG_CONFIG_HOME/caretaker +cat > $XDG_CONFIG_HOME/caretaker/caretaker.conf <<- flurbl PKG_ROOT='$PKG_ROOT' PKG_DIR="${PKG_DIR/$HOME/\$HOME}" flurbl -echo 'Installing pkg package' +echo 'Installing caretaker package' rehash bin/checklinks -bin/pkg eval populate_collected pkg -bin/pkg eval exec_hook pkg post-add +bin/ct eval populate_collected caretaker +bin/ct eval exec_hook caretaker post-add -bin/pkg update +bin/ct update if (( rcempty )) { echo 'Removing empty zshrc' @@ -73,6 +73,6 @@ if (( rcempty )) { if [[ $PATH != *$HOME/bin* ]] { cat <<- tac Note: You may need to change your PATH to include ~/bin, - otherwise certain parts of pkg will not work. + otherwise certain parts of caretaker will not work. tac } diff --git a/include/newpackage b/include/newpackage index 924da44..889adfd 100755 --- a/include/newpackage +++ b/include/newpackage @@ -11,7 +11,7 @@ while [[ $1 == --* ]] { shift } -[[ -r ~/.pkg.conf ]] && source ~/.pkg.conf +[[ -r ~/.caretaker.conf ]] && source ~/.caretaker.conf [[ -d $PKG_ROOT ]] || exit 1 cd $PKG_ROOT diff --git a/include/pkglist b/include/pkglist index 0986150..660036b 100755 --- a/include/pkglist +++ b/include/pkglist @@ -1,6 +1,6 @@ #!/usr/bin/env zsh ## on the PKG_HOST: list available packages -## used by pkg remote-update +## used by ct remote-update # the PKG_PATH (package root path) is given as first argument ($1) if [[ ! -d $1 ]] { diff --git a/man/1/pkg.pod b/man/1/ct.pod index 7f207ba..4bdba98 100644 --- a/man/1/pkg.pod +++ b/man/1/ct.pod @@ -1,14 +1,14 @@ =head1 NAME -pkg - distributed dotfile and script manager +caretaker - distributed dotfile and script manager =head1 SYNOPSIS -B<pkg> [I<options>] I<action> [I<arguments>] +B<ct> [I<options>] I<action> [I<arguments>] =head1 DESCRIPTION -B<pkg> is the basic script for maintaining packages +B<ct> is the basic script for maintaining packages I<action> may be one of: @@ -24,7 +24,7 @@ Remove I<package> from the local packages tree =item B<eval> I<expression> -Evauluate I<expression>. See pkg(7) +Evauluate I<expression>. See caretaker(7) =item B<info> I<package> @@ -106,13 +106,13 @@ by prepending a 'no', like '--no-auto-update'. Options always override the configuration file. Also, every option refers to a configuration parameter, -so please see pkg.conf(5) for more information. +so please see caretaker.conf(5) for more information. =head1 FILES =over -=item F<~/.pkg.conf> +=item F<~/.caretaker.conf> Contains configuration vars @@ -122,19 +122,19 @@ Contains configuration vars =over -=item * B<pkg remote-update; pkg upgrade> +=item * B<ct remote-update; ct upgrade> Get new stuff from the packages_root. -Note: If you haven't disabled AUTOUPDATE, B<pkg upgrade> will suffice here +Note: If you haven't disabled AUTOUPDATE, B<ct upgrade> will suffice here -=item * B<pkg local-update; pkg push> +=item * B<ct local-update; ct push> Push local changes to the packages_root. -Note: If you haven't disabled AUTOUPDATE, B<pkg push> will suffice here +Note: If you haven't disabled AUTOUPDATE, B<ct push> will suffice here -=item * B<pkg refresh pkg> +=item * B<ct refresh caretaker> -'Fake-Upgrade'. Execute the appropiate commands as if the pkg package had been +'Fake-Upgrade'. Execute the appropiate commands as if the caretaker package had been upgraded (useful when you change something but don't want to commit/push yet) =back @@ -159,4 +159,4 @@ many ideas and suggestions =head1 SEE ALSO -L<pkg.conf>(5), pkg(7) +L<caretaker.conf>(5), caretaker(7) diff --git a/man/5/pkg.conf.pod b/man/5/caretaker.conf.pod index c66ae2d..c083a3f 100644 --- a/man/5/pkg.conf.pod +++ b/man/5/caretaker.conf.pod @@ -1,10 +1,10 @@ =head1 NAME -~/.config/pkg/pkg.conf - L<pkg>(1) configuration +~/.config/caretaker/caretaker.conf - L<ct>(1) configuration =head1 DESCRIPTION -Contains configuration parameters for L<pkg>(1) +Contains configuration parameters for L<ct>(1) The file consists of multiple lines of the form I<parameter>=I<value>. @@ -16,7 +16,7 @@ reasonable (so I hope) defaults. =head1 OPTIONS -The text in (braces) refers to the pkg commandline option with which the config +The text in (braces) refers to the ct commandline option with which the config setting may be overridden (if present). The text in [these braces] is the default value. @@ -36,7 +36,7 @@ In the default, $PKG_PATH means the path component of $PKG_ROOT. If true, B<PKLIST_PATH> will always be executed on the local machine, regardless of where the B<PKG_ROOT> lies. For possible uses of this setting, see -L<pkg(7)/"THE PACKAGE LIST"> +L<caretaker(7)/"THE PACKAGE LIST"> =item B<PKG_DIR>=I<path> (--packagedir I<path>) [$HOME/packages] @@ -64,22 +64,22 @@ Operate in debug mode if 1 =item B<AUTOUPDATE>=I<boolean> (--auto-update) [1] -If 1, automatically execute 'pkg update' before 'pkg push' -and 'pkg remote-update' before 'pkg upgrade' +If 1, automatically execute 'ct update' before 'ct push' +and 'ct remote-update' before 'ct upgrade' =item B<GIT_USE_ORIGIN>=I<boolean> [1] -By default, pkg will simply issue a git push/pull, so that git will use the +By default, caretaker will simply issue a git push/pull, so that git will use the repository's origin to determine where to push/pull. If you regularly change your PKG_ROOT, are too lazy to properly configure your -git repos or whatever, set this to 0. Then, pkg will always call git pull/push +git repos or whatever, set this to 0. Then, caretaker will always call git pull/push with both the remote repo and the branch as arguments. =item B<function pkg_hook_>I<hook> {I<content>} Define the global hook I<hook>, its I<content> will be executed -together with pkg's global hooks; the name of the package for which the hook is +together with caretaker's global hooks; the name of the package for which the hook is being executed will be given as first parameter and is accessible throug B<$1>. The hook is just a zsh function, so you can use any valid syntax you want, including newlines. @@ -111,4 +111,4 @@ Colour for warning and error messages (default: red) =head1 SEE ALSO -L<pkg>(1), L<checklinks>(1) +L<ct>(1), L<checklinks>(1) diff --git a/man/7/pkg-setup.pod b/man/7/caretaker-setup.pod index 1c0d7bf..d59a0a2 100644 --- a/man/7/pkg-setup.pod +++ b/man/7/caretaker-setup.pod @@ -1,17 +1,17 @@ =head1 NAME -pkg - Package root setup +caretaker - Package root setup =head1 PACKAGE ROOT First, you'll need to create a root directory (from now on PKG_ROOT) on the server which shall from now on host all your packages. -Then you need to put the pkg git repository into F<PKG_ROOT/pkg> - it's recommended +Then you need to put the caretaker git repository into F<PKG_ROOT/caretaker> - it's recommended to do this via git clone --bare. Copy the pkglist script (include/pkglist) to F<PKG_ROOT/pkglist>. Now you can add your own packages as git repos in PKG_ROOT. -To use pkg with your packages on a machine, download and execute +To use caretaker with your packages on a machine, download and execute the bootstrap script (include/bootstrap). diff --git a/man/7/pkg.pod b/man/7/caretaker.pod index 8288b54..bbef02d 100644 --- a/man/7/pkg.pod +++ b/man/7/caretaker.pod @@ -1,12 +1,12 @@ =head1 NAME -pkg - distributed dotfile and script manager, package format +caretaker - distributed dotfile and script manager, package format =head1 INTRO (if you prefer technical infos over historical blah-blah, skip this section) -Actually, pkg is just a pimped dotfile manager, which just happens to support +Actually, caretaker is just a pimped dotfile manager, which just happens to support a sort of packages, version control, automatic sym- and hardlinking, and which can also handle scripts and binaries. Oh, and it can cause serious brain damage. @@ -18,10 +18,10 @@ you could, if you wanted to) =head1 THE BASICS -pkg requires two directories in your home directory. B<~/bin> contains +caretaker requires two directories in your home directory. B<~/bin> contains symlinks to the executables shipped with your packages, and $PKG_DIR (B<~/packages> by default) contains the -packages themselves. B<~/bin> may also contain normal executables; pkg will +packages themselves. B<~/bin> may also contain normal executables; caretaker will not overwrite existing files. =head1 THE PACKAGE DIRECTORY @@ -36,32 +36,32 @@ It also contains a special directory, F<.collected> - see L</"COLLECTED PACKAGE All directories in $PKG_DIR must be valid git repositories which are not in the state of 'initial commit'. Dotfiles (directories starting with a .) are exempt -from this, they will be ignored by pkg. +from this, they will be ignored by caretaker. =head1 THE PACKAGE ROOT -The packages_root, in pkg referred to as $PKG_ROOT, is structured just like +The packages_root, in caretaker referred to as $PKG_ROOT, is structured just like the packages directory $PKG_DIR, except that it neither contains .list nor -.list-remote. The packages root is the central point where pkg fetches +.list-remote. The packages root is the central point where caretaker fetches packages from and pushes packages to. The package root should contain the pkglist script shipped in include/. -If it doesn't, PKGLIST_PATH in .pkg.conf must be set to the appropiate +If it doesn't, PKGLIST_PATH in .caretaker.conf must be set to the appropiate location on the package root host. =head1 THE PACKAGE LIST The package list lives in the files B<.list> and B<.list-remote> mentioned above. It's used to decide whether a package needs to be pulled / pushed. -Also, the 'pkg add' completion relies on .list-remote, and back in the days when -pkg supported more than one DVCS, it was used to determine which DVCS to use +Also, the 'caretaker add' completion relies on .list-remote, and back in the days when +caretaker supported more than one DVCS, it was used to determine which DVCS to use for which package. It consists of one line per package, each line containing three items separated by a single whitespace. The first item is the package name, the second one the repository type (DVCS), the third the current revision. Example: - pkg git 82d716d01dee0329af7df5e67b55558fe3ff1466 + caretaker git 82d716d01dee0329af7df5e67b55558fe3ff1466 The package list is generated by the script set in the config var $PKGLIST_PATH, by default F<include/pkglist>. Depending on $PKGLIST_LOCAL and $PKG_ROOT, it @@ -76,13 +76,13 @@ remote package list without having to use ssh. =head1 WHAT IS A PACKAGE? -Anything tracked with git can be used as package. However, as the purpose of pkg +Anything tracked with git can be used as package. However, as the purpose of caretaker is not to do your version control, you probably want to have at least one of the files and directories described below in it. =head1 PACKAGE STRUCTURE -Special (as in, mostly handled by pkg) directories and files in a package. +Special (as in, mostly handled by caretaker) directories and files in a package. Note that all files and directories mentioned here are optional. @@ -91,7 +91,7 @@ Note that all files and directories mentioned here are optional. =item bin/ The place for executables to be in the user's PATH. -pkg will automatically create symlinks in F<~/bin> pointing to the files +caretaker will automatically create symlinks in F<~/bin> pointing to the files in the package's F<bin/>. Also, if a file in F<bin/> contains valid POD, a manual will be generated out of it (see L</"COLLECTED PACKAGE FILES">) @@ -109,7 +109,7 @@ Scripts used by the package that don't belong into B<bin/>. Not treated speciall =item man/ -Manual files in POD format, separated by section (like man/7/pkg.pod). +Manual files in POD format, separated by section (like man/7/caretaker.pod). To be prepared for possible future support of other manual formats, it is recommended to postfix each file with .pod @@ -119,7 +119,7 @@ Files for inclusion into other packages. See L</"PROVIDES"> =item description -Package description for B<pkg info> +Package description for B<ct info> =item links @@ -128,7 +128,7 @@ Sym- and hardlink descriptions. See checklinks(1) =item Makefile If a Makefile is available, C<make> will be executed every time the package -is updated (pkg add/push/pull/refresh) +is updated (ct add/push/pull/refresh) =item prereqs @@ -144,7 +144,7 @@ Packages with a priority above 3 require user confirmation to be removed =head1 PREREQUISITES The prerequisites are stored in a package in the file F<prereqs>. -It as an ordinary shell script which is sourced by pkg's global post-update +It as an ordinary shell script which is sourced by caretaker's global post-update hook; so it will be sourced after pulling, pushing or refreshing a package. Note that the file will be sourced in function scope. It is recommended to @@ -177,12 +177,12 @@ Mark I<package> for installation Execute expression and automatically warn if it fails. In case of B<depend package>, automatically mark B<package> for installation if it isn't installed. -If a B<depend> fails, pkg will inform the user about it and wait for confirmation +If a B<depend> fails, caretaker will inform the user about it and wait for confirmation =item B<recommend> I<...>, B<suggest> I<...> Take the same arguments as B<depend>, but are of lower priority. -recommend only causes "info" messages, and suggest does not interrupt pkg +recommend only causes "info" messages, and suggest does not interrupt caretaker to make sure it's read by the user =back @@ -190,7 +190,7 @@ to make sure it's read by the user Additionally, the string parameters B<warn> and B<info> can be used to store messages. -After executing the prereqs script, pkg will print the content of +After executing the prereqs script, caretaker will print the content of these parameters and wait for confirmation. It will also offer to install packages marked by B<depend package> or B<recommend package>. @@ -206,7 +206,7 @@ of that hook to do something useful with the data in F<provides/>. =head1 HOOKS Hooks are little zsh snippets residing in $PKG_DIR/hooks -which are sourced from within pkg whenever needed. +which are sourced from within caretaker whenever needed. Currently, the following hooks exist: @@ -214,17 +214,17 @@ Currently, the following hooks exist: =item post-add -Sourced after a package was installed (e.g. with pkg add/pkg install) +Sourced after a package was installed (e.g. with ct add/ct install) =item post-update -Sourced after a package was updated (pkg pkg pull). +Sourced after a package was updated (ct pull). It is also sourced when adding a package (after post-add) and -when calling pkg refresh. +when calling ct refresh. =item pre-remove -Sourced before a package is removed (pkg remove) +Sourced before a package is removed (ct remove) =back @@ -233,7 +233,7 @@ Sourced before a package is removed (pkg remove) These files reside in F<$PKG_DIR/.collected> (subject to change). The directory is somewhat similar to F<~/bin> - it is automatically populated -by pkg. However, this one does not contain symlinks. +by caretaker. However, this one does not contain symlinks. Currently, it only contains the directory F<man/>, which holds the "compiled" manual pages from the packages (extracted from F<bin/> and F<man/>). @@ -242,10 +242,10 @@ provided by packages. =head1 GIT -B<pkg> uses git(1) as backend for storing and syncing package information. +B<caretaker> uses git(1) as backend for storing and syncing package information. It is not recommended to use branches other than "master". While they should work if GIT_USE_ORIGIN is set to 1 (the default), they will -most likely confuse pkg. +most likely confuse caretaker. =head1 AUTHOR @@ -253,4 +253,4 @@ Daniel Friesel E<lt>derf@derf.homelinux.orgE<gt> =head1 SEE ALSO -checklinks(1), pkg(1) +checklinks(1), ct(1) diff --git a/provides/zsh/alias b/provides/zsh/alias deleted file mode 100644 index b2517bc..0000000 --- a/provides/zsh/alias +++ /dev/null @@ -1 +0,0 @@ -alias ct=pkg diff --git a/provides/zsh/completions/_pkg b/provides/zsh/completions/_ct index 36f0081..c0af61b 100644 --- a/provides/zsh/completions/_pkg +++ b/provides/zsh/completions/_ct @@ -1,50 +1,47 @@ -#compdef pkg +#compdef ct ## vim:ft=zsh -## pkg completion -## Daniel Friesel <derf@derf.homelinux.org> -## https://derf.homelinux.org/~derf/dotfiles/zsh/completions/_pkg -## see also: https://derf.homelinux.org/~derf/code/lighty-stats +## caretaker completion typeset expl -function _pkg_action () { +function _ct_action () { _wanted action expl 'action' \ compadd add eval remove info list \ log pull push refresh status update } -function _pkg_installed () { +function _ct_installed () { _wanted package expl 'local package' \ - compadd $(pkg list local) + compadd $(ct list local) } -function _pkg_all () { +function _ct_all () { _wanted package expl 'package' \ - compadd $(pkg list all) + compadd $(ct list all) } -function _pkg_notinstalled () { +function _ct_notinstalled () { _wanted package expl 'remote package' \ - compadd $(pkg list not-installed) + compadd $(ct list not-installed) } -function _pkg_args { +function _ct_args { if (( CURRENT == 2 )) { case ${words[1]} in l|log|f|pull|p|push|r|refresh|rm|remove|s|status) - _pkg_installed + _ct_installed ;; i|info) - _pkg_all + _ct_all ;; a|add) - _pkg_notinstalled + _ct_notinstalled ;; e|eval) _message 'shell code for evaluation' _wanted function expl 'internal function' \ - compadd $(grep -E '^\S*\s*\(\)\s*{' =pkg | cut -d ' ' -f 1) \ - $(grep -E 'function \S* (\(\) )?{' =pkg | cut -d ' ' -f 2) + compadd $(grep -E '^\S*\s*\(\)\s*{' =ct | cut -d ' ' -f 1) \ + $(grep -E 'function \S* (\(\) )?{' =ct | cut -d ' ' -f 2) ;; ls|list) _wanted something expl 'list mode' \ @@ -63,7 +60,7 @@ function _pkg_args { if (( CURRENT == 3 )) { case ${words[2]} in exec_hook|check_prereqs|*_collected|) - _pkg_installed + _ct_installed ;; esac } elif (( CURRENT == 4 )) { @@ -88,5 +85,5 @@ _arguments \ '--no-colours[No colours]' \ '--progress[show progress bar]' \ '--no-progress[No progress bar]' \ - ':action:_pkg_action' \ - '*::arguments:_pkg_args' + ':action:_ct_action' \ + '*::arguments:_ct_args' @@ -1,11 +1,11 @@ ## vim:ft=zsh -echo "# pkg add (ok)" -pkg add $repo +echo "# ct add (ok)" +ct add $repo [[ -e $test_pdir/$repo/foo ]] [[ -d $test_pdir/$repo/.git ]] -echo "# pkg add (already installed)" -! pkg add $repo +echo "# ct add (already installed)" +! ct add $repo echo "# populate_collected" [[ -L $test_home/bin/$file ]] @@ -13,9 +13,9 @@ echo "# populate_collected" [[ -e $test_pdir/.collected/man/man2/$file.2 ]] repeat 2 { - echo "# pkg list" - stringcmp "pkg\n$repo" "$(pkg list local)" - stringcmp "$complement\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)" - stringcmp "pkg\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)" - pkg update + echo "# ct list" + stringcmp "caretaker\n$repo" "$(ct list local)" + stringcmp "$complement\nrb\nrb-bare\nrc\nrc-bare" "$(ct list not-installed)" + stringcmp "caretaker\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(ct list remote)" + ct update } @@ -3,7 +3,7 @@ unset -m 'GIT_*' 'XDG_*' setopt err_exit trap "print -P '\n%N:%i: %B%F{red}Test faild!%F{default}%b'" ZERR -alias pkg='pkg --quiet --no-colours' +alias ct='ct --quiet --no-colours' source test/documentation @@ -31,39 +31,39 @@ source $tests/checklinks (source $tests/setup) echo "# bootstrapping PKG_DIR" -$test_proot/pkg/include/bootstrap $test_proot $test_pdir +$test_proot/caretaker/include/bootstrap $test_proot $test_pdir echo "# checking for success" -[[ -e $test_home/.config/pkg/pkg.conf ]] -[[ -d $test_proot/pkg ]] -[[ -d $test_pdir/pkg ]] -[[ -L $test_home/bin/pkg ]] +[[ -e $test_home/.config/caretaker/caretaker.conf ]] +[[ -d $test_proot/caretaker ]] +[[ -d $test_pdir/caretaker ]] +[[ -L $test_home/bin/ct ]] [[ -L $test_home/bin/checklinks ]] -[[ -x $(readlink $test_home/bin/pkg) ]] +[[ -x $(readlink $test_home/bin/ct) ]] [[ -x $(readlink $test_home/bin/checklinks) ]] -[[ -e $test_pdir/.collected/man/man1/pkg.1 ]] -[[ -e $test_pdir/.collected/man/man5/pkg.conf.5 ]] -[[ -e $test_pdir/.collected/man/man7/pkg.7 ]] +[[ -e $test_pdir/.collected/man/man1/ct.1 ]] +[[ -e $test_pdir/.collected/man/man5/caretaker.conf.5 ]] +[[ -e $test_pdir/.collected/man/man7/caretaker.7 ]] -echo "# pkg list local" -stringcmp "pkg" "$(pkg list)" -stringcmp "pkg" "$(pkg list local)" +echo "# ct list local" +stringcmp "caretaker" "$(ct list)" +stringcmp "caretaker" "$(ct list local)" -echo "# pkg list not-installed" -stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)" +echo "# ct list not-installed" +stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(ct list not-installed)" -echo "# pkg list all" -stringcmp "pkg\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list all)" +echo "# ct list all" +stringcmp "caretaker\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(ct list all)" -echo "# pkg add (no such repo)" -! pkg add weltfrieden +echo "# ct add (no such repo)" +! ct add weltfrieden -echo "# pkg add (already installed)" -! pkg add pkg +echo "# ct add (already installed)" +! ct add caretaker for conf_origin in 0 1; { echo "## GIT_USE_ORIGIN=$conf_origin" - echo "GIT_USE_ORIGIN=$conf_origin" >> $test_home/.config/pkg/pkg.conf + echo "GIT_USE_ORIGIN=$conf_origin" >> $test_home/.config/caretaker/caretaker.conf for repo in ra ra-bare; { file=${repo%-*} if [[ $repo == *-bare ]] { @@ -1,6 +1,6 @@ ## vim:ft=zsh if [[ $repo == $file ]] { - echo "# pkg pull" - pkg pull + echo "# ct pull" + ct pull [[ -f $pkgdir/$repo/baz ]] } @@ -3,7 +3,7 @@ somefile=$RANDOM touch $somefile git add $somefile git commit --quiet -m $somefile -pkg push +ct push if [[ $repo == *-bare ]] { [[ $(git --git-dir=$test_proot/$repo log --pretty=oneline | head -1) == *$somefile ]] } else { diff --git a/test/remove b/test/remove index e850ec0..f895e60 100644 --- a/test/remove +++ b/test/remove @@ -1,19 +1,19 @@ ## vim:ft=zsh -echo "# pkg remove (not installed/nonexistent)" -! pkg remove suckage -! pkg remove rb +echo "# ct remove (not installed/nonexistent)" +! ct remove suckage +! ct remove rb -echo "# pkg remove (ok)" -pkg remove $repo +echo "# ct remove (ok)" +ct remove $repo echo "# genocide_collected (~/bin)" [[ ! -L $test_home/bin/$file ]] [[ ! -e $test_pdir/.collected/man/man2/$file.2 ]] repeat 2 { - echo "# pkg list" - stringcmp "pkg" "$(pkg list local)" - stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list not-installed)" - stringcmp "pkg\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(pkg list remote)" - pkg update + echo "# ct list" + stringcmp "caretaker" "$(ct list local)" + stringcmp "ra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(ct list not-installed)" + stringcmp "caretaker\nra\nra-bare\nrb\nrb-bare\nrc\nrc-bare" "$(ct list remote)" + ct update } @@ -1,8 +1,8 @@ ## vim:ft=zsh echo "# setting up PKG_ROOT" cd $test_proot -git clone --quiet ${1-git://git.tabularazor.org/~derf/pkg} pkg -cp pkg/include/pkglist pkglist +git clone --quiet ${1-git://git.tabularazor.org/~derf/caretaker} caretaker +cp caretaker/include/pkglist pkglist for repo in ra rb rc; ( mkdir $repo cd $repo |