# File lib/gauntlet_rubyparser.rb, line 52
52: def broke name, file, msg
53: warn "bad"
54: self.data[name][file] = msg
55: self.dirty = true
56: end
# File lib/gauntlet_rubyparser.rb, line 35
35: def diff_pp o1, o2
36: require 'pp'
37:
38: File.open("/tmp/a.#{$$}", "w") do |f|
39: PP.pp o1, f
40: end
41:
42: File.open("/tmp/b.#{$$}", "w") do |f|
43: PP.pp o2, f
44: end
45:
46: `diff -u /tmp/a.#{$$} /tmp/b.#{$$}`
47: ensure
48: File.unlink "/tmp/a.#{$$}" rescue nil
49: File.unlink "/tmp/b.#{$$}" rescue nil
50: end
# File lib/gauntlet_rubyparser.rb, line 58
58: def process path, name
59: begin
60: $stderr.print " #{path}: "
61: rp = RubyParser.new
62: r2r = Ruby2Ruby.new
63:
64: old_ruby = File.read(path)
65:
66: begin
67: old_sexp = rp.process old_ruby
68: rescue Racc::ParseError => e
69: self.data[name][path] = :unparsable
70: self.dirty = true
71: return
72: end
73:
74: new_ruby = r2r.process old_sexp.deep_clone
75:
76: begin
77: new_sexp = rp.process new_ruby
78: rescue Racc::ParseError => e
79: broke name, path, "couldn't parse new_ruby: #{e.message.strip}"
80: return
81: end
82:
83: if old_sexp != new_sexp then
84: broke name, path, diff_pp(old_sexp, new_sexp)
85: return
86: end
87:
88: self.data[name][path] = true
89: self.dirty = true
90:
91: warn "good"
92: rescue Interrupt
93: puts "User cancelled"
94: exit 1
95: rescue Exception => e
96: broke name, path, " UNKNOWN ERROR: #{e}: #{e.message.strip}"
97: end
98: end
# File lib/gauntlet_rubyparser.rb, line 100
100: def run name
101: warn name
102: Dir["**/*.rb"].sort.each do |path|
103: next if path =~ /gemspec.rb/ # HACK
104: next if data[name][path] == true
105: process path, name
106: end
107:
108: if self.data[name].values.all? { |v| v == true } then
109: warn " ALL GOOD!"
110: self.data[name] = true
111: self.dirty = true
112: end
113: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.