github.com/crenv/crystal-build-cr

Facilitates the process of building, downloading, and/or installing Crystal.

12 stars
0 dependents
License: MIT

Nothing has been indexed for 0.1.4 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  build-cr:
    github: crenv/crystal-build-cr
    version: ~> 0.1.4

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.1.4. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

![Specs](https://github.com/crenv/crystal-build-cr/workflows/specs/badge.svg)

## crystal-build

**Disclaimer**: This is an in-progress-but-working rewrite of `crystal-build` in Crystal. While largely functional, the existing application is written in Perl and in general it's hard to find maintainers, and people who are willing to work on Perl projects.

`crystal-build` is a plugin for [`crenv`](https://github.com/crenv/crenv) which provides a `crenv install` command. This command facilitates downloading and building/installing specific versions of Crystal and Shards.

Currently this project only supports downloading and installing Crystal from a released Crystal binary from the [crystal-lang GitHub releases page](https://github.com/crystal-lang/crystal/releases). Building Crystal from source is a feature that is on the roadmap. Shards, if not included in the GitHub release, will be built and installed from source using the Crystal version that was just installed.

### Installation

For a really basic installation, if a binary for your OS is included in the Releases page of this repository, rename the binary to `crenv-install`, and add that binary to `$CRENV_ROOT/plugins/crystal-build/bin/`. You won't have the ablility to uninstall Crystal versions with `crenv uninstall` this way.

To build from scratch, clone the repository and build it with an existing Crystal installation. If you don't have an existing Crystal installation and you use macOS, the easiest way is to install `crystal` using homebrew. This should typically work.

```bash
git clone https://github.com/taylorthurlow/crystal-build-cr.git $CRENV_ROOT/plugins/crystal-build
cd $CRENV_ROOT/plugins/crystal-build
shards install
crystal build --release src/build.cr -o bin/crenv-install
```

### Usage

```
crenv install [options] <version>
    -h, --help                       Print this help
    -v, --verbose                    Enable verbose output
    --version                        Print the version number
    --shards-version=SHARDS_VERSION  Specify a version of Shards to be installed, if it is not already present
    -l, --list                       Print a list of available Crystal versions
```

Install a specific version of Crystal with:

```bash
crenv install 1.6.0
```

If you compile from source you should also have access to `crenv uninstall <version>`. If you just copied the binary and you don't have the uninstall command, you can achieve the same effect by removing the desired directory from `$CRENV_ROOT/versions`. You can add a simple uninstall script with this command:

```bash
echo "rm -r $CRENV_ROOT/versions/$1" > $CRENV_ROOT/plugins/crystal-build/bin/crenv-uninstall
```