-
-
Save thirtified/6021225 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rest_client' | |
# Replace with your values | |
APP_ID = "APP_ID" # e.g 7eae8eb55e8b6d5d1cbe603ed40ebfda | |
APP_NAME = "EXECUTABLE_NAME" # e.g. myapp | |
BUNDLE_ID = "BUNDLE_IDENTIFIER" # e.g. com.company.myapp | |
BUNDLE_VERSION = "BUNDLE_VERSION" # e.g. 112 | |
APP_VERSION = "APP_VERSION" # e.g. 1.1 | |
files = Dir.glob("*.crash") | |
files.each do |filename| | |
log = File.new(filename).read | |
data = /OS Version:\s+iPhone OS\s(.*)\(.*\)/.match(log) | |
if !data.nil? and data.length > 1 | |
systemversion = data[1].strip | |
else | |
systemversion = "" | |
end | |
data = /Hardware Model:\s+(.*)/.match(log) | |
if !data.nil? and data.length > 1 | |
platform = data[1].strip | |
else | |
platform = "" | |
end | |
xml = "" | |
xml << "<crash>" | |
xml << "<applicationname>" + APP_NAME + "</applicationname>" | |
xml << "<bundleidentifier>" + BUNDLE_ID + "</bundleidentifier>" | |
xml << "<systemversion>" + systemversion + "</systemversion>" | |
xml << "<platform>" + platform + "</platform>" | |
xml << "<senderversion>" + APP_VERSION + "</senderversion>" | |
xml << "<version>" + BUNDLE_VERSION + "</version>" | |
xml << "<log><![CDATA[" + log + "]]></log>" | |
xml << "<contact>" + "Manual Upload" + "</contact>" | |
xml << "<userid>" + "" + "</userid>" | |
xml << "<description>" + "" + "</description>" | |
xml << "</crash>" | |
tempfile = Tempfile.new("crash") | |
tempfile.write xml | |
tempfile.rewind | |
RestClient.post("https://rink.hockeyapp.net/api/2/apps/#{APP_ID}/crashes", :xml => tempfile) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment