Added Polling message and deploy error listing

This commit is contained in:
ViViDboarder 2013-04-24 14:07:19 -07:00
parent 952e1dc201
commit 579cb5edf4
2 changed files with 32 additions and 2 deletions

View File

@ -45,6 +45,7 @@ module AbuseTheForce
extract_to(Atf_Config.src). extract_to(Atf_Config.src).
on_complete { |job| puts "Finished retrieve #{job.id}!" }. on_complete { |job| puts "Finished retrieve #{job.id}!" }.
on_error { |job| puts "Something bad happened!" }. on_error { |job| puts "Something bad happened!" }.
on_poll { |job| puts "Polling for #{job.id}!" }.
perform perform
end end
@ -60,6 +61,7 @@ module AbuseTheForce
extract_to(Atf_Config.src). extract_to(Atf_Config.src).
on_complete { |job| puts "Finished retrieve #{job.id}!" }. on_complete { |job| puts "Finished retrieve #{job.id}!" }.
on_error { |job| puts "Something bad happened!" }. on_error { |job| puts "Something bad happened!" }.
on_poll { |job| puts "Polling for #{job.id}!" }.
perform perform
else else
puts "#{Atf_Config.src}: Not a valid project path" puts "#{Atf_Config.src}: Not a valid project path"
@ -74,8 +76,36 @@ module AbuseTheForce
if File.file?(dpath + '/package.xml') if File.file?(dpath + '/package.xml')
@client.deploy(File.expand_path(dpath)). @client.deploy(File.expand_path(dpath)).
on_complete { |job| puts "Finished deploy #{job.id}!" }. on_complete { |job|
puts "Finished deploy #{job.id}!"
result = job.result
if result != nil
puts "\nDeploy #{result.success ? "SUCCESS" : "FAILURE"}"
# If a failed deploy, print errors
if result.success == false
# Need messages in an array
unless result.messages.kind_of? Array
result.messages = [].push result.messages
end
puts "ERRORS: #{result.messages.size}"
result.messages.each do |m|
# If the path is not from the project, fix it
unless m.file_name.starts_with? Atf_Config.src
m.file_name = m.file_name.sub(/[a-zA-Z._-]*\//, Atf_Config.src + '/')
end
# Print our error in teh format "filename:line:column type in object message"
puts "#{m.file_name}:#{m.line_number}:#{m.column_number} #{m.problem_type} in #{m.full_name} #{m.problem}"
end
end
end
}.
on_error { |job| puts "Something bad happened!" }. on_error { |job| puts "Something bad happened!" }.
on_poll { |job| puts "Polling for #{job.id}!" }.
perform perform
else else
puts "#{dpath}: Not a valid project path" puts "#{dpath}: Not a valid project path"

View File

@ -1,3 +1,3 @@
module AbuseTheForce module AbuseTheForce
VERSION = '0.0.2' VERSION = '0.0.3'
end end