unascribed / FlexVer

A SemVer-compatible intuitive comparator for free-form versioning strings as seen in the wild, designed to sort versions like people do.
Creative Commons Zero v1.0 Universal
65 stars 10 forks source link

Crystal implementation #9

Closed oatmealine closed 1 year ago

oatmealine commented 1 year ago

This is almost ready for use, however, there are two issues I want to sort out:

  1. How would documentation be done? Typically, with Crystal shards, you would run crystal book and view docs/ in your favorite browser, however this is typically automated via CI (typically GitHub Actions and GitHub Pages, see here for an example). It might be more convenient to host it somewhere, even if manually; however, it's not a big deal, and the bigger issue is:
  2. There is currently no way to natively use this shard as a proper dependency in a shards.yml. Shards dependency management is typically done by pulling from Git URLs, however it does not have support for pulling from a specific folder, only the entire repository. This could possibly be addressed by moving the implementation into a separate branch, but that brings in a bunch of other issues (duplicated code across two branches? how to note in the in-repo README well? etc). Currently this is workaroundable by using Git submodules, but using Git submodules for dependency management is not ideal when there already is a package manager for Crystal.

It's for those two reasons that I wonder if maybe this implementation would be better off on a separate repository rather than in this repository. If those two issues aren't that big of a deal; great, merge and move on; but otherwise I'm willing to use a separate repository or whatever is more convenient.

oatmealine commented 1 year ago

Is it possible to put a metadata file in the root that points into the crystal subdir?

I think so? I'll try testing it in a bit, but I don't see why it wouldn't

oatmealine commented 1 year ago

Yep, this works - with one slight downside (which I think is not too bad):

require "flexver/crystal/src/flexver.cr"

The require is a bit verbose (instead of the usual require "flexver") and I haven't yet found a way to simplify it - however I think this is a fine enough solution.

I'll update the README and then I'm fairly sure it's ready to merge.

oatmealine commented 1 year ago

Those tests will also reveal if the Crystal implementation is affected by https://github.com/unascribed/FlexVer/issues/12.

Indeed it is; will fix once I figure out exactly what's happening here.

image

oatmealine commented 1 year ago

Should be good now! As for .editorconfig, I think leaving it in is fine; it's only in the Crystal folder and all Crystal repos I've looked at so far have a similar one (due to crystal init creating one that looks like this).

unascribed commented 1 year ago

You seem to have rebased in the wrong direction; I'll fix it.