lib/hanami/environment.rb in hanami-1.0.0.beta2 vs lib/hanami/environment.rb in hanami-1.0.0.beta3
- old
+ new
@@ -155,10 +155,12 @@
# @see Hanami::Commands::Console
# @see Hanami::Commands::Routes
# @see Hanami::Commands::Server
# @see Hanami::Environment#config
#
+ # @api private
+ #
# @example Define ENV variables from .env
#
# # % tree .
# # .
# # # ...
@@ -217,17 +219,19 @@
# Rack environment `"deployment"` is translated to Hanami `"production"`.
#
# @return [String] the current environment
#
# @since 0.1.0
+ # @api private
#
# @see Hanami::Environment::DEFAULT_ENV
def environment
@environment ||= env[HANAMI_ENV] || rack_env || DEFAULT_ENV
end
# @since 0.3.1
+ # @api private
#
# @see Hanami.env?(name)
def environment?(*names)
names.map(&:to_s).include?(environment)
end
@@ -260,10 +264,11 @@
# Hanami assumes that all the commands are executed from there.
#
# @return [Pathname] application's root
#
# @since 0.2.0
+ # @api private
def root
@root ||= Pathname.new(Dir.pwd)
end
# Application's config directory
@@ -280,10 +285,11 @@
# under application's root. If absolute path, it will be used as it is.
#
# @return [Pathname] the config directory
#
# @since 0.2.0
+ # @api private
#
# @see Hanami::Environment::DEFAULT_CONFIG
# @see Hanami::Environment#root
def config
@config ||= root.join(@options.fetch(:config) { DEFAULT_CONFIG })
@@ -302,10 +308,11 @@
# * `"0.0.0.0"` for all the other environments
#
# @return [String] the HTTP host name
#
# @since 0.1.0
+ # @api private
#
# @see Hanami::Environment::DEFAULT_HOST
# @see Hanami::Environment::LISTEN_ALL_HOST
def host
@host ||= @options.fetch(:host) do
@@ -323,10 +330,11 @@
# If those are missing it falls back to the default one: `2300`.
#
# @return [Integer] the default port
#
# @since 0.1.0
+ # @api private
#
# @see Hanami::Environment::DEFAULT_PORT
def port
@port ||= @options.fetch(:port) do
env[HANAMI_PORT] || DEFAULT_PORT
@@ -355,10 +363,11 @@
# under application's root. If absolute path, it will be used as it is.
#
# @return [Pathname] path to the Rack configuration file
#
# @since 0.2.0
+ # @api private
def rackup
root.join(@options.fetch(:rackup) { DEFAULT_RACKUP })
end
# Path to environment configuration file.
@@ -374,10 +383,11 @@
# under application's root. If absolute path, it will be used as it is.
#
# @return [Pathname] path to applications
#
# @since 0.1.0
+ # @api private
#
# @see Hanami::Environment::DEFAULT_ENVIRONMENT_CONFIG
def env_config
root.join(@options.fetch(:environment) { config.join(DEFAULT_ENVIRONMENT_CONFIG) })
end
@@ -392,10 +402,11 @@
# @api private
def require_application_environment
require project_environment_configuration.to_s # if project_environment_configuration.exist?
end
+ # @api private
alias require_project_environment require_application_environment
# Determine if activate code reloading for the current environment while
# running the server.
#
@@ -409,10 +420,11 @@
# * false for all the other environments
#
# @return [TrueClass,FalseClass] the result of the check
#
# @since 0.2.0
+ # @api private
#
# @see Hanami::Commands::Server
# @see Hanami::Environment::CODE_RELOADING
def code_reloading?
@options.fetch(:code_reloading) { !!CODE_RELOADING[environment] }
@@ -481,9 +493,10 @@
)
end
private
+ # @api private
attr_reader :env
# @since 0.1.0
# @api private
def set_env_vars!