Search code examples
pharomonticellometacello

Load version of package for a given date in Pharo


I am looking for a way to, given a package name, load a version of that package that was the newest version at a given date.

For example:

HypotheticalClassLoader loadPackage: 'Athens-Core' onDate: ('12.03.2015' asDate).

Would load the first commit of 'Athens-Core' that is older than 12.03.2015.


Solution

  • What about the following script. It should detect the first version before a given date.

    goferReferences := Gofer new
       url: 'http://smalltalkhub.com/mc/Pharo/Athens/main';
       package: 'Athens-Core'
       constraint: [ :goferReference |
          goferReference version info date < '12 June 2015' asDate];
       resolved.
    
    goferReferences ifNotNil: [
       Gofer new
          url: 'http://smalltalkhub.com/mc/Pharo/Athens/main';
          version: goferReferences first name;
          load ]