Crystal scripts without Shards.yml

I think there should be a way to build a small script or projects without shards. I have made some small scripts or projects that are in a tmp directory or in a src folder that does not really correspond to a project.

You can make a lib directory with mkdir and then cloned projects in manually. This has problems but in general like dependencies and dependency version resolution.

In general how do people make projects or scripts without using shards?

Why is Shards not a part of the crystal executable?

I think it would be nice to cd into my tools directory and run crystal deps get luckyframework/habitat -v 0.4.7 and then just require "habitat" in my script.

1 Like

This was brought up, and rejected, in the past. Ref: shards install · Issue #81 · crystal-lang/shards · GitHub.

It used to be, but i assume it was extracted since they serve different purposes, even though shards can act as a thin wrapper to crystal build. I found Remove `crystal deps` · Issue #5510 · crystal-lang/crystal · GitHub that might have some info in it

Is there a reason to not want to use shards? It is truly the primary way to handle dependencies within a project. shard init and add your dependencies and all done. That is, IMO, a lot simpler than coming up with a way to install stuff w/o shards.

To your point you can just ignore name and version as they dont really matter. Maybe there could be some sort of way to denote a “project” is not really a shard and only use shards or dependency resolution. But not sure what that would/could look like or if it would be worth it?

2 Likes