daff 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +4 -1
- data/lib/daff.rb +20 -7
- data/lib/lib/coopy/alignment.rb +6 -0
- data/lib/lib/coopy/cell_info.rb +1 -0
- data/lib/lib/coopy/compare_flags.rb +2 -0
- data/lib/lib/coopy/compare_table.rb +1 -1
- data/lib/lib/coopy/coopy.rb +80 -18
- data/lib/lib/coopy/csv.rb +1 -1
- data/lib/lib/coopy/diff_render.rb +61 -22
- data/lib/lib/coopy/flat_cell_builder.rb +1 -1
- data/lib/lib/coopy/highlight_patch.rb +8 -6
- data/lib/lib/coopy/mover.rb +1 -1
- data/lib/lib/coopy/ndjson.rb +134 -0
- data/lib/lib/coopy/nested_cell_builder.rb +74 -0
- data/lib/lib/coopy/simple_view.rb +29 -0
- data/lib/lib/coopy/sql_column.rb +35 -0
- data/lib/lib/coopy/sql_compare.rb +245 -0
- data/lib/lib/coopy/sql_database.rb +19 -0
- data/lib/lib/coopy/sql_helper.rb +12 -0
- data/lib/lib/coopy/sql_table.rb +216 -0
- data/lib/lib/coopy/sql_table_name.rb +23 -0
- data/lib/lib/coopy/sqlite_helper.rb +47 -0
- data/lib/lib/coopy/table_diff.rb +18 -6
- data/lib/lib/coopy/table_io.rb +5 -0
- data/lib/lib/coopy/terminal_diff_render.rb +8 -9
- data/lib/lib/coopy/view.rb +5 -0
- data/lib/lib/haxe/ds/int_map.rb +4 -0
- data/lib/lib/haxe/ds/string_map.rb +4 -0
- data/lib/lib/haxe/format/json_parser.rb +8 -8
- data/lib/lib/haxe/imap.rb +1 -0
- data/lib/lib/haxe/io/bytes.rb +1 -1
- data/lib/lib/haxe/io/bytes_output.rb +1 -1
- data/lib/lib/haxe/io/error.rb +1 -0
- data/lib/lib/haxe/io/output.rb +2 -2
- data/lib/lib/hx_overrides.rb +12 -0
- data/lib/lib/hx_sys.rb +1 -1
- data/lib/lib/rb/boot.rb +5 -1
- data/lib/lib/reflect.rb +1 -0
- data/lib/lib/sys/io/file_handle.rb +1 -0
- data/lib/lib/sys/io/file_output.rb +1 -1
- data/lib/lib/value_type.rb +1 -0
- metadata +36 -25
data/lib/lib/coopy/view.rb
CHANGED
@@ -6,6 +6,11 @@ module Coopy
|
|
6
6
|
def toString(d) puts "Abstract View.toString called" end
|
7
7
|
def equals(d1,d2) puts "Abstract View.equals called" end
|
8
8
|
def toDatum(str) puts "Abstract View.toDatum called" end
|
9
|
+
def makeHash() puts "Abstract View.makeHash called" end
|
10
|
+
def hashSet(h,str,d) puts "Abstract View.hashSet called" end
|
11
|
+
def isHash(h) puts "Abstract View.isHash called" end
|
12
|
+
def hashExists(h,str) puts "Abstract View.hashExists called" end
|
13
|
+
def hashGet(h,str) puts "Abstract View.hashGet called" end
|
9
14
|
haxe_me
|
10
15
|
end
|
11
16
|
|
data/lib/lib/haxe/ds/int_map.rb
CHANGED
@@ -183,7 +183,7 @@ module Format
|
|
183
183
|
end
|
184
184
|
f = nil
|
185
185
|
begin
|
186
|
-
x = @str
|
186
|
+
x = HxOverrides.substr(@str,start,@pos - start)
|
187
187
|
f = x.to_f
|
188
188
|
end
|
189
189
|
i = f.to_i
|
@@ -210,7 +210,7 @@ module Format
|
|
210
210
|
end
|
211
211
|
break if c == 34
|
212
212
|
if c == 92
|
213
|
-
buf_b += @str
|
213
|
+
buf_b += HxOverrides.substr(@str,start,@pos - start - 1)
|
214
214
|
begin
|
215
215
|
index1 = @pos
|
216
216
|
@pos+=1
|
@@ -232,30 +232,30 @@ module Format
|
|
232
232
|
when 117
|
233
233
|
uc = nil
|
234
234
|
begin
|
235
|
-
x = "0x" + _hx_str(@str
|
235
|
+
x = "0x" + _hx_str(HxOverrides.substr(@str,@pos,4))
|
236
236
|
uc = x.to_i
|
237
237
|
end
|
238
238
|
@pos += 4
|
239
239
|
buf_b += [uc].pack("U")
|
240
240
|
else
|
241
|
-
raise "Invalid escape sequence \\" + _hx_str([c].pack("U")) + " at position " + _hx_str((@pos - 1))
|
241
|
+
raise hx_raise("Invalid escape sequence \\" + _hx_str([c].pack("U")) + " at position " + _hx_str((@pos - 1)))
|
242
242
|
end
|
243
243
|
start = @pos
|
244
244
|
elsif c == 0
|
245
|
-
raise "Unclosed string"
|
245
|
+
raise hx_raise("Unclosed string")
|
246
246
|
end
|
247
247
|
end
|
248
|
-
buf_b += @str
|
248
|
+
buf_b += HxOverrides.substr(@str,start,@pos - start - 1)
|
249
249
|
return buf_b
|
250
250
|
end
|
251
251
|
|
252
252
|
def invalid_char
|
253
253
|
@pos-=1
|
254
|
-
raise "Invalid char " + _hx_str((@str[@pos] || 0).ord) + " at position " + _hx_str(@pos)
|
254
|
+
raise hx_raise("Invalid char " + _hx_str((@str[@pos] || 0).ord) + " at position " + _hx_str(@pos))
|
255
255
|
end
|
256
256
|
|
257
257
|
def invalid_number(start)
|
258
|
-
raise "Invalid number at position " + _hx_str(start) + ": " + _hx_str(@str
|
258
|
+
raise hx_raise("Invalid number at position " + _hx_str(start) + ": " + _hx_str(HxOverrides.substr(@str,start,@pos - start)))
|
259
259
|
end
|
260
260
|
|
261
261
|
haxe_me
|
data/lib/lib/haxe/imap.rb
CHANGED
data/lib/lib/haxe/io/bytes.rb
CHANGED
@@ -19,7 +19,7 @@ module Io
|
|
19
19
|
public
|
20
20
|
|
21
21
|
def get_string(pos,len)
|
22
|
-
raise ::Haxe::Io::Error.outside_bounds if pos < 0 || len < 0 || pos + len > @length
|
22
|
+
raise hx_raise(::Haxe::Io::Error.outside_bounds) if pos < 0 || len < 0 || pos + len > @length
|
23
23
|
return @b.byteslice(pos,len)
|
24
24
|
end
|
25
25
|
|
@@ -20,7 +20,7 @@ module Io
|
|
20
20
|
|
21
21
|
def write_bytes(buf,pos,len)
|
22
22
|
begin
|
23
|
-
raise ::Haxe::Io::Error.outside_bounds if pos < 0 || len < 0 || pos + len > buf.length
|
23
|
+
raise hx_raise(::Haxe::Io::Error.outside_bounds) if pos < 0 || len < 0 || pos + len > buf.length
|
24
24
|
@b.b += buf.b.byteslice(pos,len)
|
25
25
|
end
|
26
26
|
return len
|
data/lib/lib/haxe/io/error.rb
CHANGED
@@ -15,6 +15,7 @@ module Io
|
|
15
15
|
def Error.outside_bounds() Error.new("OutsideBounds",2) end
|
16
16
|
def Error.overflow() Error.new("Overflow",1) end
|
17
17
|
CONSTRUCTS__ = ["Blocked","Overflow","OutsideBounds","Custom"]
|
18
|
+
def ==(a) a.tag === @tag && a.index === @index && a.params == @params end
|
18
19
|
end
|
19
20
|
|
20
21
|
end
|
data/lib/lib/haxe/io/output.rb
CHANGED
@@ -6,13 +6,13 @@ module Io
|
|
6
6
|
class Output
|
7
7
|
|
8
8
|
def write_byte(c)
|
9
|
-
raise "Not implemented"
|
9
|
+
raise hx_raise("Not implemented")
|
10
10
|
end
|
11
11
|
|
12
12
|
def write_bytes(s,pos,len)
|
13
13
|
k = len
|
14
14
|
b = s.b
|
15
|
-
raise ::Haxe::Io::Error.outside_bounds if pos < 0 || len < 0 || pos + len > s.length
|
15
|
+
raise hx_raise(::Haxe::Io::Error.outside_bounds) if pos < 0 || len < 0 || pos + len > s.length
|
16
16
|
while(k > 0)
|
17
17
|
self.write_byte(b[pos])
|
18
18
|
pos+=1
|
data/lib/lib/hx_overrides.rb
CHANGED
@@ -14,6 +14,18 @@
|
|
14
14
|
return _hx_str(date.get_full_year) + "-" + _hx_str((((m < 10) ? "0" + _hx_str(m) : "" + _hx_str(m)))) + "-" + _hx_str((((d < 10) ? "0" + _hx_str(d) : "" + _hx_str(d)))) + " " + _hx_str((((h < 10) ? "0" + _hx_str(h) : "" + _hx_str(h)))) + ":" + _hx_str((((mi < 10) ? "0" + _hx_str(mi) : "" + _hx_str(mi)))) + ":" + _hx_str((((s < 10) ? "0" + _hx_str(s) : "" + _hx_str(s))))
|
15
15
|
end
|
16
16
|
|
17
|
+
def HxOverrides.substr(s,pos,len = nil)
|
18
|
+
return "" if pos != nil && pos != 0 && len != nil && len < 0
|
19
|
+
len = s.length if len == nil
|
20
|
+
if pos < 0
|
21
|
+
pos = s.length + pos
|
22
|
+
pos = 0 if pos < 0
|
23
|
+
elsif len < 0
|
24
|
+
len = s.length + len - pos
|
25
|
+
end
|
26
|
+
return s[pos,len]
|
27
|
+
end
|
28
|
+
|
17
29
|
haxe_me
|
18
30
|
end
|
19
31
|
|
data/lib/lib/hx_sys.rb
CHANGED
data/lib/lib/rb/boot.rb
CHANGED
data/lib/lib/reflect.rb
CHANGED
data/lib/lib/value_type.rb
CHANGED
@@ -18,5 +18,6 @@
|
|
18
18
|
def ValueType.tobject() ValueType.new("TObject",4) end
|
19
19
|
def ValueType.tunknown() ValueType.new("TUnknown",8) end
|
20
20
|
CONSTRUCTS__ = ["TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"]
|
21
|
+
def ==(a) a.tag === @tag && a.index === @index && a.params == @params end
|
21
22
|
end
|
22
23
|
|
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.2.
|
4
|
+
version: 1.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-02-01 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Diff and patch tables
|
16
16
|
email:
|
@@ -34,14 +34,18 @@ files:
|
|
34
34
|
- lib/lib/coopy/cell_builder.rb
|
35
35
|
- lib/lib/coopy/compare_table.rb
|
36
36
|
- lib/lib/coopy/table_io.rb
|
37
|
+
- lib/lib/coopy/sql_compare.rb
|
37
38
|
- lib/lib/coopy/flat_cell_builder.rb
|
39
|
+
- lib/lib/coopy/nested_cell_builder.rb
|
38
40
|
- lib/lib/coopy/index_item.rb
|
39
41
|
- lib/lib/coopy/index_pair.rb
|
42
|
+
- lib/lib/coopy/sql_column.rb
|
40
43
|
- lib/lib/coopy/diff_render.rb
|
41
44
|
- lib/lib/coopy/cross_match.rb
|
42
45
|
- lib/lib/coopy/table_diff.rb
|
43
46
|
- lib/lib/coopy/alignment.rb
|
44
47
|
- lib/lib/coopy/terminal_diff_render.rb
|
48
|
+
- lib/lib/coopy/sql_table.rb
|
45
49
|
- lib/lib/coopy/table_modifier.rb
|
46
50
|
- lib/lib/coopy/highlight_patch.rb
|
47
51
|
- lib/lib/coopy/table_text.rb
|
@@ -51,15 +55,20 @@ files:
|
|
51
55
|
- lib/lib/coopy/coopy.rb
|
52
56
|
- lib/lib/coopy/cell_info.rb
|
53
57
|
- lib/lib/coopy/view.rb
|
58
|
+
- lib/lib/coopy/sql_table_name.rb
|
54
59
|
- lib/lib/coopy/highlight_patch_unit.rb
|
55
60
|
- lib/lib/coopy/compare_flags.rb
|
56
61
|
- lib/lib/coopy/unit.rb
|
57
62
|
- lib/lib/coopy/mover.rb
|
58
63
|
- lib/lib/coopy/table_comparison_state.rb
|
64
|
+
- lib/lib/coopy/sql_database.rb
|
59
65
|
- lib/lib/coopy/csv.rb
|
66
|
+
- lib/lib/coopy/sqlite_helper.rb
|
60
67
|
- lib/lib/coopy/ordering.rb
|
61
68
|
- lib/lib/coopy/merger.rb
|
69
|
+
- lib/lib/coopy/sql_helper.rb
|
62
70
|
- lib/lib/coopy/sparse_sheet.rb
|
71
|
+
- lib/lib/coopy/ndjson.rb
|
63
72
|
- lib/lib/coopy/table.rb
|
64
73
|
- lib/lib/coopy/viterbi.rb
|
65
74
|
- lib/lib/math.rb
|
@@ -112,7 +121,8 @@ summary: ! '[](http://badge.fury.io/js/daff)
|
113
122
|
[](http://badge.fury.io/rb/daff)
|
114
123
|
[](http://badge.fury.io/py/daff)
|
115
|
-
[](http://badge.fury.io/ph/paulfitz%2Fdaff-php)
|
124
|
+
[](http://badge.fury.io/ph/paulfitz%2Fdaff-php)
|
125
|
+
[](https://gratipay.com/paulfitz/) daff:
|
116
126
|
data diff =============== This is a library for comparing tables, producing a summary
|
117
127
|
of their differences, and using such a summary as a patch file. It is optimized
|
118
128
|
for comparing tables that share a common origin, in other words multiple versions
|
@@ -127,7 +137,7 @@ summary: ! '[ The
|
148
|
-
use `daff` as a library from any supported language. We
|
149
|
-
of Javascript. To use `daff` on a webpage, first include
|
150
|
-
src="daff.js"></script> ``` Or if using node outside
|
151
|
-
= require(''daff''); ``` For concreteness, assume we
|
152
|
-
`data1` and `data2`: ```js var data1 = [ [''Country'',''Capital''],
|
153
|
-
[''
|
154
|
-
[''
|
155
|
-
[''Germany'',''de'',''Berlin''] ]; ``` To make those
|
156
|
-
we wrap them in `daff.TableView`: ```js var table1
|
157
|
-
var table2 = new daff.TableView(data2); ``` We can
|
158
|
-
the rows and columns in the two tables: ```js
|
159
|
-
``` To produce a diff
|
160
|
-
|
161
|
-
|
162
|
-
= new daff.
|
163
|
-
diff is now in `data_diff` in highlighter
|
153
|
+
to make arrows prettier ```` Formats supported are CSV, TSV, and [ndjson](http://dataprotocols.org/ndjson/). Using
|
154
|
+
with git -------------- Run `daff git csv` to install daff as a diff and merge
|
155
|
+
handler for `*.csv` files in your repository. Run `daff git` for instructions on
|
156
|
+
doing this manually. Your CSV diffs and merges will get smarter, since git will
|
157
|
+
suddenly understand about rows and columns, not just lines:  The
|
158
|
+
library ----------- You can use `daff` as a library from any supported language. We
|
159
|
+
take here the example of Javascript. To use `daff` on a webpage, first include
|
160
|
+
`daff.js`: ```html <script src="daff.js"></script> ``` Or if using node outside
|
161
|
+
the browser: ```js var daff = require(''daff''); ``` For concreteness, assume we
|
162
|
+
have two versions of a table, `data1` and `data2`: ```js var data1 = [ [''Country'',''Capital''],
|
163
|
+
[''Ireland'',''Dublin''], [''France'',''Paris''], [''Spain'',''Barcelona''] ]; var
|
164
|
+
data2 = [ [''Country'',''Code'',''Capital''], [''Ireland'',''ie'',''Dublin''], [''France'',''fr'',''Paris''],
|
165
|
+
[''Spain'',''es'',''Madrid''], [''Germany'',''de'',''Berlin''] ]; ``` To make those
|
166
|
+
tables accessible to the library, we wrap them in `daff.TableView`: ```js var table1
|
167
|
+
= new daff.TableView(data1); var table2 = new daff.TableView(data2); ``` We can
|
168
|
+
now compute the alignment between the rows and columns in the two tables: ```js
|
169
|
+
var alignment = daff.compareTables(table1,table2).align(); ``` To produce a diff
|
170
|
+
from the alignment, we first need a table for the output: ```js var data_diff =
|
171
|
+
[]; var table_diff = new daff.TableView(data_diff); ``` Using default options for
|
172
|
+
the diff: ```js var flags = new daff.CompareFlags(); var highlighter = new daff.TableDiff(alignment,flags);
|
173
|
+
highlighter.hilite(table_diff); ``` The diff is now in `data_diff` in highlighter
|
174
|
+
format, see specification here: > http://share.find.coop/doc/spec_hilite.html ```js
|
164
175
|
[ [ ''!'', '''', ''+++'', '''' ], [ ''@@'', ''Country'', ''Code'', ''Capital'' ],
|
165
176
|
[ ''+'', ''Ireland'', ''ie'', ''Dublin'' ], [ ''+'', ''France'', ''fr'', ''Paris''
|
166
177
|
], [ ''->'', ''Spain'', ''es'', ''Barcelona->Madrid'' ], [ ''+++'', ''Germany'',
|