Build/Runs your crystal application, watches files, and rebuilds/reruns app on file changes
To install in your project, from the root directory of your project, run:
curl -fsSLo- https://raw.githubusercontent.com/samueleaton/sentry/master/install.cr | crystal eval
If using Crystal version
0.24.2 try the following:
curl -fsSLo- https://raw.githubusercontent.com/samueleaton/sentry/crystal-v0.24.2/install.cr | crystal eval
If using Crystal version
0.23.1 or lower try the following:
curl -fsSLo- https://raw.githubusercontent.com/samueleaton/sentry/crystal-v0.23.1/install.cr | crystal eval
This will install the Sentry CLI tool. To use the Crystal API, see CRYSTAL_API.md.
Troubleshooting the install: This install script is just a convenience. If it does not work, simply: (1) place the files located in the
src dir into a your project in a
dev/ dir, and (2) compile sentry by doing
crystal build --release dev/sentry_cli.cr -o ./sentry.
sentry.cr was correctly placed in
[your project name]/dev/sentry.cr and compiled into the root of your app as
sentry, simply run:
Show Help Menu
$ ./sentry -h Usage: ./sentry [options] -n NAME, --name=NAME Sets the display name of the app process (default name: <your_app_here>) --src=PATH Sets the entry path for the main crystal file (default is inferred from shards.yaml) -b COMMAND, --build=COMMAND Overrides the default build command (will override --src flag) --build-args=ARGS Specifies arguments for the build command --no-build Skips the build step -r COMMAND, --run=COMMAND Overrides the default run command --run-args=ARGS Specifies arguments for the run command -w FILE, --watch=FILE Overrides default files and appends to list of watched files -c FILE, --config=FILE Specifies a file to load for automatic configuration (default: '.sentry.yml') --install Run 'shards install' once before running Sentry build and run commands --no-color Removes colorization from output -i, --info Shows the values for build/run commands, build/run args, and watched files -h, --help Show this help
Override Default Build Command
./sentry -b "crystal build --release ./src/my_app.cr"
The default build command is
crystal build ./src/[app_name].cr. The release flag is omitted by default for faster compilation time while you are developing.
Override Default Run Command
./sentry -r "./my_app"
The default run command is
Override Default Files to Watch
./sentry -w "./src/**/*.cr" -w "./lib/**/*.cr"
The default files being watched are
By specifying files to watch, the default will be omitted. So if you want to watch all of the file in your
src directory, you will need to specify that like in the above example.
Show Info Before Running
This shows the values for the build command, run command, and watched files.
$ ./sentry -i 🤖 Sentry configuration: display name: my_app shard name: my_app install shards: true info: true build: crystal build ./src/my_app.cr build_args:  run: ./my_app run_args:  watch: ["./src/**/*.cr", "./src/**/*.ecr"] 🤖 Your SentryBot is vigilant. beep-boop... ... ...
Setting Build or Run Arguments
If you prefer granularity, you can specify arguments to the build or run commands using the
--run-args flags followed by a string of arguments.
./sentry -r "crystal" --run-args "spec --debug"
shards install Before Starting
This is especially usefull when initiating Sentry from a
package.json file. It guarantees all the shards are installed before running.
Reading Configurations from a File
Sentry will automatically read configurations from
.sentry.yml if it exists. This can be changed with
-c FILE or
YAML.mapping definition in the
Config class in the
/src/sentry.cr file for valid file properties.
Sentry output is colorized by default. To remove colorization, pass the
Sentry Crystal API
(1) It is tiring to have to stop and restart an app on every change.
Stop and restarting your app is especially expensive (and annoying) when running the app in a docker container, where one would need to totally rebuild the docker image for every change.
Now, for development, simply run sentry in your docker container, and it will rebuild the app from the docker container on any changes, without rebuilding the docker image/container.
- Fork it ( https://github.com/samueleaton/sentry/fork )
- Create your feature branch (git checkout -b feat-my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin feat-my-new-feature)
- Create a new Pull Request
- samueleaton Sam Eaton - creator, maintainer
Sentry is intended for use in a development environment, where failure is safe and expected 😉.