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

.shardspec could be useful #44

Closed
jeromegn opened this issue Sep 20, 2015 · 5 comments
Closed

.shardspec could be useful #44

jeromegn opened this issue Sep 20, 2015 · 5 comments

Comments

@jeromegn
Copy link

First off: I'm glad this was incorporated into Crystal.

Would it be desirable to add something like Ruby's .gemspec? I find that really useful to differentiate gems from projects. Also, it's actually Ruby code which gets evaluated, therefore there's no need to supply the version twice (once in a module's version.cr and once in the shards.yml file.)

Example:

# bson.shardspec

require "./src/bson/version"

Shard::Specification do |spec|
  spec.version = BSON::Version
  # ... other useful stuff once/if there's a registry
end
@jhass
Copy link
Member

jhass commented Sep 20, 2015

Please see the existing extensive discussions at crystal-lang/crystal#220, crystal-lang/crystal#1357 and #25 around the format.

@jeromegn
Copy link
Author

Ah. I had searched in this repo for something related to that and didn't find anything. I guess I should've looked in the crystal repo.

There's only one real brief mention of the Ruby gemspec in those discussions (well, I didn't read it all, but a quick search found only one result.)

Should I talk about this in crystal-lang/crystal#1357 ?

@jhass
Copy link
Member

jhass commented Sep 20, 2015

There are several mentions of doing a Crystal based DSL and why that's not really preferable.

@ysbaddaden
Copy link
Contributor

Note that the version can be extracted from shard.yml at compile time:

# src/version.cr
VERSION = {{ `egrep "^version:" "#{ __DIR__ }/shard.yml"`[8 .. -1].stringify.strip }}

Not pretty, but doable.

@jhass
Copy link
Member

jhass commented Sep 21, 2015

We actually could think about compiler support for that once shards ships with it, have compile time access to the entire parsed shard.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants