On Wed, Sep 4, 2019 at 7:22 AM Fernando Santagata <nando.santag...@gmail.com> wrote: > > On Wed, Sep 4, 2019 at 4:07 PM Tom Browder <tom.brow...@gmail.com> wrote: >> >> On Wed, Sep 4, 2019 at 05:53 Fernando Santagata <nando.santag...@gmail.com> >> wrote: >>> >>> >>> On Wed, Sep 4, 2019 at 12:21 PM William Michels <w...@caa.columbia.edu> >>> wrote: >>>> >>>> Hi Fernando, I'm not sure I understand. Is this for module >>>> development? And you want to purge old versions of a module you're >>>> developing, before doing a 'git push'? >> >> >> I have never had a problem with: >> >> cd my-module >> zef install . >> zef uninstall My::Module > > > I was trying to do that automatically from a git pre-push hook. > > I opened an "issue", actually a feature request, in the zef repository on > GitHub. I received some suggestions and right now my pre-push script looks > like this: > > #/bin/sh > > zef uninstall "$(perl6 -MJSON::Fast -e 'my $meta = from-json slurp > ”META6.json”; say $meta<name>, $meta<auth> ?? ”:auth<$meta<auth>>” !! ””, > $meta<version> ?? ”:ver<$meta<version>>” !! ””')" > zef install . --force-install > > which is not exactly "clean." What I mean is that zef is able to read the > META6.json file, because it does it when it installs a module from a > directory using "zef install .". It might do the same when asked to uninstall > what's in a certain directory, using something along the lines of "zef > uninstall .". > > -- > Fernando Santagata
Just throwing out ideas here... when you install your module, you could capture and store the SHA1 of your module in the target directory (presumably some variation of /Users/fernando/rakudo/rakudo-2019.07.1/install/share/perl6/site/dist/...). Of course, you have to be sure you capture the SHA1 from your module and not from any dependencies installed at the same time. Then when you want to uninstall, you look up your module by SHA1 and uninstall via the SHA1 and/or associated module name. Or skip zef uninstall and just "rm" the file: https://github.com/ugexe/zef > locate [$identity, $name-path, $sha1-id] > Options > # The argument is a sha1-id (otherwise assumed to be an identity or name-path) > --sha1 > Lookup a locally installed module by $identity, $name-path, or $sha1-id > $ zef --sha1 locate A9948E7371E0EB9AFDF1EEEB07B52A1B75537C31 > ===> From Distribution: zef:ver<*>:auth<github:ugexe>:api<> > lib/Zef/CLI.pm6 => > ~/rakudo/install/share/perl6/site/sources/A9948E7371E0EB9AFDF1EEEB07B52A1B75537C31 Also, have you looked at Tadzik's ShellCommand module? You might be able to come up with a "pure Perl6" solution to your issue! https://github.com/tadzik/Shell-Command HTH, Bill.