Module: Hanami::CLI::Commands::App::Command::Environment Private
- Defined in:
- lib/hanami/cli/commands/app/command.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Overloads #call to ensure an appropriate
HANAMI_ENV
environment variable is set.
Uses an --env
option if provided, then falls back to an already-set HANAMI_ENV
environment variable, and defaults to "development" in the absence of both.
Class Method Summary collapse
- .prepended(klass) ⇒ Object private
Instance Method Summary collapse
- #call(*args, **opts) ⇒ Object private
Class Method Details
.prepended(klass) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/hanami/cli/commands/app/command.rb', line 32 def self.prepended(klass) klass.option :env, desc: "App environment (development, test, production)", aliases: ["e"] end |
Instance Method Details
#call(*args, **opts) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hanami/cli/commands/app/command.rb', line 38 def call(*args, **opts) env = opts[:env] hanami_env = env ? env.to_s : ENV.fetch("HANAMI_ENV", "development") ENV["HANAMI_ENV"] = hanami_env Hanami::Env.load super end |