zef uninstall .

--00000000000008000f0591b5aa44
Content-Type: text/plain; charset="UTF-8"

Hello,

apparently there's no analogous of "zef install ." to uninstall a module,
i.e. an "anonymous" way to do it.

The problem that I'm trying to solve is to automatically uninstall and
reinstall a module before a "git push". In order to do this I'm using the
git pre-push hook.
So far my pre-push script is just:

zef install . --force-install

but now I'm thinking that it's not enough and I'd like to uninstall the
current module and then re-install it.
To do that I need a way to uninstall an "anonymous" module, something along
the lines of "zef uninstall .".

Any idea?

-- 
Fernando Santagata

--00000000000008000f0591b5aa44
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"color:#000000">Hello=
,</div><div class=3D"gmail_default" style=3D"color:#000000"><br></div><div =
class=3D"gmail_default" style=3D"color:#000000">apparently there&#39;s no a=
nalogous of &quot;zef install .&quot; to uninstall a module, i.e. an &quot;=
anonymous&quot; way to do it.</div><div class=3D"gmail_default" style=3D"co=
lor:#000000"><br></div><div class=3D"gmail_default" style=3D"color:#000000"=
>The problem that I&#39;m trying to solve is to automatically uninstall and=
 reinstall a module before a &quot;git push&quot;. In order to do this I&#3=
9;m using the git pre-push hook.</div><div class=3D"gmail_default" style=3D=
"color:#000000">So far my pre-push script is just:</div><div class=3D"gmail=
_default" style=3D"color:#000000"><br></div><div class=3D"gmail_default" st=
yle=3D"color:#000000">zef install . --force-install</div><div class=3D"gmai=
l_default" style=3D"color:#000000"><br></div><div class=3D"gmail_default" s=
tyle=3D"color:#000000">but now I&#39;m thinking that it&#39;s not enough an=
d I&#39;d like to uninstall the current module and then re-install it.</div=
><div class=3D"gmail_default" style=3D"color:#000000">To do that I need a w=
ay to uninstall an &quot;anonymous&quot; module, something along the lines =
of &quot;zef uninstall .&quot;.</div><div class=3D"gmail_default" style=3D"=
color:#000000"><br></div><div class=3D"gmail_default" style=3D"color:#00000=
0">Any idea?<br></div><br>-- <br><div dir=3D"ltr" class=3D"gmail_signature"=
 data-smartmail=3D"gmail_signature">Fernando Santagata</div></div>

--00000000000008000f0591b5aa44--
0
nando
9/4/2019 8:05:00 AM
perl.perl6.users 1217 articles. 0 followers. Follow

5 Replies
7 Views

Similar Articles

[PageSpeed] 28

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'm not sure about an anonymous uninstall in the pwd ("."), but there
might be a way to set up a separate 'DevDir', and then use the 'nuke'
command to only delete paths in--and/or--to that directory.

https://github.com/ugexe/zef

nuke [RootDir | TempDir | StoreDir]
Deletes all paths in the specific configuration directory

nuke [site | home]
Deletes all paths that are rooted in the prefix of the matching
CompUnit::Repository name

# uninstall all modules
$ zef nuke site home

HTH, Bill.






On Wed, Sep 4, 2019 at 1:05 AM Fernando Santagata
<nando.santagata@gmail.com> wrote:
>
> Hello,
>
> apparently there's no analogous of "zef install ." to uninstall a module, i.e. an "anonymous" way to do it.
>
> The problem that I'm trying to solve is to automatically uninstall and reinstall a module before a "git push". In order to do this I'm using the git pre-push hook.
> So far my pre-push script is just:
>
> zef install . --force-install
>
> but now I'm thinking that it's not enough and I'd like to uninstall the current module and then re-install it.
> To do that I need a way to uninstall an "anonymous" module, something along the lines of "zef uninstall .".
>
> Any idea?
>
> --
> Fernando Santagata
0
perl6
9/4/2019 10:20:28 AM
--000000000000012a6f0591b802de
Content-Type: text/plain; charset="UTF-8"

On Wed, Sep 4, 2019 at 12:21 PM William Michels <wjm1@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'?
>

