-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Add shards info command #324
base: master
Are you sure you want to change the base?
Add shards info command #324
Conversation
ded8464
to
eba93e4
Compare
For starters, this is unrelated to #86 which would search & return information about any shard from a hypothetical registry (i.e. remote shards, not the local project). For a local SPEC, the info is already right there, and the SPEC format is fully documented and stable. Why not read it directly? About the docs use-case: having |
Then #86 completely missed the point to illustrate it's about querying some remote index. I understand it as being primarily concerned with querying information about installed shards. This PR only reflects the shard in current working directory, but an enhancement would be to receive a shard name which would be resolved according to local Since the shards system works without a central registry, the only real source of truth about features in the ecosystem is the locally available implementation. It is based on unique combination of This PR is obviously only a first step into reaching that goal.
It's exactly the same reason why shards calls |
Similarly, RubyGems also have an *** LOCAL GEMS ***
pry (0.12.2)
Authors: John Mair (banisterfiend), Conrad Irwin, Ryan Fitzgerald,
Kyrylo Silin
Homepage: http://pryrepl.org
License: MIT
Installed at: /usr/local/lib/ruby/gems/2.6.0
An IRB alternative and runtime developer console |
@Sija Yes, that might be worth pointing out. Most package/dependency managers I'm aware of have such a tool. |
Huh? it could hardly be more explicit: "The info command asks the registry for informations about a package". It's even linked to #85 which itself links to #87. It also explicitly specifies a shard name in the command line.
Please don't make up historical background. Here is the actual reason: Shards relies on the external Here is the truth: I hate unrequited complexity and adding things for whatever reason and no real benefit. In my eyes, this whole PR is merely: YAML.parse("shard.yml")["name"] I doubt this PR would exist if the SPEC was written in JSON. The "Crystal can't depend on libyaml" argument wouldn't exist anymore —which is already nonsensical to me since Shards already depends on libyaml and its "most usually installed with the compiler" anyway. Note that the Which means that this PR could become interesting. I just currently fail to grasp it. @Sija AFAIK the Ruby gem's info command can query locally installed gems which are installed globally, as well as gems from the rubygems registry. This can be useful. |
Anyone up to porting libyaml to Crystal? At least the parser+scanner and emitter. There's already a port in Go so my guess is that it shouldn't be hard. Plus it should end up being shorter because of Crystal's syntax, blocks, etc. That way we can get rid of libyaml and also parse |
There's actually no indication that #86 is about a remote registry. Since shards is decentralized, that thought didn't suggest itself. My understanding of registry in this context was the collection of locally available shards, as they are referred to by name in
I just referred to #129 (comment) and I don't think anything, including your explanation here, contradicts my statement. Yes, we could change the compiler to use
I honestly see no nothing of that sort. On the contrary, it would add unnecessary complexity to the doc generator if it had to deal with reading shards spec. Even if that was just a one-liner to implement, it still carries a lot of baggage. I tried to keep this PR focused on a small use case in order to merge quickly what currently blocks advancing the doc generator. @asterite Having libyaml as an external dependency contributes to making it difficult to use in the compiler. We could also use a very simplistic implementation that's barely good enough to reliably parse |
This change is necessary in order to allow using them as arguments of a command which is intended for `shards info`.
eba93e4
to
bf6e814
Compare
This is a basic implementation of #86
It adds a new
shards info
command which can display information about a shard. For now, the features are very crude. The main purpose is to provide a basis for crystal-lang/crystal#8792 to extract the shard name and version from the working directory.Additional features can be added later.