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.
Do we gain much by using the brain?

Would it work if we:

1. Dumped the "folder to remove" into package-cleanup.txt
2. On start up read that file, and deleted the mentioned folders
3. Delete the file package-cleanup.txt file

Thoughts?

On Mon, Nov 17, 2014 at 9:51 PM, jamesbascle <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);
>
> 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.
> … <#149bf8615487328d_>
> 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>.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mmbot/mmbot/pull/176/files#r20463952>.
>