Yes, it's for module development.
What I do is to actually install, not just test, my module before pushing
it to GitHub.
Usually all my test programs have a "use lib 'lib'" to make sure to use the
present version of the module to test itself.
Though if I miss a "use lib 'lib'" maybe the installed module is used, so I
want to uninstall it before the reinstall.


> I'm not sure about an anonymous uninstall in the pwd ("."), but there
> might be a way to set up a separate 'DevDir', and then use the 'nuke'
> command to only delete paths in--and/or--to that directory.
>
> https://github.com/ugexe/zef
>
> nuke [RootDir | TempDir | StoreDir]
> Deletes all paths in the specific configuration directory
>
> nuke [site | home]
> Deletes all paths that are rooted in the prefix of the matching
> CompUnit::Repository name
>
> # uninstall all modules
> $ zef nuke site home
>
> HTH, Bill.
>
>
>
>
>
>
> On Wed, Sep 4, 2019 at 1:05 AM Fernando Santagata
> <nando.santagata@gmail.com> wrote:
> >
> > Hello,
> >
> > apparently there's no analogous of "zef install ." to uninstall a
> module, i.e. an "anonymous" way to do it.
> >
> > The problem that I'm trying to solve is to automatically uninstall and
> reinstall a module before a "git push". In order to do this I'm using the
> git pre-push hook.
> > So far my pre-push script is just:
> >
> > zef install . --force-install
> >
> > but now I'm thinking that it's not enough and I'd like to uninstall the
> current module and then re-install it.
> > To do that I need a way to uninstall an "anonymous" module, something
> along the lines of "zef uninstall .".
> >
> > Any idea?
> >
> > --
> > Fernando Santagata
>


-- 
Fernando Santagata

--000000000000012a6f0591b802de
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"g=
mail_attr">On Wed, Sep 4, 2019 at 12:21 PM William Michels &lt;<a href=3D"m=
ailto:wjm1@caa.columbia.edu">wjm1@caa.columbia.edu</a>&gt; wrote:<br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">Hi Fernando, I&#39;m not =
sure I understand. Is this for module<br>
development? And you want to purge old versions of a module you&#39;re<br>
developing, before doing a &#39;git push&#39;?<br></blockquote><div><br></d=
iv><div><div style=3D"color:rgb(0,0,0)" class=3D"gmail_default">Yes, it&#39=
;s for module development.</div><div style=3D"color:rgb(0,0,0)" class=3D"gm=
ail_default">What I do is to actually install, not just test, my module bef=
ore pushing it to GitHub.</div><div style=3D"color:rgb(0,0,0)" class=3D"gma=
il_default">Usually all my test programs have a &quot;use lib &#39;lib&#39;=
&quot; to make sure to use the present version of the module to test itself=
..</div><div style=3D"color:rgb(0,0,0)" class=3D"gmail_default">Though if I =
miss a &quot;use lib &#39;lib&#39;&quot; maybe the installed module is used=
, so I want to uninstall it before the reinstall.<br></div></div><div>=C2=
=A0<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I&#39;m not sure about an anonymous uninstall in the pwd (&quot;.&quot;), b=
ut there<br>
might be a way to set up a separate &#39;DevDir&#39;, and then use the &#39=
;nuke&#39;<br>
command to only delete paths in--and/or--to that directory.<br>
<br>
<a href=3D"https://github.com/ugexe/zef" rel=3D"noreferrer" target=3D"_blan=
k">https://github.com/ugexe/zef</a><br>
<br>
nuke [RootDir | TempDir | StoreDir]<br>
Deletes all paths in the specific configuration directory<br>
<br>
nuke [site | home]<br>
Deletes all paths that are rooted in the prefix of the matching<br>
CompUnit::Repository name<br>
<br>
# uninstall all modules<br>
$ zef nuke site home<br>
<br>
HTH, Bill.<br>
<br>
<br>
<br>
<br>
<br>
<br>
On Wed, Sep 4, 2019 at 1:05 AM Fernando Santagata<br>
&lt;<a href=3D"mailto:nando.santagata@gmail.com" target=3D"_blank">nando.sa=
ntagata@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hello,<br>
&gt;<br>
&gt; apparently there&#39;s no analogous of &quot;zef install .&quot; to un=
install a module, i.e. an &quot;anonymous&quot; way to do it.<br>
&gt;<br>
&gt; The problem that I&#39;m trying to solve is to automatically uninstall=
 and reinstall a module before a &quot;git push&quot;. In order to do this =
