Skip to content

Instantly share code, notes, and snippets.

@mxcl mxcl/gist:360525

Created Apr 8, 2010
Embed
What would you like to do?
Make your Xcode templates less rubbish
def inreplace path, before=nil, after=nil
[*path].each do |path|
f = File.open path, 'r'
s = f.read.gsub before, after
f.reopen(path, 'w').write s
f.close
end
end
require 'pathname'
BEFORE = "\
//
// .*
// ___PROJECTNAME___
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
"
AFTER = "// ctime: ___DATE___"
Pathname.getwd.find do |pn|
next unless pn.file?
next if pn.realpath == Pathname.new(__FILE__).realpath
inreplace pn.to_s, Regexp.new(BEFORE), AFTER
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.