Skip to content

Instantly share code, notes, and snippets.

@ctrevarthen
Last active December 1, 2015 04:25
Show Gist options
  • Save ctrevarthen/7dc2de8c7cd1297e598d to your computer and use it in GitHub Desktop.
Save ctrevarthen/7dc2de8c7cd1297e598d to your computer and use it in GitHub Desktop.
ShopQuick - Fastfile
desc "Create an unsigned IPA for distribution and resigning"
lane :distro do
makeUnsignedIPA
end
# Creates the unsigned IPA file for distribution
def makeUnsignedIPA
update_build_number
gym({
workspace: 'shopquick.xcworkspace',
configuration: 'Release',
scheme: 'ShopQuick App Store'
})
end
# Updates the build numbers in the Info.plists and Root.plist for the Settings screen
def update_build_number
commit_count = sh "git log $release_branch --oneline | wc -l | tr -d ' '"
increment_build_number(build_number: commit_count)
update_root_plist(path: '../shopquick/Settings.bundle/Root.plist', value: get_version_number + ', build: ' + commit_count)
end
# Updates the build number in the Root.plist for the Settings screen
def update_root_plist(params)
require "plist"
begin
path = File.expand_path(params[:path])
plist = Plist.parse_xml(path)
plist["PreferenceSpecifiers"][0]["DefaultValue"] = params[:value]
new_plist = plist.to_plist
File.write(path, new_plist)
return params[:value]
rescue => ex
Helper.log.error ex
Helper.log.error "Unable to set value to plist file at '#{path}'".red
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment