class Webpacker::Configuration
Public Class Methods
data()
click to toggle source
# File lib/webpacker/configuration.rb, line 44 def data load if Webpacker.env.development? raise Webpacker::FileLoader::FileLoaderError.new("Webpacker::Configuration.load must be called first") unless instance instance.data end
default_file_path()
click to toggle source
# File lib/webpacker/configuration.rb, line 32 def default_file_path file_path(root: Pathname.new(File.dirname(__FILE__)).join("../install")) end
defaults()
click to toggle source
# File lib/webpacker/configuration.rb, line 50 def defaults @defaults ||= HashWithIndifferentAccess.new(YAML.load(default_file_path.read)["default"]) end
entry_path()
click to toggle source
# File lib/webpacker/configuration.rb, line 7 def entry_path source_path.join(fetch(:source_entry_path)) end
fetch(key)
click to toggle source
# File lib/webpacker/configuration.rb, line 40 def fetch(key) data.fetch(key, defaults[key]) end
file_path(options = {})
click to toggle source
# File lib/webpacker/configuration.rb, line 27 def file_path(options = {}) root = options[:root] || Rails.root root.join("config/webpacker.yml") end
manifest_path()
click to toggle source
# File lib/webpacker/configuration.rb, line 15 def manifest_path output_path.join("manifest.json") end
output_path()
click to toggle source
# File lib/webpacker/configuration.rb, line 11 def output_path public_path.join(fetch(:public_output_path)) end
public_path()
click to toggle source
# File lib/webpacker/configuration.rb, line 23 def public_path Rails.root.join("public") end
source()
click to toggle source
# File lib/webpacker/configuration.rb, line 36 def source fetch(:source_path) end
source_path()
click to toggle source
# File lib/webpacker/configuration.rb, line 19 def source_path Rails.root.join(source) end
Private Instance Methods
load()
click to toggle source
Calls superclass method
Webpacker::FileLoader::load
# File lib/webpacker/configuration.rb, line 56 def load return super unless File.exist?(@path) HashWithIndifferentAccess.new(YAML.load(File.read(@path))[Webpacker.env]) end