Search code examples
githubpharometacello

Metacello dependency on a package from github project


How can one depend directly on a package from a github repo? (Assuming the project has no baseline, or there is a reason not use the baseline.)

I've tried the following spec

spec
    package: 'Magritte-XMLBinding'
    with: [ spec
        repository: 'github://magritte-metamodel/XML-Bindings:master/repository' ].

However it failed (Could not resolve: Magritte-XMLBinding [Magritte-XMLBinding.package]), and in Monticello browser under the repo I see only Magritte-Tests-XMLBinding.

What is more, when I look at the unpacked repo (in github-cache/), only the Magritte-Tests-XMLBinding has been unzipped.

The unpacked Tests package is the first in alphabetical order, which makes me feel like Metacello spec just grabs the first package without thinking.


Solution

  • When using git (and github), you cannot depend on packages but in complete projects. You can, however, depend on a project but load just one package of that project. normally this definition should work:

    spec
        baseline: 'XMLBindings'
        with: [ 
           spec
              repository: 'github://magritte-metamodel/XML-Bindings:master/repository';
              loads: #('Magritte-XMLBinding') ].
    

    However, while this answer is correct in general, in this case it will not work because the author of the project didn't included any baseline definition that would allow this kind of dependency definition to work, which suggests me he just uses that project as a mirror of the real one... so here you have three possible solutions:

    1. send a pull request to author with a baseline
    2. contact the project author and ask to add a baseline
    3. use the original source instead the github mirror