daff 1.2.6 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -6
  3. data/bin/daff.rb +0 -0
  4. data/lib/daff.rb +6 -0
  5. data/lib/lib/coopy/alignment.rb +146 -169
  6. data/lib/lib/coopy/cell_builder.rb +1 -1
  7. data/lib/lib/coopy/cell_info.rb +2 -1
  8. data/lib/lib/coopy/column_change.rb +16 -0
  9. data/lib/lib/coopy/compare_flags.rb +33 -5
  10. data/lib/lib/coopy/compare_table.rb +219 -99
  11. data/lib/lib/coopy/coopy.rb +205 -99
  12. data/lib/lib/coopy/csv.rb +17 -22
  13. data/lib/lib/coopy/diff_render.rb +16 -8
  14. data/lib/lib/coopy/flat_cell_builder.rb +11 -8
  15. data/lib/lib/coopy/highlight_patch.rb +363 -63
  16. data/lib/lib/coopy/highlight_patch_unit.rb +1 -1
  17. data/lib/lib/coopy/index.rb +21 -8
  18. data/lib/lib/coopy/index_item.rb +7 -3
  19. data/lib/lib/coopy/index_pair.rb +13 -10
  20. data/lib/lib/coopy/merger.rb +3 -3
  21. data/lib/lib/coopy/meta.rb +17 -0
  22. data/lib/lib/coopy/mover.rb +7 -5
  23. data/lib/lib/coopy/ndjson.rb +2 -2
  24. data/lib/lib/coopy/nested_cell_builder.rb +7 -7
  25. data/lib/lib/coopy/ordering.rb +6 -2
  26. data/lib/lib/coopy/property_change.rb +16 -0
  27. data/lib/lib/coopy/row.rb +1 -0
  28. data/lib/lib/coopy/row_change.rb +42 -0
  29. data/lib/lib/coopy/row_stream.rb +11 -0
  30. data/lib/lib/coopy/simple_table.rb +84 -30
  31. data/lib/lib/coopy/simple_view.rb +8 -8
  32. data/lib/lib/coopy/sparse_sheet.rb +1 -1
  33. data/lib/lib/coopy/sql_column.rb +22 -10
  34. data/lib/lib/coopy/sql_compare.rb +397 -85
  35. data/lib/lib/coopy/sql_database.rb +2 -0
  36. data/lib/lib/coopy/sql_helper.rb +5 -0
  37. data/lib/lib/coopy/sql_table.rb +122 -19
  38. data/lib/lib/coopy/sql_table_name.rb +1 -1
  39. data/lib/lib/coopy/sqlite_helper.rb +250 -3
  40. data/lib/lib/coopy/table.rb +1 -0
  41. data/lib/lib/coopy/table_diff.rb +643 -464
  42. data/lib/lib/coopy/table_io.rb +19 -6
  43. data/lib/lib/coopy/table_modifier.rb +1 -1
  44. data/lib/lib/coopy/table_stream.rb +102 -0
  45. data/lib/lib/coopy/terminal_diff_render.rb +4 -3
  46. data/lib/lib/coopy/unit.rb +22 -2
  47. data/lib/lib/coopy/viterbi.rb +4 -4
  48. data/lib/lib/haxe/ds/int_map.rb +1 -1
  49. data/lib/lib/haxe/ds/string_map.rb +1 -1
  50. data/lib/lib/haxe/format/json_parser.rb +1 -1
  51. data/lib/lib/haxe/format/json_printer.rb +1 -1
  52. data/lib/lib/haxe/io/bytes.rb +2 -2
  53. data/lib/lib/haxe/io/eof.rb +1 -1
  54. data/lib/lib/haxe/io/output.rb +1 -1
  55. data/lib/lib/hx_overrides.rb +1 -1
  56. data/lib/lib/hx_sys.rb +9 -5
  57. data/lib/lib/lambda.rb +3 -3
  58. data/lib/lib/list.rb +1 -1
  59. data/lib/lib/rb/ruby_iterator.rb +2 -2
  60. data/lib/lib/reflect.rb +1 -1
  61. data/lib/lib/sys/io/file_output.rb +1 -1
  62. data/lib/lib/sys/io/hx_file.rb +1 -1
  63. data/lib/lib/x_list/list_iterator.rb +2 -2
  64. metadata +29 -25
  65. data/lib/lib/coopy/table_text.rb +0 -26
  66. data/lib/lib/haxe/io/bytes_buffer.rb +0 -19
  67. data/lib/lib/haxe/io/bytes_input.rb +0 -13
  68. data/lib/lib/haxe/io/bytes_output.rb +0 -33
  69. data/lib/lib/haxe/io/input.rb +0 -11
@@ -26,7 +26,7 @@ module Io
26
26
  s = b.get_string(p,l)
27
27
  r = @__f.write(s)
28
28
  raise hx_raise(::Haxe::Io::Error.custom("An error occurred")) if r < l
29
- return r
29
+ r
30
30
  end
31
31
 
32
32
  haxe_me ["sys", "io", "FileOutput"]
@@ -6,7 +6,7 @@ module Io
6
6
  class HxFile
7
7
 
8
8
  def HxFile.get_content(path)
9
- return IO.read(path)
9
+ IO.read(path)
10
10
  end
11
11
 
12
12
  def HxFile.save_content(path,content)
@@ -17,13 +17,13 @@ module X_List
17
17
  public
18
18
 
19
19
  def has_next
20
- return @head != nil
20
+ @head != nil
21
21
  end
22
22
 
23
23
  def _next
24
24
  @val = @head[0]
25
25
  @head = @head[1]
26
- return @val
26
+ @val
27
27
  end
28
28
 
29
29
  haxe_me ["_List", "ListIterator"]
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.6
4
+ version: 1.3.1
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-03-06 00:00:00.000000000 Z
12
+ date: 2015-09-18 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Diff and patch tables
15
15
  email:
@@ -26,6 +26,7 @@ files:
26
26
  - lib/lib/coopy/alignment.rb
27
27
  - lib/lib/coopy/cell_builder.rb
28
28
  - lib/lib/coopy/cell_info.rb
29
+ - lib/lib/coopy/column_change.rb
29
30
  - lib/lib/coopy/compare_flags.rb
30
31
  - lib/lib/coopy/compare_table.rb
31
32
  - lib/lib/coopy/coopy.rb
@@ -39,11 +40,15 @@ files:
39
40
  - lib/lib/coopy/index_item.rb
40
41
  - lib/lib/coopy/index_pair.rb
41
42
  - lib/lib/coopy/merger.rb
43
+ - lib/lib/coopy/meta.rb
42
44
  - lib/lib/coopy/mover.rb
43
45
  - lib/lib/coopy/ndjson.rb
44
46
  - lib/lib/coopy/nested_cell_builder.rb
45
47
  - lib/lib/coopy/ordering.rb
48
+ - lib/lib/coopy/property_change.rb
46
49
  - lib/lib/coopy/row.rb
50
+ - lib/lib/coopy/row_change.rb
51
+ - lib/lib/coopy/row_stream.rb
47
52
  - lib/lib/coopy/simple_table.rb
48
53
  - lib/lib/coopy/simple_view.rb
49
54
  - lib/lib/coopy/sparse_sheet.rb
@@ -59,7 +64,7 @@ files:
59
64
  - lib/lib/coopy/table_diff.rb
60
65
  - lib/lib/coopy/table_io.rb
61
66
  - lib/lib/coopy/table_modifier.rb
62
- - lib/lib/coopy/table_text.rb
67
+ - lib/lib/coopy/table_stream.rb
63
68
  - lib/lib/coopy/terminal_diff_render.rb
64
69
  - lib/lib/coopy/unit.rb
65
70
  - lib/lib/coopy/view.rb
@@ -70,12 +75,8 @@ files:
70
75
  - lib/lib/haxe/format/json_printer.rb
71
76
  - lib/lib/haxe/imap.rb
72
77
  - lib/lib/haxe/io/bytes.rb
73
- - lib/lib/haxe/io/bytes_buffer.rb
74
- - lib/lib/haxe/io/bytes_input.rb
75
- - lib/lib/haxe/io/bytes_output.rb
76
78
  - lib/lib/haxe/io/eof.rb
77
79
  - lib/lib/haxe/io/error.rb
