Last active
January 27, 2016 07:12
-
-
Save kumabook/2eb12eebf0e384c652bf to your computer and use it in GitHub Desktop.
xcodeproj gemでxcschemeを弄ってみる ref: http://qiita.com/kumabook/items/cea89fc2ac7c1691b0fe
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
#!/usr/bin/env ruby | |
require 'xcodeproj' | |
lang = ARGV[0] | |
if lang.nil? | |
puts "no language is specified" | |
exit 1 | |
end | |
Dir.glob('**/*.xcodeproj').each do |path| | |
proj_name = File.basename(path, ".xcodeproj") | |
me = `whoami`.strip | |
scheme_path = path + '/xcuserdata/' + me + '.xcuserdatad/xcschemes/' + proj_name + '.xcscheme' | |
next if !File.exist? scheme_path | |
scheme = Xcodeproj::XCScheme.new(scheme_path) | |
la = scheme.launch_action | |
if !la.nil? | |
prev = la.xml_element.attribute("language") || "system" | |
if lang == "system" | |
la.xml_element.delete_attribute "language" | |
else | |
la.xml_element.add_attribute "language", lang | |
end | |
puts "change language from #{prev} to #{lang} of #{scheme_path}" | |
end | |
scheme.save! | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment