Adding Cleanup Support To NuGet Upgrading

Adding support for the bot itself to store which packages in which directories to delete, and for the wrapper and executable itself to facilitate the deletion of those packages from disk once the bot's AppDomain no longer has a lock on the relevant files.

Tested on our internal mmbot scripts NuGet package, and w/ the HipChat adapter.  I also tested under the condition that the reset event gets invoked in some other manner, which would cause the brain to not contain the delete list.

I'm pretty certain the logic is solid.  The only thing I can think of that would break it is if a NuGet package does not use a monotonicly increasing versioning scheme, so even YYYYMMDD style versioning should work.  It looks like nothing the adapters or my packages are dependent on use anything but SemVer, and that is the standard anyway (NuGet core pretty heavily uses SemVer in it's implementation, with a fallback to other things).

This would resolve #170 and resolve #159.
Hmmm. You are right, however, due to the file locking model, it is
infeasible. That is the road i initially went down, but coudlnt resolve
file locking before appdomain release and not having a brain until resolve
and file lock.

Open to more ideas on how to do this however.
On Nov 17, 2014 3:44 PM, "Andreas Öhlund" <notifications@github.com> wrote:

> In mmbot/Program.cs:
>
> > @@ -76,9 +96,23 @@ public void Start(Options options)
> >                  Environment.Exit(-1);
> >              }
> >
> > +            robot.On<bool>(Robot.ResetEventName,
> > +                     (b) =>
> > +                         {
> > +                             var getDirsToDelete = robot.Brain.Get<List<string>>(NuGetScripts.NugetFoldersToDeleteSetting);
>
> Shouldn't this be called every time the bot start? if not it will only
> happen when the user calls mmbot update {package} restart
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mmbot/mmbot/pull/176/files#r20463604>.
>