Class: Webpacker::Compiler

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

Instance Method Summary collapse

Constructor Details

#initialize(webpacker) ⇒ Compiler

Returns a new instance of Compiler.



12
13
14
# File 'lib/webpacker/compiler.rb', line 12

def initialize(webpacker)
  @webpacker = webpacker
end

Instance Method Details

#compileObject



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

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