在Pharo中为给定日期加载包的版本

时间:2016-04-12 13:01:28

标签: pharo monticello metacello

我正在寻找一种方法,在给定包名称的情况下,加载该包的版本,该版本是给定日期的最新版本。

例如:

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

将加载早于2015年3月12日的'Athens-Core'的第一次提交。

1 个答案:

答案 0 :(得分:2)

以下脚本如何?它应该在给定日期之前检测第一个版本。

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 ]
相关问题