23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/cyborg/plugin/assets/javascripts.rb', line 23
def build
files = find_files
FileUtils.mkdir_p(File.dirname(cache_file)) if !files.empty?
if Open3.capture3("npm ls browserify-incremental")[1].empty?
files.each do |file|
dest = destination(file)
FileUtils.rm(dest) if File.exists?(dest)
response = Open3.capture3(build_command(file))
if File.exist?(dest) && !File.read(dest).strip.empty?
compress(dest) if Cyborg.production?
build_success file
else
build_failure file
response = response.map { |l| l.to_s.split("\n") }.flatten
response.each do |line|
if !line.empty? &&
!line.match(/node_modules/i) &&
!line.match(/pid (\d+?) exit/i) &&
!line.match(/\[BABEL\] Note:/i)
log_error line.gsub(plugin.root+'/','')
end
end
puts ""
end
end
else
log_error "JS BUILD FAILED: browserifyinc NPM module not found.\n" << "Please add browserifyinc to your package.json and run `npm install`"
abort
end
end
|