Shards: Shards from gists

Created on 22 Aug 2018  路  5Comments  路  Source: crystal-lang/shards

It may be a good idea to add ability to require small pieces of code without need to maintain a separate repository for it. E.g. I'm using this log formatter in my projects:

https://gist.github.com/vladfaust/0689b06a615834fb0ead01c7a14c029b

And it may be an overhead to copy-paste this code into each project, however the code piece is too small to create a separate shard with issues, builds, README etc.

What if a developer could specify github gist as a dependency?

dependencies:
  custom_log_formatter:
    gist: vladfaust/0689b06a615834fb0ead01c7a14c029b
    revision: df1824db3d620139a02187de1c017e4525a37669
require "custom_log_formatter"

logger = Logger.new(STDOUT, Logger::DEBUG, custom_log_formatter)

Most helpful comment

I don't think we should encourage using gists that much, I agree it's a fine solution for small personal one off stuff, but we should encourage people to create and maintain full libraries, nothing you would keep in a gist. So I think the git resolver is doing just fine here.

All 5 comments

Why not just create a regular repository? You don't have to use issues, README etc. if you don't want to.

In principle, a gist is just a git repository, so you can actually just specify it as git: https://gist.github.com/0689b06a615834fb0ead01c7a14c029b.git.

@straight-shoota didn't know about gist being a repository as well. However, if we have a shortcut for github repositories (github: username/repo), why not adding gist: username/hash?

I don't think we should encourage using gists that much, I agree it's a fine solution for small personal one off stuff, but we should encourage people to create and maintain full libraries, nothing you would keep in a gist. So I think the git resolver is doing just fine here.

Closing. You can just use the gist git URI if you really want to, but that should only be considered as a hack, since shards should be supported libraries, not snippets :-)

A little bit of copying is better than a little bit of dependency, and anything that fits in a gist is only a little bit of dependency.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kostya picture kostya  路  3Comments

ysbaddaden picture ysbaddaden  路  7Comments

straight-shoota picture straight-shoota  路  5Comments

paulcsmith picture paulcsmith  路  8Comments

bcardiff picture bcardiff  路  8Comments