I&#39;m using the git pre-push hook.<br>
&gt; So far my pre-push script is just:<br>
&gt;<br>
&gt; zef install . --force-install<br>
&gt;<br>
&gt; but now I&#39;m thinking that it&#39;s not enough and I&#39;d like to =
uninstall the current module and then re-install it.<br>
&gt; To do that I need a way to uninstall an &quot;anonymous&quot; module, =
something along the lines of &quot;zef uninstall .&quot;.<br>
&gt;<br>
&gt; Any idea?<br>
&gt;<br>
&gt; --<br>
&gt; Fernando Santagata<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature">Fernando Santagata</div></div>

--000000000000012a6f0591b802de--
0
nando
9/4/2019 10:52:45 AM
--000000000000f2b8ca0591bab705
Content-Type: text/plain; charset="UTF-8"

On Wed, Sep 4, 2019 at 05:53 Fernando Santagata <nando.santagata@gmail.com>
wrote:

>
> On Wed, Sep 4, 2019 at 12:21 PM William Michels <wjm1@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

-Tom

--000000000000f2b8ca0591bab705
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>On Wed, Sep 4, 2019 at 05:53 Fernando Santagata &lt;<a href=3D"mailto:=
nando.santagata@gmail.com">nando.santagata@gmail.com</a>&gt; wrote:<br></di=
v><div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_att=
r">On Wed, Sep 4, 2019 at 12:21 PM William Michels &lt;<a href=3D"mailto:wj=
m1@caa.columbia.edu" target=3D"_blank">wjm1@caa.columbia.edu</a>&gt; wrote:=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Fernando, I&=
#39;m not sure I understand. Is this for module<br>
development? And you want to purge old versions of a module you&#39;re<br>
developing, before doing a &#39;git push&#39;?</blockquote></div></div></bl=
ockquote><div dir=3D"auto"><br></div><div dir=3D"auto">I have never had a p=
roblem with:</div><div dir=3D"auto"><br></div><div dir=3D"auto">=C2=A0 =C2=
=A0 cd my-module</div><div dir=3D"auto">=C2=A0 =C2=A0 zef install .</div><d=
iv dir=3D"auto">=C2=A0 =C2=A0 zef uninstall My::Module</div><div dir=3D"aut=
o"><br></div><div dir=3D"auto">-Tom</div><div dir=3D"auto"><br></div></div>=
</div>

--000000000000f2b8ca0591bab705--
0
tom
9/4/2019 2:06:47 PM
--000000000000ae05b60591baefc5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Wed, Sep 4, 2019 at 4:07 PM Tom Browder <tom.browder@gmail.com> wrote:

> On Wed, Sep 4, 2019 at 05:53 Fernando Santagata <nando.santagata@gmail.co=
m>
> wrote:
>
>>
>> On Wed, Sep 4, 2019 at 12:21 PM William Michels <wjm1@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 =3D from-json slurp
=E2=80=9DMETA6.json=E2=80=9D; say $meta<name>, $meta<auth> ?? =E2=80=9D:aut=
h<$meta<auth>>=E2=80=9D !! =E2=80=9D=E2=80=9D,
$meta<version> ?? =E2=80=9D:ver<$meta<version>>=E2=80=9D !! =E2=80=9D=E2=80=
=9D')"
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 .".

--=20
Fernando Santagata

--000000000000ae05b60591baefc5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wed, Sep 4, 2019 at 4:07 PM Tom Browder &lt;<a href=3D"=
mailto:tom.browder@gmail.com">tom.browder@gmail.com</a>&gt; wrote:<br><div =
class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px=
 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><di=
v>On Wed, Sep 4, 2019 at 05:53 Fernando Santagata &lt;<a href=3D"mailto:nan=
do.santagata@gmail.com" target=3D"_blank">nando.santagata@gmail.com</a>&gt;=
 wrote:<br></div><div><div class=3D"gmail_quote"><blockquote class=3D"gmail=
_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204=
,204);padding-left:1ex"><div dir=3D"ltr"><br><div class=3D"gmail_quote"><di=
v dir=3D"ltr" class=3D"gmail_attr">On Wed, Sep 4, 2019 at 12:21 PM William =
Michels &lt;<a href=3D"mailto:wjm1@caa.columbia.edu" target=3D"_blank">wjm1=
@caa.columbia.edu</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote"=
 style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);p=
