Skip to content

Instantly share code, notes, and snippets.

@RaymondChou
Last active December 22, 2015 21:19
Show Gist options
  • Save RaymondChou/6532859 to your computer and use it in GitHub Desktop.
Save RaymondChou/6532859 to your computer and use it in GitHub Desktop.
TAG = 'OH_YEAH_PRINTER'
TEMP_PATH = '~/Desktop/'
def get_path(line)
reg = /\{(.*?)\}/
match = reg.match(line)
unless match.nil?
match.captures.first
end
end
def pull_file(remote_path)
local_path = TEMP_PATH + remote_path.split('/').last
`adb pull #{remote_path} #{local_path}`
puts "Download success! file path: #{local_path}"
end
`adb logcat -c`
IO.popen("adb logcat -s #{TAG}") do |f|
while line = f.gets
path = get_path(line)
unless path.nil?
pull_file(path)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment