Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running crystal deps after modifying shards.yml does not update the installed version #107

Closed
spalladino opened this issue May 26, 2016 · 4 comments
Labels
Milestone

Comments

@spalladino
Copy link

On a fresh project, I create a shard.yml with the following dependencies:

dependencies:
  pg:
    github: will/crystal-pg
    commit: cafe4748b64a9c95ab93b4c19315780e8e254291

Running crystal deps installs the correct version, and creates a shard.lock with the expected contents:

$ crystal deps
Updating https://github.com/will/crystal-pg.git
Installing pg (cafe4748b64a9c95ab93b4c19315780e8e254291)
shards:
  pg:
    github: will/crystal-pg
    commit: cafe4748b64a9c95ab93b4c19315780e8e254291

Now, if I want to update to a specific version, let's say version: 0.7.1, and I modify both the shard.yml and the shard.lock accordignly, when I run crystal deps again I get a message stating that I'm using version 0.7.1, but the actual contents in the libs folder is still behind in commit cafe474.

$ crystal deps
Updating https://github.com/will/crystal-pg.git
Using pg (0.7.1)

I'm not sure if this is the expected way of updating dependencies. However, the output message is definitely quite confusing, as it led me to think that I was actually using version 0.7.1, which did not get installed until I deleted the dependencies folders and installed them again.

@jhass jhass added the kind:bug label May 26, 2016
@ysbaddaden
Copy link
Contributor

Does the shard.yml of the dependency at this commit states that it's version 0.7.1? Shards won't reinstall if the installed version is the one to be installed (notice that it prints "using" instead of "installing").

That being said, Shards should detect that the pointed commits are different, and thus reinstall the dependency accordingly, or just always install the dependencies.

Note that to update a dependency, you should update shard.yml then run crystal deps update instead. This will resolve the dependencies again and always install them. This is by design: install resolves dependencies once (if shard.lock is missing) than always install the same versions as defined in shard.lock and fail if something changed, whereas update doesn't care about the shard.lock presence, and always resolves, installs and updates the lock.

@spalladino
Copy link
Author

Commit cafe474 is older than tag 0.7.1; tag 0.7.1 is at commit cafe2eb, and the shard.yml correctly states that it is version 0.7.1 (see https://github.com/will/crystal-pg/blob/v0.7.1/shard.yml).

Thanks for the explanation on the difference between install/update, that helps a lot. The main issue, however, is that shards indicated that the version in use was 0.7.1 after running crystal deps, while the code in libs was actually a different version.

@ysbaddaden
Copy link
Contributor

The commit states version 0.5.0 in its shard.yml so there indeed is a broader bug. I think I'll just reinstall always for the time being.

@ysbaddaden
Copy link
Contributor

Fixed in 54b8003

f-fr pushed a commit to f-fr/shards that referenced this issue Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants