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.



13
14
15
# File 'lib/shakapacker/compiler.rb', line 13

def initialize(instance)
  @instance = instance
end

Instance Method Details

#compileObject



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

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_webpack.tap do |success|
        after_compile_hook
      end
    end
  end
end