8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/snapshot/builder.rb', line 8
def build_app(clean: true)
FileUtils.rm_rf(@build_dir) if clean
command = SnapshotConfig.shared_instance.build_command
if not command
raise "Could not find project. Please pass the path to your project using 'project_path'.".red unless SnapshotConfig.shared_instance.project_path
command = generate_build_command(clean: clean)
end
Helper.log.info "Building project '#{SnapshotConfig.shared_instance.project_name}' - this might take some time...".green
Helper.log.debug command.yellow
all_lines = []
PTY.spawn(command) do |stdin, stdout, pid|
stdin.each do |line|
all_lines << line
begin
parse_build_line(line) if line.length > 2
rescue => ex
Helper.log.fatal all_lines.join("\n")
raise ex
end
end
Process.wait(pid)
end
cmdstatus = $?.exitstatus
if cmdstatus == 0 || all_lines.join('\n').include?('** BUILD SUCCEEDED **')
Helper.log.info "BUILD SUCCEEDED".green
return true
else
Helper.log.info(all_lines.join(' '))
raise "Looks like the build was not successful."
end
end
|