aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-06-20 10:33:47 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-06-20 10:33:47 +1200
commit56ab0f02ad532777d4e06710774526a7cf4e27f5 (patch)
tree2ff58ab61648b80971f02b5f0e74e5f7c65f6ea2
parentUpdate submodules (diff)
downloaddotfiles-56ab0f02ad532777d4e06710774526a7cf4e27f5.tar.gz
dotfiles-56ab0f02ad532777d4e06710774526a7cf4e27f5.zip
Add plenv-modules-update
-rw-r--r--README.markdown3
-rwxr-xr-xbin/plenv-modules-update17
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"