• Stars
    star
    753
  • Rank 58,023 (Top 2 %)
  • Language
    Crystal
  • License
    Other
  • Created almost 9 years ago
  • Updated 7 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dependency manager for the Crystal language

Shards

CI

Dependency manager for the Crystal language.

Usage

Crystal applications and libraries are expected to have a shard.yml file at their root looking like this:

name: shards
version: 0.1.0

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

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

license: MIT

When libraries are installed from Git repositories, the repository is expected to have version tags following a semver-like format, prefixed with a v. Examples: v1.2.3, v2.0.0-rc1 or v2017.04.1.

Please see the SPEC for more details about the shard.yml format.

Install

Shards is usually distributed with Crystal itself (e.g. Homebrew and Debian packages). Alternatively, a shards package may be available for your system.

You can download a source tarball from the same page (or clone the repository) then run make release=1and copy bin/shards into your PATH. For example /usr/local/bin.

You are now ready to create a shard.yml for your projects (see details in SPEC). You can type shards init to have an example shard.yml file created for your project.

Run shards install to install your dependencies, which will lock your dependencies into a shard.lock file. You should check both shard.yml and shard.lock into version control, so further shards install will always install locked versions, achieving reproducible installations across computers.

Run shards --help to list other commands with their options.

Happy Hacking!

Developers

Requirements

These requirements are only necessary for compiling Shards.

  • Crystal

    Please refer to https://crystal-lang.org/install/ for instructions for your operating system.

  • molinillo

    The shard molinillo needs to be in the Crystal path. It is available at https://github.com/crystal-lang/crystal-molinillo You can install it either with a pre-existing shards binary (running shards install) or just check out the repository at lib/crystal-molinillo (make lib).

  • libyaml

    On Debian/Ubuntu Linux you may install the libyaml-dev package.

    On Mac OS X you may install it using homebrew with brew install libyaml then make sure to have /usr/local/lib in your LIBRARY_PATH environment variable (eg: export LIBRARY_PATH="/usr/local/lib:$LIBRARY_PATH"). Please adjust the path per your Homebrew installation.

  • asciidoctor

    Needed for building manpages.

Getting started

It is strongly recommended to use make for building shards and developing it. The Makefile contains recipes for compiling and testing. Building with make also ensures the source dependency molinillo is installed. You don't need to take care of this yourself.

Run make bin/shards to build the binary.

  • release=1 for a release build (applies optimizations)
  • static=1 for static linking (only works with musl-libc)
  • debug=1 for full symbolic debug info

Run make install to install the binary. Target path can be adjusted with PREFIX (default: PREFIX=/usr/bin).

Run make test to run the test suites:

  • make test_unit runs unit tests (./spec/unit)
  • make test_integration runs integration tests (./spec/integration) on bin/shards

Run make docs to build the manpages.

License

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

More Repositories

1

crystal

The Crystal Programming Language
Crystal
19,110
star
2

crystal-book

Crystal reference with language specification, manuals and learning materials
Makefile
384
star
3

crystal-db

Common db api for crystal
Crystal
297
star
4

crystal_lib

Automatic binding generator for native libraries in Crystal
Crystal
139
star
5

crystal-sqlite3

SQLite3 bindings for Crystal
Crystal
131
star
6

heroku-buildpack-crystal

Heroku buildpack for Crystal
Shell
123
star
7

crystal-mysql

MySQL connector for Crystal
Crystal
106
star
8

install-crystal

GitHub Action: Install Crystal programming language
JavaScript
67
star
9

html_builder

DSL for creating HTML
Crystal
62
star
10

crystal-website

crystal-lang.org website
SCSS
56
star
11

clang.cr

libclang bindings for crystal (including automatic C bindings generator)
Crystal
46
star
12

crystal-presents

Playground for creating crystal presentations with live coding
CSS
40
star
13

distribution-scripts

Shell
39
star
14

crystal-molinillo

A generic dependency resolution algorithm. Ported from https://github.com/CocoaPods/Molinillo/
Crystal
29
star
15

omnibus-crystal

Omnibus builder for Crystal
Ruby
25
star
16

perf-tools

An assortment of tools to track resources in Crystal applications
Crystal
23
star
17

bootstrap-script

Automated script to bootstrap the crystal compiler from source
Shell
22
star
18

crystal-readline

Crystal bindings to GNU Readline Library
Crystal
21
star
19

json_mapping.cr

Crystal
18
star
20

rfcs

RFCs repository for Crystal
14
star
21

crystal-env

Crystal
13
star
22

logger.cr

Crystal
13
star
23

homebrew-crystal

Homebrew Tap for Crystal development
Ruby
13
star
24

yaml_mapping.cr

Crystal
8
star
25

crystal-dist

Docker workspace to sign and release Crystal binaries to repositories
Shell
7
star
26

test-ecosystem

Shell
6
star
27

crystal-infrastructure

Infrastructure automation for Crystal related resources
Jinja
4
star
28

crystal-random

Crystal
3
star
29

osc-docker

Dockerfile for pushing to Open Build Service
Dockerfile
1
star
30

.github

Default community health files
1
star