Last active
August 15, 2019 03:50
-
-
Save hlung/c4821b12e17d2c6d097343e4210c784f to your computer and use it in GitHub Desktop.
Just archiving my work. These can be done using fastlane plugins https://docs.fastlane.tools/actions/version_bump_podspec/#version_bump_podspec https://docs.fastlane.tools/actions/version_get_podspec/#version_get_podspec
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
lane :replace_podspec_version do |options| | |
# Input file (content) => "s.version = '0.1.0'" | |
# Input new_version => "0.2.0" | |
# Output file (content) => "s.version = '0.2.0'" | |
# Note: For debugging, you can remove -i to make it print output to console without editing file in place. | |
# Somehow backup file *.bak has to be created for edit in-place (-i) option, otherwise sed command will fail. | |
sh("cd ..; sed -i bk \"s/\\(s.version.*['\\\"]\\).*\\(['\\\"]\\)/\\1#{options[:new_version]}\\2/g\" #{options[:file]}") | |
end | |
lane :get_podspec_version do |options| | |
# Input file (content) => "s.version = '0.1.0'" | |
# Output => "0.1.0" | |
sh("cd ..; pcregrep -o1 \"s.version.*[\\\'\\\"](.*)[\\\'\\\"]\" #{options[:file]}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment