class Webpacker::Env
Constants
- DEFAULT
Public Class Methods
inquire(webpacker)
click to toggle source
# File lib/webpacker/env.rb, line 6 def self.inquire(webpacker) new(webpacker).inquire end
new(webpacker)
click to toggle source
# File lib/webpacker/env.rb, line 10 def initialize(webpacker) @webpacker = webpacker end
Public Instance Methods
inquire()
click to toggle source
# File lib/webpacker/env.rb, line 14 def inquire fallback_env_warning if config_path.exist? && !current current || DEFAULT.inquiry end
Private Instance Methods
available_environments()
click to toggle source
# File lib/webpacker/env.rb, line 28 def available_environments if config_path.exist? begin YAML.load_file(config_path.to_s, aliases: true) rescue ArgumentError YAML.load_file(config_path.to_s) end else [].freeze end rescue Psych::SyntaxError => e raise "YAML syntax error occurred while parsing #{config_path}. " \ "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \ "Error: #{e.message}" end
current()
click to toggle source
# File lib/webpacker/env.rb, line 20 def current Rails.env.presence_in(available_environments) end
fallback_env_warning()
click to toggle source
# File lib/webpacker/env.rb, line 24 def fallback_env_warning logger.info "RAILS_ENV=#{Rails.env} environment is not defined in config/webpacker.yml, falling back to #{DEFAULT} environment" end