Created
April 22, 2010 06:48
-
-
Save norio-nomura/374900 to your computer and use it in GitHub Desktop.
Ad Hoc なら CFBundleVersion を増やす
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
#!/usr/bin/env ruby | |
# | |
# gem install plist | |
# | |
# On Xcode, right-click on your Target where you want to use this and select | |
# Add->New Build Phase->New Run Script Build Phase. | |
# | |
# Set the Shell to | |
# /usr/bin/ruby | |
# | |
# And paste this script. | |
# | |
require 'rubygems' | |
require 'plist' | |
exit if ENV['CONFIGURATION'] != "Ad Hoc" | |
current_plist_file = "#{ENV['PROJECT_DIR']}/#{ENV['INFOPLIST_FILE']}" | |
current_plist_hash = Plist::parse_xml(current_plist_file) | |
current_version_array = current_plist_hash['CFBundleVersion'].split(".") | |
current_version_array.push(current_version_array.pop.to_i + 1).to_s | |
current_plist_hash['CFBundleVersion'] = current_version_array.join(".") | |
File.open(current_plist_file, 'w') {|f| f.write(current_plist_hash.to_plist) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment