-
-
Save hboon/f7badd1a3ac981ae3e2c32d90d726118 to your computer and use it in GitHub Desktop.
RubyMotion: Custom rake tasks for New Relic, Testflight (old), and Crittercism
This file contains 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
def build_path | |
"build/iPhoneOS-7.0-Release/" | |
end | |
def ipa_name | |
"APP_FILE_NAME.ipa" | |
end | |
def dsym_name | |
"APP_FILE_NAME.app.dSYM" | |
end | |
def uuid | |
`xcrun dwarfdump --uuid #{build_path}#{dsym_name} | tr '[:upper:]' '[:lower:]' | tr -d '-'| awk '{print $2}' | xargs | sed 's/ /,/g'` | |
end | |
desc "Generate Development Build" | |
task :adhoc => [ | |
:deep_clean, | |
"archive:development" | |
] | |
desc "Generate App Store Build" | |
task :appstore => [ | |
"archive:distribution", | |
:zip_dsym, | |
:get_uuid, | |
:new_relic | |
] | |
task :deep_clean do | |
sh "rake clean" | |
end | |
task :zip_dsym do | |
`rm #{build_path}#{dsym_name}.zip` | |
sh "cd #{build_path} && zip -r #{dsym_name}.zip #{dsym_name}" | |
end | |
task :get_uuid do | |
@uuid = `xcrun dwarfdump --uuid #{build_path}#{dsym_name} | tr '[:upper:]' '[:lower:]' | tr -d '-'| awk '{print $2}' | xargs | sed 's/ /,/g'` | |
end | |
desc "Send to Testflight" | |
task :testflight do | |
cmd = <<-CMD | |
cd #{build_path} && | |
curl http://testflightapp.com/api/builds.json | |
-F file=@#{ipa_name} | |
-F api_token='#{ENV['TESTFLIGHT_API_TOKEN']}' | |
-F team_token='#{ENV['TESTFLIGHT_TEAM_TOKEN']}' | |
-F notes='#{ENV['notes']}' | |
-F notify=True | |
-F distribution_lists='dayoftheshirt' | |
CMD | |
puts cmd | |
sh cmd.gsub("\n", "\\\n") | |
end | |
desc "Send dSYM to New Relic" | |
task :new_relic do | |
cmd = <<-CMD | |
cd #{build_path} && | |
curl https://mobile-symbol-upload.newrelic.com/symbol | |
-F dsym=@#{dsym_name}.zip | |
-F buildId="#{uuid}" | |
-F appName="APP_NAME" | |
-H "X-APP-LICENSE-KEY: NEW_RELIC_LICENSE_KEY" | |
CMD | |
puts cmd | |
sh cmd.gsub("\n", "\\\n") | |
end | |
desc "Send to crittercism" | |
task :crittercism do | |
if adhoc? | |
env = 'adhoc' | |
else # Release | |
env = 'release' | |
end | |
config = YAML.load_file("config/#{env}.yml") | |
app_id = config['crittercism']['appId'] | |
api_key = ENV["CRITTERCISM_#{env.upcase}_API_KEY"] | |
cmd = <<-CMD | |
cd #{build_path} && | |
curl "https://api.crittercism.com/api_beta/dsym/#{app_id}" | |
-F dsym=@"#{dsym_name}.zip" | |
-F key="#{api_key}" | |
CMD | |
puts cmd | |
sh cmd.gsub("\n", "\\\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment