如何使用依赖于基线的#development版本定义ConfigurationOf?

时间:2013-04-02 11:15:35

标签: smalltalk pharo squeak metacello

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

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不是#development {notDevelopmentVersion} [#validateVersionSpecForSymbolicVersion:symbolicVersion:]
  • 警告:仅定义基线(未定义版本)。 {onlyBaselineVersion} [#validatePragmas]

3 个答案:

答案 0 :(得分: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始终指向最新版本。

这应避免第一次警告。我想,只要您没有发布版本,就可以安全地忽略第二个警告。

答案 1 :(得分: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'].

答案 2 :(得分: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'.