78
- - lib/lib/haxe/io/input.rb
79
80
  - lib/lib/haxe/io/output.rb
80
81
  - lib/lib/hx_overrides.rb
81
82
  - lib/lib/hx_sys.rb
@@ -102,17 +103,17 @@ require_paths:
102
103
  - lib
103
104
  required_ruby_version: !ruby/object:Gem::Requirement
104
105
  requirements:
105
- - - ">="
106
+ - - '>='
106
107
  - !ruby/object:Gem::Version
107
108
  version: '0'
108
109
  required_rubygems_version: !ruby/object:Gem::Requirement
109
110
  requirements:
110
- - - ">="
111
+ - - '>='
111
112
  - !ruby/object:Gem::Version
112
113
  version: '0'
113
114
  requirements: []
114
115
  rubyforge_project:
115
- rubygems_version: 2.2.2
116
+ rubygems_version: 2.4.8
116
117
  signing_key:
117
118
  specification_version: 4
118
119
  summary: '[![Build Status](https://travis-ci.org/paulfitz/daff.svg?branch=master)](https://travis-ci.org/paulfitz/daff)
@@ -153,7 +154,7 @@ summary: '[![Build Status](https://travis-ci.org/paulfitz/daff.svg?branch=master
153
154
  with git -------------- Run `daff git csv` to install daff as a diff and merge
154
155
  handler for `*.csv` files in your repository. Run `daff git` for instructions on
155
156
  doing this manually. Your CSV diffs and merges will get smarter, since git will
156
- suddenly understand about rows and columns, not just lines: ![Example CSV diff](scripts/diff.png) The
157
+ suddenly understand about rows and columns, not just lines: ![Example CSV diff](http://paulfitz.github.io/daff-doc/images/daff_vs_diff.png) The
157
158
  library ----------- You can use `daff` as a library from any supported language. We
158
159
  take here the example of Javascript. To use `daff` on a webpage, first include
159
160
  `daff.js`: ```html <script src="daff.js"></script> ``` Or if using node outside
@@ -183,30 +184,33 @@ summary: '[![Build Status](https://travis-ci.org/paulfitz/daff.svg?branch=master
183
184
  how to apply that difference as a patch: ```js var patcher = new daff.HighlightPatch(table1,table_diff);
184
185
  patcher.apply(); // table1 should now equal table2 ``` For other languages, you
185
186
  should find sample code in the packages on the [Releases](https://github.com/paulfitz/daff/releases)
186
- page. Supported languages ------------------- The `daff` library is written in
187
+ page. Supported languages ------------------- The `daff` library is written in
187
188
  [Haxe](http://haxe.org/), which can be translated reasonably well into at least
188
189
  the following languages: * Javascript * Python * Java * C# * C++ * Ruby (using
189
190
  an [unofficial haxe target](https://github.com/paulfitz/haxe) developed for `daff`) *
190
191
  PHP Some translations are done for you on the [Releases](https://github.com/paulfitz/daff/releases)
191
- page. To make another translation, follow the [Haxe getting started tutorial](http://haxe.org/doc/start)
192
- for the language you care about, then do one of: ``` make js make php make py make
193
- java make cs make cpp ``` For each language, the `daff` library expects to be handed
194
- an interface to tables you create, rather than creating them itself. This is to
195
- avoid inefficient copies from one format to another. You''ll find a `SimpleTable`
196
- class you can use if you find this awkward. Other possibilities: * There''s a
197
- daff wrapper for R written by [Edwin de Jonge](https://github.com/edwindj), see
198
- https://github.com/edwindj/daff and http://cran.r-project.org/web/packages/daff
199
- * There''s a hand-written ruby port by [James Smith](https://github.com/Floppy),
200
- see https://github.com/theodi/coopy-ruby API documentation ----------------- *
201
- You can browse the `daff` classes at http://paulfitz.github.io/daff-doc/ Sponsors
192
+ page. To make another translation, or to compile from source first follow the [Haxe
193
+ getting started tutorial](http://haxe.org/doc/start) for the language you care about. At
194
+ the time of writing, if you are on OSX, you should install haxe using `brew install
195
+ haxe --HEAD`. Then do one of: ``` make js make php make py make java make cs make
196
+ cpp ``` For each language, the `daff` library expects to be handed an interface
197
+ to tables you create, rather than creating them itself. This is to avoid inefficient
198
+ copies from one format to another. You''ll find a `SimpleTable` class you can use
199
+ if you find this awkward. Other possibilities: * There''s a daff wrapper for R
200
+ written by [Edwin de Jonge](https://github.com/edwindj), see https://github.com/edwindj/daff
201
+ and http://cran.r-project.org/web/packages/daff * There''s a hand-written ruby port
202
+ by [James Smith](https://github.com/Floppy), see https://github.com/theodi/coopy-ruby API
203
+ documentation ----------------- * You can browse the `daff` classes at http://paulfitz.github.io/daff-doc/ Sponsors
202
204
  -------- The [Data Commons Co-op](http://datacommons.coop), "perhaps the geekiest
203
205
  of all cooperative organizations on the planet," has given great moral support during
204
206
  the initial development of `daff`. There''s currently no financial support for `daff`.
205
207
  You could change that! [![tips](https://img.shields.io/gratipay/paulfitz.svg)](https://gratipay.com/paulfitz/) Reading
206
208
  material ---------------- * http://dataprotocols.org/tabular-diff-format/ : a specification
207
209
  of the diff format we use. * http://theodi.org/blog/csvhub-github-diffs-for-csv-files
208
- : using this library with github. * http://theodi.org/blog/adapting-git-simple-data
209
- : using this library with gitlab. * http://okfnlabs.org/blog/2013/08/08/diffing-and-patching-data.html
210
+ : using this library with github. * https://github.com/ropensci/unconf/issues/19
211
+ : a thread about diffing data in which daff shows up in at least four guises (see
212
+ if you can spot them all). * http://theodi.org/blog/adapting-git-simple-data : using
213
+ this library with gitlab. * http://okfnlabs.org/blog/2013/08/08/diffing-and-patching-data.html
210
214
  : a summary of where the library came from. * http://blog.okfn.org/2013/07/02/git-and-github-for-data/
211
215
  : a post about storing small data in git/github. * http://blog.ouseful.info/2013/08/27/diff-or-chop-github-csv-data-files-and-openrefine/
212
216
  : counterpoint - a post discussing tracked-changes rather than diffs. ## License daff
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Coopy
5
- class TableText
6
-
7
- def initialize(tab)
8
- @tab = tab
9
- @view = tab.get_cell_view
10
- end
11
-
12
- protected
13
-
14
- attr_accessor :tab
15
- attr_accessor :view
16
-
17
- public
18
-
19
- def get_cell_text(x,y)
20
- return @view.to_s(@tab.get_cell(x,y))
21
- end
22
-
23
- haxe_me
24
- end
25
-
26
- end
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Haxe
5
- module Io
6
- class BytesBuffer
7
-
8
- # protected - in ruby this doesn't play well with static/inline methods
9
-
10
- attr_accessor :b
11
-
12
- public
13
-
14
- attr_accessor :length
15
- haxe_me
16
- end
17
-
18
- end
19
- end
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Haxe
5
- module Io
6
- class BytesInput < ::Haxe::Io::Input
7
- attr_accessor :position
8
- attr_accessor :length
9
- haxe_me
10
- end
11
-
12
- end
13
- end
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Haxe
5
- module Io
6
- class BytesOutput < ::Haxe::Io::Output
7
-
8
- # protected - in ruby this doesn't play well with static/inline methods
9
-
10
- attr_accessor :b
11
-
12
- public
13
-
14
- attr_accessor :length
15
-
16
- def write_byte(c)
17
- @b.b.concat(c)
18
- end
19
-
20
-
21
- def write_bytes(buf,pos,len)
22
- begin
23
- raise hx_raise(::Haxe::Io::Error.outside_bounds) if pos < 0 || len < 0 || pos + len > buf.length
24
- @b.b += buf.b.byteslice(pos,len)
25
- end
26
- return len
27
- end
28
-
29
- haxe_me
30
- end
31
-
32
- end
33
- end
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
-
4
- module Haxe
5
- module Io
6
- class Input
7
- haxe_me
8
- end
9
-
10
- end
11
- end