Sha256: 682783de5a6e76fb98cf25ac2c604ad0b12da87fc91673a18c35e3164a899e1a
Contents?: true
Size: 679 Bytes
Versions: 4
Compression:
Stored size: 679 Bytes
Contents
# Singleton registry for determining NODE_ENV from config/webpacker.yml require "webpacker/file_loader" class Webpacker::Env < Webpacker::FileLoader class << self def current raise Webpacker::FileLoader::FileLoaderError.new("Webpacker::Env.load must be called first") unless instance instance.data end def file_path Rails.root.join("config", "webpacker.yml") end end private def load environments = File.exist?(@path) ? YAML.load(File.read(@path)).keys : [].freeze return ENV["NODE_ENV"] if environments.include?(ENV["NODE_ENV"]) return Rails.env if environments.include?(Rails.env) "production" end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
webpacker-legacy-0.1.2 | lib/webpacker/env.rb |
webpacker-legacy-0.1.1 | lib/webpacker/env.rb |
webpacker-legacy-0.1.0 | lib/webpacker/env.rb |
webpacker-2.0 | lib/webpacker/env.rb |