# File lib/shipit.rb, line 131 131: def prepare 132: require "pathname" 133: @file = Pathname.new(@file) 134: @content = @file.read 135: @match = @content.match(/#{@name}\s*=\s*['"](\d+\.\d+\.\d+)['"]/) 136: @new_version = @match[1].succ 137: @newcont = @content[0..@match.begin(1)-1] + @new_version + @content[@match.end(1)..1] 138: raise "Can't find version string in #{@file}." if @match.nil? 139: puts "Find version string #{@match[1]} and will change to #{@new_version}" 140: 141: # check content of Rakefile 142: check_version = nil 143: @org = @file.parent + "#{@file.basename}.org" 144: FileUtils.cp @file, @org 145: @file.open("w") do |f| 146: f.print @newcont 147: end 148: 149: ## run ruby not to duplicate rake tasks. 150: IO.popen("ruby", "r+") do |ruby| 151: ruby << m = Module.new m.module_eval(File.read("Rakefile")) print Marshal.dump(m.const_get(:VERS)) 152: ruby.close_write 153: check_version = Marshal.load(ruby.read) 154: end 155: 156: FileUtils.mv @org, @file 157: raise "Constant VERS in Rakefile must be same as 3rd argument of ChangeVersion step." unless @new_version == check_version 158: 159: VERS.replace @new_version 160: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.