#!/usr/bin/env ruby def replace_in_file(filepath, regexp, *args, &block) content = File.read(filepath).gsub(regexp, *args, &block) File.open(filepath, 'wb') { |file| file.write(content) } end file = File.expand_path(ARGV[0]) platform = ( File.extension(file) == ".plist" ? "ios" : "android" ) if (platform == "ios") replace_in_file(file, /\s*com.phonegap.twitter<\/key>\n/mi) do |match| "" end replace_in_file(file, /\s*TwitterPlugin<\/string>\n/mi) do |match| "" end replace_in_file(file, /Plugins<\/key>\n\s*/mi) do |match| "Plugins\n\t\n\t\tcom.phonegap.twitter\n\t\tTwitterPlugin" end elsif (platform == "android") end