Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 13 lines (12 sloc) 778 Bytes
#!/usr/bin/env ruby
# This script sets a version number for ASIHTTPRequest based on the last commit, and is run when you build one of the targets in the Xcode projects that come with ASIHTTPRequest
# It only really needs to run on my computer, not on yours... :)
require 'find'
if (File.exists?('/opt/local/bin/git'))
newversion = `/opt/local/bin/git describe --tags`.match(/(v([0-9]+)(\.([0-9]+)){1,}-([0-9]+))/).to_s.gsub(/[0-9]+$/){|commit| (commit.to_i + 1).to_s}" %Y-%m-%d")
buffer ='Classes/ASIHTTPRequest.m','r').read
if !buffer.match(/#{Regexp.quote(newversion)}/)
buffer = buffer.sub(/(NSString \*ASIHTTPRequestVersion = @\")(.*)(";)/,'\1'+newversion+'\3');'Classes/ASIHTTPRequest.m','w') {|fw| fw.write(buffer)}
Jump to Line
Something went wrong with that request. Please try again.