Skip to content

Instantly share code, notes, and snippets.

@kumabook
Last active January 27, 2016 07:12
Show Gist options
  • Save kumabook/2eb12eebf0e384c652bf to your computer and use it in GitHub Desktop.
Save kumabook/2eb12eebf0e384c652bf to your computer and use it in GitHub Desktop.
xcodeproj gemでxcschemeを弄ってみる ref: http://qiita.com/kumabook/items/cea89fc2ac7c1691b0fe
#!/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