Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds environment boolean checks #302

Merged
merged 1 commit into from Oct 13, 2017
Merged

Commits on Oct 13, 2017

  1. Adds environment boolean checks

    Amber currently ships with 3 different environments: development, test
    and production.
    
    As a developer I would like to sometimes run code conditionally
    depending on the environment that the application is.
    
    ```crystal
    if Amber.env.development?
      # ... code here ...
    end
    
    ```
    
    This PR addresses the issue by creating a Amber::Env module that
    contains 3 module methods:
    
    ```crystal
    Amber.env.development?
    Amber.env.test?
    Amber.env.production?
    Amber.env.integration?
    Amber.env.staging?
    Amber.env.sandbox?
    
    Amber.env.in? %w(development test)
    Amber.env.in? %i(development test)
    
    Amber.env.is? "test"
    Amber.env.is? :test
    ```
    
    With the changes in this PR a developer should be able to call the
    appropriate method to check for the desired environment.
    
    Adds Additional Module methods
    
    `in?` and `is?` methods to check for inclusion of the environments
    
    Uses rails style for Amber environment checks
    eliasjpr committed Oct 13, 2017
    Configuration menu
    Copy the full SHA
    3058844 View commit details
    Browse the repository at this point in the history