Class: SewingKit::Webpack::Compiler

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

Defined Under Namespace

Classes: NodeNotInstalled

Instance Method Summary collapse

Instance Method Details

#compileObject

Raises:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/sewing_kit/webpack/compiler.rb', line 21

def compile
  raise NodeNotInstalled unless node_installed?
  raise NodeSewingKitNotRunnable, node_env unless File.exist?("node_modules/.bin/sewing-kit")

  result = Kernel.system(
    environment,
    *command,
    chdir: Rails.root.to_s,
    out: $stdout,
    err: $stderr
  )

  unless result
    puts "sewing-kit compile failed with error code #{$CHILD_STATUS}"
    exit(1)
  end
  result
end