6

在 Pharo 中,我想定义一个ConfigurationOfNand2Tetris只有一个包的 Metacello:

ConfigurationOfNand2Tetris>>baseline01: spec
  <version: '0.1-baseline'>

  spec
    for: #common
    do: [ 
      spec
        blessing: #baseline;
        repository: 'http://www.smalltalkhub.com/mc/DamienCassou/Nand2Tetris/main';
        package: 'Nand2Tetris' ]

ConfigurationOfNand2Tetris>>development: spec
  <symbolicVersion: #development>

  spec for: #common version: '0.1-baseline'.

当我执行时,MetacelloToolBox validateConfiguration: ConfigurationOfNand2Tetris我总是收到 2 个警告:

  • 警告:符号版本#development是指一个版本'0.1-baseline',其祝福#baseline不是#development { notDevelopmentVersion } [ #validateVersionSpecForSymbolicVersion:symbolicVersion: ]
  • 警告:仅定义基线(未定义版本)。{ onlyBaselineVersion } [ #validatePragmas ]
4

3 回答 3

6

如果你只想依赖基线,Metacello 中的比喻是使用#bleedingEdge祝福。此外,您可以明确拒绝其他符号版本:

ConfigurationOfNand2Tetris>>baseline01: spec
  <version: '0.1-baseline'>

  spec
    for: #common
    do: [ 
      spec
        blessing: #baseline;
        repository: 'http://www.smalltalkhub.com/mc/DamienCassou/Nand2Tetris/main';
        package: 'Nand2Tetris' ]

ConfigurationOfNand2Tetris>>bleedingEdge: spec
  <symbolicVersion: #bleedingEdge>
  spec for: #common version: '0.1-baseline'.

ConfigurationOfNand2Tetris>>development: spec
  <symbolicVersion: #'development'>
  spec for: #'common' version: #'notDefined'.

ConfigurationOfNand2Tetris>>stable: spec
  <symbolicVersion: #'stable'>
  spec for: #'common' version: #'notDefined'.

这里的想法是,#stable版本#development链接到明确编号的版本,而#bleedingEdge始终指向最新版本。

这应该避免第一次警告。我认为,只要您没有发布版本,您就可以放心地忽略第二个警告。

于 2013-04-02T11:43:59.740 回答
3

通常你会定义你的基线,然后是一个#versionN:方法:

ConfigurationOfNand2Tetris>>version01: spec
  <version: '0.1' imports: #('0.1-baseline')>

  spec
    for: #common do: [ 
      spec
        blessing: #baseline;
        package: 'Nand2Tetris' with: 'Nand2Tetris-yourname.22'].
于 2013-04-02T11:39:56.907 回答
2

我想你忘了实施:

ConfigurationOfNand2Tetris>>version01: spec

<version: '0.1' imports: #('0.1-baseline' )>

spec for: #'common' do: [
    spec blessing: #'development'.
    spec description: 'some description'.
    spec author: 'yourName'.
    spec timestamp: '1/15/2013 16:13'.
    spec  
        package: 'Nand2Tetris' with: 'Nand2Tetris-yourName.versionNumber']

那么你应该改变:

ConfigurationOfNand2Tetris>>development: spec

  <symbolicVersion: #development>

  spec for: #'common' version: '0.1'.
于 2013-04-02T11:41:35.947 回答