daff 1.3.6 → 1.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/daff.rb +1 -0
- data/lib/lib/coopy/coopy.rb +40 -12
- data/lib/lib/coopy/diff_render.rb +1 -0
- data/lib/lib/coopy/json_table.rb +1 -1
- data/lib/lib/coopy/json_tables.rb +2 -2
- data/lib/lib/coopy/table_diff.rb +16 -2
- data/lib/lib/coopy/table_view.rb +148 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe5ac7c2439b43f603b802861b9e04b04f1c2773
|
4
|
+
data.tar.gz: 7d2bd90c028eb968d7369d765db5c2f319eb5d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29d7a4fd4f68ef891f2b739b983d18b3bb20cebcb47bb91394ebc98814cd7d6452480526c6ced4aee7ca00afa28b05cd6c2336cd8531e404aa729f1a5ec14b28
|
7
|
+
data.tar.gz: 379780b6745360e7b4d2842d57260b68b36e41cce310d01e3e158b343ddaf285d9adcc254888a36fd2dad95321ec9dc97a213894808bae5bf5dd26d94df52948
|
data/lib/daff.rb
CHANGED
data/lib/lib/coopy/coopy.rb
CHANGED
@@ -4,8 +4,9 @@
|
|
4
4
|
module Coopy
|
5
5
|
class Coopy
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize(io = nil)
|
8
8
|
self.init
|
9
|
+
@io = io
|
9
10
|
end
|
10
11
|
|
11
12
|
# protected - in ruby this doesn't play well with static/inline methods
|
@@ -262,6 +263,8 @@ module Coopy
|
|
262
263
|
output
|
263
264
|
end
|
264
265
|
|
266
|
+
public
|
267
|
+
|
265
268
|
def load_table(name)
|
266
269
|
ext = self.check_format(name)
|
267
270
|
if ext == "sqlite"
|
@@ -298,6 +301,8 @@ module Coopy
|
|
298
301
|
output
|
299
302
|
end
|
300
303
|
|
304
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
305
|
+
|
301
306
|
attr_accessor :status
|
302
307
|
attr_accessor :daff_cmd
|
303
308
|
|
@@ -811,12 +816,19 @@ module Coopy
|
|
811
816
|
class << self
|
812
817
|
attr_accessor :version
|
813
818
|
end
|
814
|
-
@version = "1.3.
|
819
|
+
@version = "1.3.8"
|
815
820
|
|
816
821
|
def Coopy.diff_as_html(local,remote,flags = nil)
|
817
|
-
|
822
|
+
comp = ::Coopy::TableComparisonState.new
|
823
|
+
td = ::Coopy::Coopy.align(local,remote,flags,comp)
|
824
|
+
o = ::Coopy::Coopy.get_blank_table(td,comp)
|
825
|
+
o = comp.a.create if comp.a != nil
|
826
|
+
o = comp.b.create if o == nil && comp.b != nil
|
827
|
+
o = ::Coopy::SimpleTable.new(0,0) if o == nil
|
828
|
+
os = ::Coopy::Tables.new(o)
|
829
|
+
td.hilite_with_nesting(os)
|
818
830
|
render = ::Coopy::DiffRender.new
|
819
|
-
render.
|
831
|
+
render.render_tables(os).html
|
820
832
|
end
|
821
833
|
|
822
834
|
def Coopy.diff_as_ansi(local,remote,flags = nil)
|
@@ -827,6 +839,26 @@ module Coopy
|
|
827
839
|
|
828
840
|
def Coopy.diff(local,remote,flags = nil)
|
829
841
|
comp = ::Coopy::TableComparisonState.new
|
842
|
+
td = ::Coopy::Coopy.align(local,remote,flags,comp)
|
843
|
+
o = ::Coopy::Coopy.get_blank_table(td,comp)
|
844
|
+
o = comp.a.create if comp.a != nil
|
845
|
+
o = comp.b.create if o == nil && comp.b != nil
|
846
|
+
o = ::Coopy::SimpleTable.new(0,0) if o == nil
|
847
|
+
td.hilite(o)
|
848
|
+
o
|
849
|
+
end
|
850
|
+
|
851
|
+
# protected - in ruby this doesn't play well with static/inline methods
|
852
|
+
|
853
|
+
def Coopy.get_blank_table(td,comp)
|
854
|
+
o = nil
|
855
|
+
o = comp.a.create if comp.a != nil
|
856
|
+
o = comp.b.create if o == nil && comp.b != nil
|
857
|
+
o = ::Coopy::SimpleTable.new(0,0) if o == nil
|
858
|
+
o
|
859
|
+
end
|
860
|
+
|
861
|
+
def Coopy.align(local,remote,flags,comp)
|
830
862
|
comp.a = ::Coopy::Coopy.tablify(local)
|
831
863
|
comp.b = ::Coopy::Coopy.tablify(remote)
|
832
864
|
flags = ::Coopy::CompareFlags.new if flags == nil
|
@@ -834,14 +866,11 @@ module Coopy
|
|
834
866
|
ct = ::Coopy::CompareTable.new(comp)
|
835
867
|
align = ct.align
|
836
868
|
td = ::Coopy::TableDiff.new(align,flags)
|
837
|
-
|
838
|
-
o = comp.a.create if comp.a != nil
|
839
|
-
o = comp.b.create if o == nil && comp.b != nil
|
840
|
-
o = ::Coopy::SimpleTable.new(0,0) if o == nil
|
841
|
-
td.hilite(o)
|
842
|
-
o
|
869
|
+
td
|
843
870
|
end
|
844
871
|
|
872
|
+
public
|
873
|
+
|
845
874
|
def Coopy.patch(local,patch,flags = nil)
|
846
875
|
patcher = ::Coopy::HighlightPatch.new(::Coopy::Coopy.tablify(local),::Coopy::Coopy.tablify(patch))
|
847
876
|
patcher.apply
|
@@ -959,8 +988,7 @@ module Coopy
|
|
959
988
|
def Coopy.tablify(data)
|
960
989
|
return data if data == nil
|
961
990
|
return data if data.respond_to? :get_cell_view
|
962
|
-
|
963
|
-
::RubyTableView.new(data)
|
991
|
+
::Coopy::TableView.new(data)
|
964
992
|
end
|
965
993
|
|
966
994
|
haxe_me ["coopy", "Coopy"]
|
data/lib/lib/coopy/json_table.rb
CHANGED
@@ -9,7 +9,7 @@ module Coopy
|
|
9
9
|
names = Reflect.field(json,"names")
|
10
10
|
allowed = nil
|
11
11
|
count = names.length
|
12
|
-
if flags.tables != nil
|
12
|
+
if flags != nil && flags.tables != nil
|
13
13
|
allowed = {}
|
14
14
|
begin
|
15
15
|
_g = 0
|
@@ -120,7 +120,7 @@ module Coopy
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def create
|
123
|
-
|
123
|
+
nil
|
124
124
|
end
|
125
125
|
|
126
126
|
haxe_me ["coopy", "JsonTables"]
|
data/lib/lib/coopy/table_diff.rb
CHANGED
@@ -953,6 +953,13 @@ module Coopy
|
|
953
953
|
public
|
954
954
|
|
955
955
|
def hilite(output)
|
956
|
+
output = ::Coopy::Coopy.tablify(output)
|
957
|
+
self.hilite_single(output)
|
958
|
+
end
|
959
|
+
|
960
|
+
protected
|
961
|
+
|
962
|
+
def hilite_single(output)
|
956
963
|
return false if !output.is_resizable
|
957
964
|
if @builder == nil
|
958
965
|
if @flags.allow_nested_cells
|
@@ -1065,9 +1072,11 @@ module Coopy
|
|
1065
1072
|
true
|
1066
1073
|
end
|
1067
1074
|
|
1075
|
+
public
|
1076
|
+
|
1068
1077
|
def hilite_with_nesting(output)
|
1069
1078
|
base = output.add("base")
|
1070
|
-
result = self.
|
1079
|
+
result = self.hilite_single(base)
|
1071
1080
|
return false if !result
|
1072
1081
|
return true if @align.comp == nil
|
1073
1082
|
order = @align.comp.child_order
|
@@ -1086,7 +1095,7 @@ module Coopy
|
|
1086
1095
|
end
|
1087
1096
|
td = ::Coopy::TableDiff.new(alignment,@flags)
|
1088
1097
|
child_output = output.add(name)
|
1089
|
-
result = result && td.
|
1098
|
+
result = result && td.hilite_single(child_output)
|
1090
1099
|
end
|
1091
1100
|
end
|
1092
1101
|
result
|
@@ -1104,6 +1113,11 @@ module Coopy
|
|
1104
1113
|
@nesting_present
|
1105
1114
|
end
|
1106
1115
|
|
1116
|
+
def get_comparison_state
|
1117
|
+
return nil if @align == nil
|
1118
|
+
@align.comp
|
1119
|
+
end
|
1120
|
+
|
1107
1121
|
haxe_me ["coopy", "TableDiff"]
|
1108
1122
|
end
|
1109
1123
|
|
@@ -0,0 +1,148 @@
|
|
1
|
+
module Coopy
|
2
|
+
class TableView < ::Coopy::Table
|
3
|
+
def initialize(data)
|
4
|
+
@data = data
|
5
|
+
@height = data.length
|
6
|
+
@width = 0
|
7
|
+
@width = data[0].length if @height>0
|
8
|
+
end
|
9
|
+
|
10
|
+
def get_width() @width end
|
11
|
+
|
12
|
+
def get_height() @height end
|
13
|
+
|
14
|
+
def get_cell(x,y)
|
15
|
+
@data[y][x]
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_cell(x,y,c)
|
19
|
+
@data[y][x] = c
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
::Coopy::SimpleTable::table_to_string(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_cell_view
|
27
|
+
::Coopy::SimpleView.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def is_resizable
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
def resize(w,h)
|
35
|
+
@width = w
|
36
|
+
@height = h
|
37
|
+
@data.length.times do |i|
|
38
|
+
row = @data[i]
|
39
|
+
row = @data[i] = [] if row.nil?
|
40
|
+
while row.length<w
|
41
|
+
row << nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
while @data.length<h
|
45
|
+
row = []
|
46
|
+
w.times do |i|
|
47
|
+
row << nil
|
48
|
+
end
|
49
|
+
@data << row
|
50
|
+
end
|
51
|
+
true
|
52
|
+
end
|
53
|
+
|
54
|
+
def clear
|
55
|
+
@data.clear
|
56
|
+
@width = 0
|
57
|
+
@height = 0
|
58
|
+
end
|
59
|
+
|
60
|
+
def trim_blank
|
61
|
+
false
|
62
|
+
end
|
63
|
+
|
64
|
+
def get_data
|
65
|
+
return @data
|
66
|
+
end
|
67
|
+
|
68
|
+
def insert_or_delete_rows(fate,hfate)
|
69
|
+
ndata = []
|
70
|
+
fate.length.times do |i|
|
71
|
+
j = fate[i];
|
72
|
+
ndata[j] = @data[i] if j!=-1
|
73
|
+
end
|
74
|
+
@data.clear
|
75
|
+
ndata.length.times do |i|
|
76
|
+
@data[i] = ndata[i]
|
77
|
+
end
|
78
|
+
self.resize(@width,hfate)
|
79
|
+
true
|
80
|
+
end
|
81
|
+
|
82
|
+
def insert_or_delete_columns(fate,wfate)
|
83
|
+
if wfate==@width and wfate==fate.length
|
84
|
+
eq = true
|
85
|
+
wfate.times do |i|
|
86
|
+
if fate[i]!=i
|
87
|
+
eq = false
|
88
|
+
break
|
89
|
+
end
|
90
|
+
end
|
91
|
+
return true if eq
|
92
|
+
end
|
93
|
+
@height.times do |i|
|
94
|
+
row = @data[i]
|
95
|
+
nrow = []
|
96
|
+
@width.times do |j|
|
97
|
+
next if fate[j]==-1
|
98
|
+
nrow[fate[j]] = row[j]
|
99
|
+
end
|
100
|
+
while nrow.length<wfate
|
101
|
+
nrow << nil
|
102
|
+
end
|
103
|
+
@data[i] = nrow
|
104
|
+
end
|
105
|
+
@width = wfate
|
106
|
+
if @width == 0
|
107
|
+
@height = 0
|
108
|
+
end
|
109
|
+
true
|
110
|
+
end
|
111
|
+
|
112
|
+
def is_similar(alt)
|
113
|
+
return false if alt.width!=@width
|
114
|
+
return false if alt.height!=@height
|
115
|
+
@width.times do |c|
|
116
|
+
@height.times do |r|
|
117
|
+
v1 = "" + self.get_cell(c,r)
|
118
|
+
v2 = "" + alt.get_cell(c,r)
|
119
|
+
if (v1!=v2)
|
120
|
+
puts("MISMATCH "+ v1 + " " + v2);
|
121
|
+
return false
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
true
|
126
|
+
end
|
127
|
+
|
128
|
+
|
129
|
+
def clone
|
130
|
+
result = TableView.new([])
|
131
|
+
result.resize(@width,@height)
|
132
|
+
@width.times do |c|
|
133
|
+
@height.times do |r|
|
134
|
+
result.set_cell(c,r,self.get_cell(c,r))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
result
|
138
|
+
end
|
139
|
+
|
140
|
+
def create
|
141
|
+
TableView.new([])
|
142
|
+
end
|
143
|
+
|
144
|
+
def get_meta
|
145
|
+
nil
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Diff and patch tables
|
15
15
|
email:
|
@@ -72,6 +72,7 @@ files:
|
|
72
72
|
- lib/lib/coopy/table_io.rb
|
73
73
|
- lib/lib/coopy/table_modifier.rb
|
74
74
|
- lib/lib/coopy/table_stream.rb
|
75
|
+
- lib/lib/coopy/table_view.rb
|
75
76
|
- lib/lib/coopy/tables.rb
|
76
77
|
- lib/lib/coopy/terminal_diff_render.rb
|
77
78
|
- lib/lib/coopy/unit.rb
|