diff options
-rw-r--r-- | README.markdown | 3 | ||||
-rwxr-xr-x | bin/plenv-modules-update | 17 |
2 files changed, 20 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 4e1d0851..ca91c984 100644 --- a/README.markdown +++ b/README.markdown @@ -301,6 +301,9 @@ Scripts that don’t actually worry you, exiting with 0 anyway. * `maybe(1)` is like `true(1)` or `false(1)`; given a probability of success, it exits with success or failure. Good for quick tests. +* `plenv-modules-update` retrieves a list of installed modules from + [`plenv`](https://github.com/tokuhirom/plenv), filters out any modules in + `~/.plenv/non-cpan-modules`, and updates them all. * `stbl(1)` strips a trailing blank line from the files in its arguments. * `sue(8)` execs `sudoedit(8)` as the owner of all the file arguments given, perhaps in cases where you may not necessarily have `root` `sudo(8)` diff --git a/bin/plenv-modules-update b/bin/plenv-modules-update new file mode 100755 index 00000000..730db983 --- /dev/null +++ b/bin/plenv-modules-update @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +mf=$(mktemp) || exit +ef=$(mktemp) || exit +cf=$(mktemp) || exit +cleanup() { + rm -f -- "$mf" "$ef" "$cf" +} +trap cleanup EXIT + +plenv list-modules | LANG=C.UTF-8 sort > "$mf" +LANG=C.UTF-8 sort "$HOME"/.plenv/non-cpanm-modules > "$ef" +LANG=C.UTF-8 comm -23 -- "$mf" "$ef" > "$cf" + +while read -r module ; do + cpanm --from http://cpan.inspire.net.nz --notest --quiet -- "$module" +done < "$cf" |