https://github.com/sija/crystal-environment
Crystal::Environment
https://github.com/sija/crystal-environment
crystal environment testing
Last synced: 12 months ago
JSON representation
Crystal::Environment
- Host: GitHub
- URL: https://github.com/sija/crystal-environment
- Owner: Sija
- License: mit
- Created: 2017-11-02T20:57:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T21:44:48.000Z (over 1 year ago)
- Last Synced: 2025-04-12T10:57:07.048Z (12 months ago)
- Topics: crystal, environment, testing
- Language: Crystal
- Homepage:
- Size: 65.4 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crystal-environment [](https://github.com/Sija/crystal-environment/actions/workflows/ci.yml) [](https://github.com/Sija/crystal-environment/releases) [](https://github.com/Sija/crystal-environment/blob/master/LICENSE)
Adds `Crystal::Environment` module for querying `CRYSTAL_ENV` variable in a
compile-time safe manner.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
crystal-environment:
github: Sija/crystal-environment
```
## Usage
```crystal
require "crystal-environment"
Crystal.env.name # => "development"
Crystal.env.development? # => true
Crystal.env.production? # => false
# Defining custom environments
Crystal.env.staging? # Throws compile-time error
Crystal::Environment.setup %i(staging)
Crystal.env.staging? # => true
```
## Contributing
1. [Fork it](https://github.com/Sija/crystal-environment/fork)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new [Pull Request](https://github.com/Sija/crystal-environment/pulls)
## Contributors
- [@Sija](https://github.com/Sija) Sijawusz Pur Rahnama - creator, maintainer