crystal-lang / shards

Dependency manager for the Crystal language
Other
765 stars 102 forks source link

Unable to install shard with specific version #442

Open pyrsmk opened 4 years ago

pyrsmk commented 4 years ago

I want to install a shard by its version but it does not work (maybe this is because there is only one tag on the repo? or that is not an annotated tag?).

Here's what I have in my shard.yml:

dependencies:
  origin:
    github: pyrsmk/origin
    version: ~> 0.1.0

And the issue:

❯ shards install
Resolving dependencies
Fetching https://github.com/pyrsmk/origin.git
Unable to satisfy the following requirements:

- `origin (~> 0.1.0)` required by `shard.yml`
Failed to resolve dependencies

It does not work either if I set explicitly the version:

dependencies:
  origin:
    github: pyrsmk/origin
    version: 0.1.0

But if I remove the version constraint, the shard installs as expected:

❯ shards install
Resolving dependencies
Fetching https://github.com/pyrsmk/origin.git
Installing origin (0.1.0 at 2a3f364)
Writing shard.lock

For simplicity, here's the relevant repository: https://github.com/pyrsmk/origin

asterite commented 4 years ago

I think the tag must be v0.1.0 instead of 0.1.0.

Which, in my opinion, is very unintuitive, but 🤷

bcardiff commented 4 years ago

That's right, shards looks for v{version} tags only as convention.

pyrsmk commented 4 years ago

Maybe it should be somewhere in the docs or, better, we could support both syntaxes? Because it's not uncommon that tags are defined as X.X.X instead of vX.X.X.

straight-shoota commented 4 years ago

I don't think there's any benefit from supporting tags both with and without v prefix. It just adds confusion. We settled on v prefix for tags and that's it. Just use it that way. However, this needs to be properly documented. Currently the spec only covers spec.yml and there's no specification for git integration.