add 'rake crashlog:device' task, wording/UX is still a work in progress

This commit is contained in:
Laurent Sansonetti
2013-12-29 19:55:48 +01:00
parent cbb4cc82ea
commit 9f4d9e01c7
3 changed files with 291 additions and 9 deletions

View File

@@ -210,9 +210,9 @@ namespace :profile do
end
namespace :simulator do
desc 'List all built-in iOS Simulator Instruments templates'
desc 'List all built-in Simulator Instruments templates'
task :templates do
puts "Built-in iOS Simulator Instruments templates:"
puts "Built-in Simulator Instruments templates:"
IOS_SIM_INSTRUMENTS_TEMPLATES.each do |template|
puts "* #{template}"
end
@@ -239,9 +239,9 @@ namespace :profile do
end
namespace :device do
desc 'List all built-in iOS device Instruments templates'
desc 'List all built-in device Instruments templates'
task :templates do
puts "Built-in iOS device Instruments templates:"
puts "Built-in device Instruments templates:"
IOS_DEVICE_INSTRUMENTS_TEMPLATES.each do |template|
puts "* #{template}"
end
@@ -249,3 +249,29 @@ namespace :profile do
end
end
desc "Same as crashlog:simulator"
task :crashlog => 'crashlog:simulator'
namespace :crashlog do
desc "Open the latest crash report generated by the app in the simulator"
task :simulator => :__local_crashlog
desc "Retrieve and symbolicate crash logs generated by the app on the device, and open the latest generated one"
task :device do
device_id = (ENV['id'] or App.config.device_id)
crash_reports_dir = File.expand_path("~/Library/Logs/RubyMotion Device")
mkdir_p crash_reports_dir
deploy = File.join(App.config.bindir, 'ios/deploy')
env = "XCODE_DIR=\"#{App.config.xcode_dir}\" CRASH_REPORTS_DIR=\"#{crash_reports_dir}\""
flags = Rake.application.options.trace ? '-d' : ''
cmd = "#{env} #{deploy} -l #{flags} \"#{device_id}\" \"#{App.config.archive}\""
system(cmd)
# Open the latest generated one.
logs = Dir.glob(File.join(crash_reports_dir, "#{App.config.name}_*"))
unless logs.empty?
sh "/usr/bin/open -a Console \"#{logs.last}\""
end
end
end