shards

Dependency manager for the Crystal language

Crystal Shards

Dependency manager for the Crystal language.

The idea is for Crystal applications and libraries to have a shard.yml file at their root looking like this:

name: shards
version: 0.1.0

sources:
  - https://shards.crystal-lang.org/
  - https://shards.example.com/

dependencies:
  pg: >= 1.2.3
  memcached: *

  minitest:
    git: https://github.com/ysbaddaden/minitest.cr.git
    version: ~> 1.0.0

  openssl:
    github: datanoise/openssl.cr
    branch: master

Repositories are expected to have version tags, using the v1.2.3 format, this example matching version 1.2.3 of a library.

Dependencies are then resolved, downloaded and installed into the libs folder, ready to be required.

Development Plan

  • step 1: install/update dependencies

    • clone from Git repositories (with github shortener)
    • copy/link from local path
  • step 2: resolve dependencies (dumb)

    • recursively install dependencies
    • list versions using Git tags (v0.0.0-{pre,rc}0)
    • checkout specified versions (defaults to: latest version, then HEAD)
    • checkout specified Git branch/tag (limiting available versions)
    • resolve versions, applying requirements (*, >=, <=, <, >, ~>), recursively
    • lock resolved dependencies in shards.yml.lock (or .shards/lock or .shards.lock?)
  • step 3: smarter resolver

    • resolve conflicts (when possible)
  • step 4: central registry

    • multiple registries for private packages / mirrors
    • resolve dependencies by name => repository URL
    • list package versions (and their dependencies?)

FAQ

  • Why not using a Crystal file (like Ruby's Bundler or crystal deps)?

    That would be nice, since YAML (or JSON or TOML) don't play nicely with statically typed languages, but it would require compiling the Crystal source file for each and every dependency + version pairs... that would certainly end up ugly.

  • Why YAML and not JSON or TOML?

    JSON is too noisy. TOML's spec is unstable. YAML did the job.

  • Why eventually have a central registry?

    Remembering package names is simpler than remembering their package names and their repository URL. Also it would speed things up drastically —no more need to clone all repositories to resolve dependencies for example.

Requirements

  • Crystal >= 0.7.3

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Repository

shards

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 0
  • over 6 years ago
  • June 5, 2018
License

Apache License 2.0

Links
Synced at

Fri, 22 Nov 2024 09:01:13 GMT

Languages