Class: Shakapacker::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/shakapacker/compiler.rb

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ Compiler

Returns a new instance of Compiler.



15
16
17
# File 'lib/shakapacker/compiler.rb', line 15

def initialize(instance)
  @instance = instance
end

Instance Method Details

#compileObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/shakapacker/compiler.rb', line 19

def compile
  unless stale?
    logger.debug "Everything's up-to-date. Nothing to do"
    return true
  end

  if compiling?
    wait_for_compilation_to_complete
    true
  else
    acquire_ipc_lock do
      run_precompile_hook if should_run_precompile_hook?
      run_webpack.tap do |success|
        after_compile_hook
      end
    end
  end
end