Sha256: 4631230767ca08bd0da98a3b3ba5cee2ad8f4a67b215f72fc29ccfe34cc00334

Contents?: true

Size: 1.1 KB

Versions: 14

Compression:

Stored size: 1.1 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

    # For backward compatibility
    @config_path = Shakapacker.get_config_file_path_with_backward_compatibility(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

14 entries across 14 versions & 1 rubygems

Version Path
shakapacker-7.2.3 lib/shakapacker/instance.rb
shakapacker-7.3.0.beta.1 lib/shakapacker/instance.rb
shakapacker-7.2.2 lib/shakapacker/instance.rb
shakapacker-7.2.1 lib/shakapacker/instance.rb
shakapacker-7.2.0 lib/shakapacker/instance.rb
shakapacker-7.2.0.rc.0 lib/shakapacker/instance.rb
shakapacker-7.1.0 lib/shakapacker/instance.rb
shakapacker-7.0.3 lib/shakapacker/instance.rb
shakapacker-7.0.2 lib/shakapacker/instance.rb
shakapacker-7.0.1 lib/shakapacker/instance.rb
shakapacker-7.0.0 lib/shakapacker/instance.rb
shakapacker-7.0.0.rc.2 lib/shakapacker/instance.rb
shakapacker-7.0.0.rc.1 lib/shakapacker/instance.rb
shakapacker-7.0.0.rc.0 lib/shakapacker/instance.rb