Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sija/crystal-environment
Crystal::Environment
https://github.com/sija/crystal-environment
crystal environment testing
Last synced: 5 days 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 (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T21:44:48.000Z (2 months ago)
- Last Synced: 2024-11-01T00:40:18.001Z (12 days ago)
- Topics: crystal, environment, testing
- Language: Crystal
- Homepage:
- Size: 65.4 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crystal-environment [![CI](https://github.com/Sija/crystal-environment/actions/workflows/ci.yml/badge.svg)](https://github.com/Sija/crystal-environment/actions/workflows/ci.yml) [![Releases](https://img.shields.io/github/release/Sija/crystal-environment.svg)](https://github.com/Sija/crystal-environment/releases) [![License](https://img.shields.io/github/license/Sija/crystal-environment.svg)](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