70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# File 'lib/routes/build.rb', line 70
def build_service
Brightpearl::Tools::verify_vm_is_reachable if @is_lib == false
if Brightpearl::Tools::this_is_a_mac
args = @args.dup
args.shift
commands = [
"mvn clean install#{@opts[:deploy] ? ' deploy' : ''}#{args.any? ? " #{args.join(' ')}" : ''}",
]
if @is_lib == false
output = Brightpearl::Terminal::command_capture(commands, @service_dir)
lines = output[0].chomp
lines = lines.split("\n")
war_file_ws = nil
build_failed = false
build_fail_url = nil
lines.each do |line|
if line =~ /\A\[INFO\] Building war: (.*).war\z/
war_file_ws = line
end
if line =~ /\A\[INFO\] BUILD FAILURE\z/
build_failed = true
end
if line =~ /\[ERROR\] Please refer to (.*)surefire-reports/
build_fail_url = line
build_fail_url = build_fail_url.split('Please refer to ')
build_fail_url = build_fail_url[1].split(' for the individual')
build_fail_url = build_fail_url[0]
end
end
if build_failed
Brightpearl::Terminal::error('Build failed', nil, false)
puts output[0]
puts
unless build_fail_url.nil?
if Brightpearl::Terminal::prompt_yes_no("Would you like to #{Brightpearl::Terminal::format_action('open a stack-trace')} in your default browser?", build_fail_url)
system("open -a Google\\ Chrome #{build_fail_url}")
end
end
exit
end
war_file_ws = war_file_ws.split('war: ')
war_file_ws = war_file_ws[1].chomp
war_file_vm = war_file_ws.split('/')
war_file_vm = war_file_vm[war_file_vm.length - 1]
commands = [
"scp #{war_file_ws} #{Brightpearl::Config.param(Brightpearl::Config::VM_USER)}@#{Brightpearl::Config.param(Brightpearl::Config::VM_IP)}:/tmp",
"sshpass -p#{Brightpearl::Config.param(Brightpearl::Config::VM_USER_PASSWORD)} ssh #{Brightpearl::Config.param(Brightpearl::Config::VM_USER)}@#{Brightpearl::Config.param(Brightpearl::Config::VM_IP)} 'cd /brightpearl-source/dev-vm-control-scripts/scm && ~/generated-scripts/deploy-uploaded-service #{war_file_vm}'"
]
Brightpearl::Terminal::command(commands)
else
Brightpearl::Terminal::command(commands, @service_dir)
end
else
commands = [
'mvn clean install -P deploy-service',
]
Brightpearl::Terminal::command(commands, @service_dir)
end
end
|