Skip to content

Instantly share code, notes, and snippets.

@Mioke
Forked from onevcat/build_ios.rb
Created April 15, 2016 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mioke/4f87250cc3276e2e01c1be624ba94c35 to your computer and use it in GitHub Desktop.
Save Mioke/4f87250cc3276e2e01c1be624ba94c35 to your computer and use it in GitHub Desktop.
Build an iOS ipa
def buildiOS(projectPath, schemeName, archiveName, outPath, ipaName, appId)
absolutePath = `pwd`.strip
FileUtils.cd("#{projectPath}") do
puts "xcodebuild
-scheme #{schemeName}
-destination generic/platform=iOS
-archivePath #{absolutePath}/out/temp/#{archiveName}
archive
PROVISIONING_PROFILE=\"#{SAMPLE_IOS_APP_PROVISIONING_PROFILE_UUID}\"
CODE_SIGN_IDENTITY=\"#{SAMPLE_IOS_APP_CERTIFICATION}\""
puts "Archiving iOS Project, wait..."
`xcodebuild \
-scheme #{schemeName} \
-destination generic/platform=iOS \
-archivePath #{absolutePath}/out/temp/#{archiveName} \
archive \
PROVISIONING_PROFILE="#{SAMPLE_IOS_APP_PROVISIONING_PROFILE_UUID}" \
CODE_SIGN_IDENTITY="#{SAMPLE_IOS_APP_CERTIFICATION}"`
end
puts "Making ipa file from archive..."
FileUtils.rm_rf outPath
FileUtils.mkdir_p outPath
`xcodebuild \
-exportArchive -exportFormat ipa \
-archivePath "./out/temp/#{archiveName}" \
-exportPath "#{outPath}/#{ipaName}" \
-exportProvisioningProfile "#{SAMPLE_IOS_APP_PROVISIONING_PROFILE}"`
FileUtils.cp "./res/LineAdsSdkSample.plist", outPath
`#{PLIST_BUDDY} -c "Set :items:0:metadata:bundle-identifier #{appId}" #{outPath}/LineAdsSdkSample.plist`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment