daff 1.3.2 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/daff.rb +11 -2
- data/lib/lib/coopy/alignment.rb +26 -2
- data/lib/lib/coopy/combined_table.rb +127 -0
- data/lib/lib/coopy/combined_table_body.rb +151 -0
- data/lib/lib/coopy/combined_table_head.rb +103 -0
- data/lib/lib/coopy/compare_flags.rb +3 -0
- data/lib/lib/coopy/compare_table.rb +38 -2
- data/lib/lib/coopy/coopy.rb +188 -110
- data/lib/lib/coopy/csv.rb +22 -3
- data/lib/lib/coopy/diff_render.rb +38 -10
- data/lib/lib/coopy/highlight_patch.rb +1 -1
- data/lib/lib/coopy/index.rb +8 -1
- data/lib/lib/coopy/json_table.rb +165 -0
- data/lib/lib/coopy/json_tables.rb +129 -0
- data/lib/lib/coopy/meta.rb +3 -0
- data/lib/lib/coopy/simple_meta.rb +314 -0
- data/lib/lib/coopy/simple_table.rb +4 -0
- data/lib/lib/coopy/simple_view.rb +12 -0
- data/lib/lib/coopy/sql_compare.rb +114 -66
- data/lib/lib/coopy/sql_table.rb +18 -2
- data/lib/lib/coopy/sql_tables.rb +128 -0
- data/lib/lib/coopy/sqlite_helper.rb +23 -1
- data/lib/lib/coopy/table.rb +1 -0
- data/lib/lib/coopy/table_comparison_state.rb +15 -0
- data/lib/lib/coopy/table_diff.rb +115 -5
- data/lib/lib/coopy/tables.rb +52 -0
- data/lib/lib/coopy/terminal_diff_render.rb +24 -8
- data/lib/lib/coopy/view.rb +3 -0
- data/lib/lib/rb/boot.rb +19 -0
- data/lib/lib/reflect.rb +10 -0
- data/lib/lib/std.rb +12 -0
- metadata +27 -16
@@ -4,8 +4,14 @@
|
|
4
4
|
module Coopy
|
5
5
|
class TerminalDiffRender
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize(flags = nil)
|
8
8
|
@align_columns = true
|
9
|
+
@wide_columns = false
|
10
|
+
@flags = flags
|
11
|
+
if flags != nil
|
12
|
+
@align_columns = false if flags.padding_strategy == "dense"
|
13
|
+
@wide_columns = true if flags.padding_strategy == "sparse"
|
14
|
+
end
|
9
15
|
end
|
10
16
|
|
11
17
|
protected
|
@@ -15,6 +21,8 @@ module Coopy
|
|
15
21
|
attr_accessor :csv
|
16
22
|
attr_accessor :v
|
17
23
|
attr_accessor :align_columns
|
24
|
+
attr_accessor :wide_columns
|
25
|
+
attr_accessor :flags
|
18
26
|
|
19
27
|
public
|
20
28
|
|
@@ -47,25 +55,32 @@ module Coopy
|
|
47
55
|
while(_g < h)
|
48
56
|
y = _g
|
49
57
|
_g+=1
|
58
|
+
target = 0
|
59
|
+
at = 0
|
50
60
|
begin
|
51
61
|
_g1 = 0
|
52
62
|
while(_g1 < w)
|
53
63
|
x = _g1
|
54
64
|
_g1+=1
|
55
65
|
txt += _hx_str(@codes["minor"]) + "," + _hx_str(@codes["done"]) if x > 0
|
56
|
-
txt += self.get_text(x,y,true)
|
57
66
|
if sizes != nil
|
58
|
-
|
67
|
+
spaces = target - at
|
59
68
|
begin
|
60
|
-
|
61
|
-
_g2
|
62
|
-
|
63
|
-
|
64
|
-
_g3+=1
|
69
|
+
_g2 = 0
|
70
|
+
while(_g2 < spaces)
|
71
|
+
i = _g2
|
72
|
+
_g2+=1
|
65
73
|
txt += " "
|
74
|
+
at+=1
|
66
75
|
end
|
67
76
|
end
|
68
77
|
end
|
78
|
+
txt += self.get_text(x,y,true)
|
79
|
+
if sizes != nil
|
80
|
+
bit = self.get_text(x,y,false)
|
81
|
+
at += bit.length
|
82
|
+
target += sizes[x]
|
83
|
+
end
|
69
84
|
end
|
70
85
|
end
|
71
86
|
txt += "\r\n"
|
@@ -157,6 +172,7 @@ module Coopy
|
|
157
172
|
if mmin != -1
|
158
173
|
most = mmin if most < mmin
|
159
174
|
end
|
175
|
+
most = full if @wide_columns
|
160
176
|
sizes.push(most)
|
161
177
|
total += most
|
162
178
|
end
|
data/lib/lib/coopy/view.rb
CHANGED
@@ -11,6 +11,9 @@ module Coopy
|
|
11
11
|
def isHash(h) puts "Abstract View.isHash called" end
|
12
12
|
def hashExists(h,str) puts "Abstract View.hashExists called" end
|
13
13
|
def hashGet(h,str) puts "Abstract View.hashGet called" end
|
14
|
+
def isTable(t) puts "Abstract View.isTable called" end
|
15
|
+
def getTable(t) puts "Abstract View.getTable called" end
|
16
|
+
def wrapTable(t) puts "Abstract View.wrapTable called" end
|
14
17
|
haxe_me ["coopy", "View"]
|
15
18
|
end
|
16
19
|
|
data/lib/lib/rb/boot.rb
CHANGED
@@ -14,6 +14,25 @@ module Rb
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
public
|
18
|
+
|
19
|
+
def Boot.__instanceof(o,cl)
|
20
|
+
return false if cl == nil
|
21
|
+
if cl == Fixnum
|
22
|
+
return o.is_a? Fixnum
|
23
|
+
elsif cl == Float
|
24
|
+
return o.is_a?(Float) || o.is_a?(Fixnum)
|
25
|
+
elsif cl == TrueClass
|
26
|
+
return ((o.is_a? TrueClass)||(o.is_a? FalseClass))
|
27
|
+
elsif cl == String
|
28
|
+
return o.is_a? String
|
29
|
+
else
|
30
|
+
return true if cl == Object
|
31
|
+
return false if o == nil
|
32
|
+
return o.is_a?(cl)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
17
36
|
haxe_me ["rb", "Boot"]
|
18
37
|
end
|
19
38
|
|
data/lib/lib/reflect.rb
CHANGED
data/lib/lib/std.rb
ADDED
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.6
|
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: 2015-
|
12
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Diff and patch tables
|
15
15
|
email:
|
@@ -27,6 +27,9 @@ files:
|
|
27
27
|
- lib/lib/coopy/cell_builder.rb
|
28
28
|
- lib/lib/coopy/cell_info.rb
|
29
29
|
- lib/lib/coopy/column_change.rb
|
30
|
+
- lib/lib/coopy/combined_table.rb
|
31
|
+
- lib/lib/coopy/combined_table_body.rb
|
32
|
+
- lib/lib/coopy/combined_table_head.rb
|
30
33
|
- lib/lib/coopy/compare_flags.rb
|
31
34
|
- lib/lib/coopy/compare_table.rb
|
32
35
|
- lib/lib/coopy/coopy.rb
|
@@ -39,6 +42,8 @@ files:
|
|
39
42
|
- lib/lib/coopy/index.rb
|
40
43
|
- lib/lib/coopy/index_item.rb
|
41
44
|
- lib/lib/coopy/index_pair.rb
|
45
|
+
- lib/lib/coopy/json_table.rb
|
46
|
+
- lib/lib/coopy/json_tables.rb
|
42
47
|
- lib/lib/coopy/merger.rb
|
43
48
|
- lib/lib/coopy/meta.rb
|
44
49
|
- lib/lib/coopy/mover.rb
|
@@ -49,6 +54,7 @@ files:
|
|
49
54
|
- lib/lib/coopy/row.rb
|
50
55
|
- lib/lib/coopy/row_change.rb
|
51
56
|
- lib/lib/coopy/row_stream.rb
|
57
|
+
- lib/lib/coopy/simple_meta.rb
|
52
58
|
- lib/lib/coopy/simple_table.rb
|
53
59
|
- lib/lib/coopy/simple_view.rb
|
54
60
|
- lib/lib/coopy/sparse_sheet.rb
|
@@ -58,6 +64,7 @@ files:
|
|
58
64
|
- lib/lib/coopy/sql_helper.rb
|
59
65
|
- lib/lib/coopy/sql_table.rb
|
60
66
|
- lib/lib/coopy/sql_table_name.rb
|
67
|
+
- lib/lib/coopy/sql_tables.rb
|
61
68
|
- lib/lib/coopy/sqlite_helper.rb
|
62
69
|
- lib/lib/coopy/table.rb
|
63
70
|
- lib/lib/coopy/table_comparison_state.rb
|
@@ -65,6 +72,7 @@ files:
|
|
65
72
|
- lib/lib/coopy/table_io.rb
|
66
73
|
- lib/lib/coopy/table_modifier.rb
|
67
74
|
- lib/lib/coopy/table_stream.rb
|
75
|
+
- lib/lib/coopy/tables.rb
|
68
76
|
- lib/lib/coopy/terminal_diff_render.rb
|
69
77
|
- lib/lib/coopy/unit.rb
|
70
78
|
- lib/lib/coopy/view.rb
|
@@ -86,6 +94,7 @@ files:
|
|
86
94
|
- lib/lib/rb/boot.rb
|
87
95
|
- lib/lib/rb/ruby_iterator.rb
|
88
96
|
- lib/lib/reflect.rb
|
97
|
+
- lib/lib/std.rb
|
89
98
|
- lib/lib/string_buf.rb
|
90
99
|
- lib/lib/sys/io/file_handle.rb
|
91
100
|
- lib/lib/sys/io/file_output.rb
|
@@ -121,16 +130,17 @@ summary: '[![Build Status](https://travis-ci.org/paulfitz/daff.svg?branch=master
|
|
121
130
|
[![Gem Version](https://badge.fury.io/rb/daff.svg)](http://badge.fury.io/rb/daff)
|
122
131
|
[![PyPI version](https://badge.fury.io/py/daff.svg)](http://badge.fury.io/py/daff)
|
123
132
|
[![PHP version](https://badge.fury.io/ph/paulfitz%2Fdaff-php.svg)](http://badge.fury.io/ph/paulfitz%2Fdaff-php)
|
124
|
-
[![
|
125
|
-
data diff =============== This
|
126
|
-
|
127
|
-
|
128
|
-
of the "same" table. For
|
129
|
-
|
130
|
-
|
131
|
-
php install.packages(''daff'')
|
132
|
-
|
133
|
-
|
133
|
+
[![Bower version](https://badge.fury.io/bo/daff.svg)](http://badge.fury.io/bo/daff)
|
134
|
+
![Badge count](http://img.shields.io/:badges-7/7-33aa33.svg) daff: data diff =============== This
|
135
|
+
is a library for comparing tables, producing a summary of their differences, and
|
136
|
+
using such a summary as a patch file. It is optimized for comparing tables that
|
137
|
+
share a common origin, in other words multiple versions of the "same" table. For
|
138
|
+
a live demo, see: > http://paulfitz.github.com/daff/ Install the library for your
|
139
|
+
favorite language: ````sh npm install daff -g # node/javascript pip install daff #
|
140
|
+
python gem install daff # ruby composer require paulfitz/daff-php # php install.packages(''daff'')
|
141
|
+
# R wrapper by Edwin de Jonge bower install daff # web/javascript ```` Other
|
142
|
+
translations are available here: > https://github.com/paulfitz/daff/releases Or
|
143
|
+
use the library to view csv diffs on github via a chrome extension: > https://github.com/theodi/csvhub The
|
134
144
|
diff format used by `daff` is specified here: > http://dataprotocols.org/tabular-diff-format/ This
|
135
145
|
library is a stripped down version of the coopy toolbox (see http://share.find.coop). To
|
136
146
|
compare tables from different origins, or with automatically generated IDs, or
|
@@ -201,10 +211,11 @@ summary: '[![Build Status](https://travis-ci.org/paulfitz/daff.svg?branch=master
|
|
201
211
|
and http://cran.r-project.org/web/packages/daff * There''s a hand-written ruby port
|
202
212
|
by [James Smith](https://github.com/Floppy), see https://github.com/theodi/coopy-ruby API
|
203
213
|
documentation ----------------- * You can browse the `daff` classes at http://paulfitz.github.io/daff-doc/ Sponsors
|
204
|
-
--------
|
205
|
-
of
|
206
|
-
the
|
207
|
-
|
214
|
+
-------- <img src="http://datacommons.coop/images/the_zen_of_venn.png" alt="the
|
215
|
+
zen of venn" height="100"> The [Data Commons Co-op](http://datacommons.coop), "perhaps
|
216
|
+
the geekiest of all cooperative organizations on the planet," has given great moral
|
217
|
+
support during the development of `daff`. Donate a multiple of `42.42` in your currency
|
218
|
+
to let them know you care: [http://datacommons.coop/donate/](http://datacommons.coop/donate/) Reading
|
208
219
|
material ---------------- * http://dataprotocols.org/tabular-diff-format/ : a specification
|
209
220
|
of the diff format we use. * http://theodi.org/blog/csvhub-github-diffs-for-csv-files
|
210
221
|
: using this library with github. * https://github.com/ropensci/unconf/issues/19
|