Code Monkey home page Code Monkey logo

shards's Introduction

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.

shards's People

Contributors

jbye avatar jessedoyle avatar ysbaddaden avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.