class Webpacker::Instance

Attributes

config_path[R]
root_path[R]

Public Class Methods

new(root_path: Rails.root) click to toggle source
# File lib/webpacker-for-component/instance.rb, line 6
def initialize(root_path: Rails.root)
  @root_path = root_path
end

Public Instance Methods

commands() click to toggle source
# File lib/webpacker-for-component/instance.rb, line 32
def commands
  @commands ||= Webpacker::Commands.new self
end
compiler() click to toggle source
# File lib/webpacker-for-component/instance.rb, line 20
def compiler
  @compiler ||= Webpacker::Compiler.new self
end
config() click to toggle source
# File lib/webpacker-for-component/instance.rb, line 16
def config
  @config ||= Webpacker::Configuration.new self
end
dev_server() click to toggle source
# File lib/webpacker-for-component/instance.rb, line 24
def dev_server
  @dev_server ||= Webpacker::DevServer.new self
end
env() click to toggle source
# File lib/webpacker-for-component/instance.rb, line 10
def env
  (ENV["NODE_ENV"].presence_in(available_environments) ||
   Rails.env.presence_in(available_environments) ||
   "production".freeze).inquiry
end
manifest() click to toggle source
# File lib/webpacker-for-component/instance.rb, line 28
def manifest
  @manifest ||= Webpacker::Manifest.new self
end

Private Instance Methods

available_environments() click to toggle source
# File lib/webpacker-for-component/instance.rb, line 37
def available_environments
  if root_path.join("components/angular/config/webpacker.yml").exist?
    YAML.load(root_path.join("components/angular/config/webpacker.yml").read).keys
  else
    [].freeze
  end
end