class Webpacker::Remote

Constants

VERSION

Attributes

public_manifest_content[R]

Public Class Methods

get_http_response(uri) click to toggle source
# File lib/webpacker/remote.rb, line 52
def self.get_http_response(uri)
  Net::HTTP.get_response(URI.parse(uri)).body
end
new(root_path: nil, config_path: nil) click to toggle source

fetch early, fail fast rubocop:disable Lint/MissingSuper

# File lib/webpacker/remote.rb, line 21
  def initialize(root_path: nil, config_path: nil)
    uri = File.join(root_path.to_s, config_path.to_s)
    @public_manifest_content = JSON.parse(self.class.get_http_response(uri))
    # deliberately not calling `super` just emulating what's done there
    @config_path = config_path
    @root_path = root_path
  rescue StandardError => e
    raise Error, <<~MSG
      having {root_path: #{root_path.inspect}, config_path: #{config_path.inspect}}
      #{e.class}: #{e.message}
    MSG
  end

Public Instance Methods

config() click to toggle source
# File lib/webpacker/remote.rb, line 39
def config
  @config ||= Webpacker::Remote::Configuration.new(
    root_path: root_path,
    config_path: config_path,
    env: env
  )
end
env() click to toggle source

right now this only supports builds done ahead of time

# File lib/webpacker/remote.rb, line 48
def env
  'production'
end
manifest() click to toggle source

rubocop:enable Lint/MissingSuper

# File lib/webpacker/remote.rb, line 35
def manifest
  @manifest ||= Webpacker::Remote::Manifest.new(self)
end