adding-left:1ex">Hi Fernando, I&#39;m not sure I understand. Is this for mo=
dule<br>
development? And you want to purge old versions of a module you&#39;re<br>
developing, before doing a &#39;git push&#39;?</blockquote></div></div></bl=
ockquote><div dir=3D"auto"><br></div><div dir=3D"auto">I have never had a p=
roblem with:</div><div dir=3D"auto"><br></div><div dir=3D"auto">=C2=A0 =C2=
=A0 cd my-module</div><div dir=3D"auto">=C2=A0 =C2=A0 zef install .</div><d=
iv dir=3D"auto">=C2=A0 =C2=A0 zef uninstall My::Module</div></div></div></b=
lockquote><div><br></div><div style=3D"color:rgb(0,0,0)" class=3D"gmail_def=
ault">I was trying to do that automatically from a git pre-push hook.<br></=
div></div><div><br></div><div><div style=3D"color:rgb(0,0,0)" class=3D"gmai=
l_default">I opened an &quot;issue&quot;, actually a feature request, in th=
e zef repository on GitHub. I received some suggestions and right now my pr=
e-push script looks like this:</div><div style=3D"color:rgb(0,0,0)" class=
=3D"gmail_default"><br></div><div style=3D"color:rgb(0,0,0)" class=3D"gmail=
_default">#/bin/sh<br><br>zef uninstall &quot;$(perl6 -MJSON::Fast -e &#39;=
my $meta =3D from-json slurp =E2=80=9DMETA6.json=E2=80=9D; say $meta&lt;nam=
e&gt;, $meta&lt;auth&gt; ?? =E2=80=9D:auth&lt;$meta&lt;auth&gt;&gt;=E2=80=
=9D !! =E2=80=9D=E2=80=9D, $meta&lt;version&gt; ?? =E2=80=9D:ver&lt;$meta&l=
t;version&gt;&gt;=E2=80=9D !! =E2=80=9D=E2=80=9D&#39;)&quot;<br>zef install=
 . --force-install</div><br></div><div><div style=3D"color:rgb(0,0,0)" clas=
s=3D"gmail_default">which is not exactly &quot;clean.&quot; What I mean is =
that zef is able to read the META6.json file, because it does it when it in=
stalls a module from a directory using &quot;zef install .&quot;. It might =
do the same when asked to uninstall what&#39;s in a certain directory, usin=
g something along the lines of &quot;zef uninstall .&quot;.<br></div><br></=
div>-- <br><div dir=3D"ltr" class=3D"gmail_signature">Fernando Santagata</d=
iv></div>

--000000000000ae05b60591baefc5--
0
nando
9/4/2019 2:22:22 PM
On Wed, Sep 4, 2019 at 7:22 AM Fernando Santagata
<nando.santagata@gmail.com> wrote:
>
> On Wed, Sep 4, 2019 at 4:07 PM Tom Browder <tom.browder@gmail.com> wrote:
>>
>> On Wed, Sep 4, 2019 at 05:53 Fernando Santagata <nando.santagata@gmail.c=
om> wrote:
>>>
>>>
>>> On Wed, Sep 4, 2019 at 12:21 PM William Michels <wjm1@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 =3D from-json slurp =E2=
=80=9DMETA6.json=E2=80=9D; say $meta<name>, $meta<auth> ?? =E2=80=9D:auth<$=
meta<auth>>=E2=80=9D !! =E2=80=9D=E2=80=9D, $meta<version> ?? =E2=80=9D:ver=
<$meta<version>>=E2=80=9D !! =E2=80=9D=E2=80=9D')"
> 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 direc=
tory using "zef install .". It might do the same when asked to uninstall wh=
at's in a certain directory, using something along the lines of "zef uninst=
all .".
>
> --
> 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
> =3D=3D=3D> From Distribution: zef:ver<*>:auth<github:ugexe>:api<>
> lib/Zef/CLI.pm6 =3D> ~/rakudo/install/share/perl6/site/sources/A9948E7371=
E0EB9AFDF1EEEB07B52A1B75537C31


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.
0
perl6
9/4/2019 5:38:54 PM
Reply: