The Crystal Programming Language Forum

Using shards overrides

I want to give the new shard overrides a shot, but I’m not really clear on how to utilize it in this context.

I’m working on some updates for LuckyCLI, but where it gets tricky is, this shard will generate a new Lucky app structure by creating the shards.yml file and all that. In this generated shards.yml file it normally points to a specific lucky version as a dependency. I need to point this to the master branch so I can see if recent changes will work. Running shards install fails because

  Unable to satisfy the following requirements:
  - `lucky (branch master)` required by `shard.yml`
  - `lucky (~> 0.23.0)` required by `authentic 0.6.1`
  Failed to resolve dependencies

I see I can create a shard.override.yml to put some data in there, but would I add this file to the generated lucky apps? Then every time someone generated a new lucky app, they’d have this file. Or is there a better place I could put this like a global override or something? Once I have that file, what do I write exactly to tell authentic to use lucky master branch? Or do I just put lucky master in my override and then skip the need to update the shards.yml file directly? This is where I’m a little foggy on how this works…

  1. the shard.override.yml should state branch: master
  2. If you want to use a shard override file globaly (as in the expanded apps by lucky) set SHARDS_OVERRIDE env variable to the path of that file.

This was designed for that use case exactly ;-)

1 Like

Ok, awesome! I’ll give that a shot and see how it goes :tada:

It’s not working for me; I’m probably doing something wrong here. I added the export in my local .zshrc
export SHARDS_OVERRIDE="$HOME/shard.override.yml" then in that file:

    github: luckyframework/lucky
    branch: master

When I run my LuckyCLI specs, it will generate a new project in the ./test-project/ folder, and in that folder it runs shards install. When that shards install runs, it pulls the lucky version specified in test-project/shard.yml.

Do these files have to be in the same directory?

They don’t need to be in the same directory.
The actual value of SHARDS_OVERRIDE is the expected one?
You are using shards 0.12.0, right?

1 Like

Yes, the SHARDS_OVERRIDE is the expected one. I better double check that it’s using 0.12.0. Now that you say that, my guess is it’s not. :sweat_smile:

Yup! That was it! :laughing: I guess I missed that part. It’s working pretty great! No need to hack around a bunch of different repos.

Thanks for your help @bcardiff!

Great! I hope the overrides simplifies lucky’s workflow and check all the org on edge versions.

Thanks for trying things out!

1 Like