SHARDS(1) | Shards Manual | SHARDS(1) |
NAME
shards - dependency manager for the Crystal Language
SYNOPSIS
shards [<general_options>...] [<command>] [<command_options>...]
DESCRIPTION
Manages dependencies for Crystal projects and libraries with reproducible installs across computers and systems.
USAGE
shards requires the presence of a shard.yml file in the project folder (working directory). This file describes the project and lists dependencies that are required to build it. See shard.yml(5) for more information on its format. A default file can be created by running shards init.
Running shards install resolves and installs the specified dependencies. The installed versions are written into a shard.lock file for using the exact same dependency versions when running shards install again.
If your shard builds an application, both shard.yml and shard.lock should be checked into version control to provide reproducible dependency installs. If it is only a library for other shards to depend on, shard.lock should not be checked in, only shard.yml. It’s good advice to add it to .gitignore.
COMMANDS
If no command is given, install command will be run by default.
To see the available options for a particular command, use --help after the command.
build [<targets>] [<build_options>...]
All <build_options> following the command are delegated to crystal build.
check
Exit status:
0
1
init
install [--frozen] [--without-development] [--production] [--skip-postinstall] [--skip-executables] [--jobs=N]
Reads and enforces locked versions and commits if a shard.lock file is present. The install command may fail if a locked version doesn’t match a requirement, but may succeed if a new dependency was added, as long as it doesn’t generate a conflict, thus generating a new shard.lock file.
--frozen
--without-development
--production
--skip-postinstall
--skip-executables
--jobs
list [--tree]
Specifying --tree arranges nested dependencies in a tree, instead of a flattened list.
lock [--update [<shards>...]]
Specifying --update follows the same semantics as the update command.
outdated [--pre]
When --pre is specified, pre-release versions are also considered.
prune
update [<shards>...]
Specifying shards will update these dependencies only, trying to be as conservative as possible with other dependencies, respecting the locked versions in the shard.lock file.
version [<path>]
To see the available options for a particular command, use --help after a command.
GENERAL OPTIONS
--version
-h, --help
--no-color
--local
-q, --quiet
-v, --verbose
INSTALLATION
Shards is usually distributed with Crystal itself. Alternatively, a separate shards package may be available for your system.
To install from source, download or clone the repository https://github.com/crystal-lang/shards and run make CRFLAGS=--release. The compiled binary is in bin/shards and should be added to PATH.
ENVIRONMENT VARIABLES
SHARDS_OPTS
SHARDS_CACHE_PATH
SHARDS_INSTALL_PATH
SHARDS_BIN_PATH
CRYSTAL_VERSION
SHARDS_OVERRIDE
FILES
shard.yml
shard.override.yml
The file contains a YAML document with a single dependencies key. It has the same semantics as in shard.yml. Dependency configuration takes precedence over the configuration in shard.yml or any dependency’s shard.yml.
Use cases are local working copies, forcing a specific dependency version despite mismatching constraints, fixing a dependency, checking compatibility with unreleased dependency versions.
shard.lock
If your shard builds an application, shard.lock should be checked into version control to provide reproducible dependency installs.
If it is only a library for other shards to depend on, shard.lock should not be checked in, only shard.yml. It’s good advice to add it to .gitignore.
REPORTING BUGS
Report shards bugs to https://github.com/crystal-lang/shards/issues
Crystal Language home page: https://crystal-lang.org
COPYRIGHT
Copyright © 2024 Julien Portalier.
License Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
AUTHORS
Written by Julien Portalier and the Crystal project.
SEE ALSO
2024-03-28 | shards 0.18.0 |