Sha256: 62e694d1eeb0417dc52b463db5ea344cc5dee0f46cd4b04d4c7af0e7303a33cc

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require "pathname"

class Shakapacker::Instance
  cattr_accessor(:logger) { ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(STDOUT)) }

  attr_reader :root_path, :config_path

  def initialize(root_path: Rails.root, config_path: Rails.root.join("config/shakapacker.yml"))
    @root_path = root_path
    @config_path = Pathname.new(ENV["SHAKAPACKER_CONFIG"] || config_path)
  end

  def env
    @env ||= Shakapacker::Env.inquire self
  end

  def config
    @config ||= Shakapacker::Configuration.new(
      root_path: root_path,
      config_path: config_path,
      env: env
    )
  end

  def strategy
    @strategy ||= Shakapacker::CompilerStrategy.from_config
  end

  def compiler
    @compiler ||= Shakapacker::Compiler.new self
  end

  def dev_server
    @dev_server ||= Shakapacker::DevServer.new config
  end

  def manifest
    @manifest ||= Shakapacker::Manifest.new self
  end

  def commands
    @commands ||= Shakapacker::Commands.new self
  end

  def inlining_css?
    dev_server.inline_css? && dev_server.hmr? && dev_server.running?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shakapacker-8.2.0 lib/shakapacker/instance.rb
shakapacker-8.1.0 lib/shakapacker/instance.rb
shakapacker-8.0.2 lib/shakapacker/instance.rb
shakapacker-8.0.1 lib/shakapacker/instance.rb