Created
October 17, 2013 00:22
-
-
Save TikiTDO/7017287 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
File.open("out") do |file| | |
cur_file = nil | |
diff_files = [] | |
only_files = [] | |
bleh = [] | |
file.each_line do |line| | |
wtf = nil | |
begin | |
case line | |
when /^Only in (?<loc>.+): (?<file>.+)/ | |
loc = $1 | |
file = $2 | |
only_file = OpenStruct.new | |
if loc =~ /^\.\./ | |
only_file.name = "#{loc[16..-1]}/#{file}" | |
only_file.in = :git | |
else | |
only_file.name = "#{loc[2..-1]}/#{file}" | |
only_file.in = :live | |
end | |
only_files.push only_file | |
when /^diff -r (?<old>.+) (?<new>.+)/ | |
type = :diff | |
cur_file = OpenStruct.new | |
cur_file.name = $1 | |
cur_file.git = 0 | |
cur_file.live = 0 | |
diff_files.push cur_file | |
when /^[c0-9,]+|---|^\\ No newline at end of file$|^Binary files/ | |
type = :ignore | |
when /^</ | |
cur_file.git += 1 | |
when /^>/ | |
cur_file.live += 1 | |
else | |
wtf = line | |
end | |
rescue | |
bleh.push(line) | |
end | |
raise "No clue wtf this shit is [#{wtf}]" if wtf | |
end | |
binding.pry | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment