toku 0.1.0 → 0.1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a28d71264c08bd9a4e7fb28ba09b15c31ba48a57
4
- data.tar.gz: 2818fa86da6e86ce6763dbda685e02d46288036e
3
+ metadata.gz: 67d6e00338c1d49735debcaf61650c850b838994
4
+ data.tar.gz: 45d23c0bca9a5403ab90e5c1f3c10d0886efb00a
5
5
  SHA512:
6
- metadata.gz: 5e7c7968f76acccab091e5909fac96205e69cbaefc2dcdd735a56d5dd47987027e1e0f086ed550e862a80628e214ea80198b26d429fb36cc81c5cd9026dbec4e
7
- data.tar.gz: ba307d99a54bf305eac18232f14f2f7fa3f80b67e5466f287e7d89c8d0c2f9a2bd83b4c6692cac4f3536cdf861ef343a5f1b74e025cafb6a885301e62bfb1fd7
6
+ metadata.gz: 01227a3efdcbd534c1efa543a9981da54d746e08afa543df5d1a4b84cb8f5341bd7a949286b849d14d736b7855f868b115e171bc8facb36d0fa4f324e94d34dc
7
+ data.tar.gz: 0b1b22fa0273d02f3270cdc7700871ad36ded10f9b3fd2b47ec607ec99063aa1a25a1596ffeb56e6dc04f6f94a7ecce739c916ec94eac99e0e837e2d0a77eef0
@@ -37,21 +37,20 @@ module Toku
37
37
  source_db.extension(:pg_streaming)
38
38
 
39
39
  source_db.tables.each do |table|
40
- if @config[table.to_s]['columns'].count < source_db.from(table).columns.count
40
+ if !row_filters?(table) && @config[table.to_s]['columns'].count < source_db.from(table).columns.count
41
41
  raise Toku::ColumnFilterMissingError
42
42
  end
43
43
 
44
44
  row_enumerator = source_db[table].stream.to_enum
45
45
 
46
46
  @config[table.to_s]['rows'].each do |f|
47
- row_filter = self.row_filters[f.keys.first.to_sym]
48
47
  if f.is_a? String
49
- options = nil
48
+ row_filter = self.row_filters[f.to_sym].new
50
49
  elsif f.is_a? Hash
51
- options = f.values.first
50
+ row_filter = self.row_filters[f.keys.first.to_sym].new(f.values.first)
52
51
  end
53
52
 
54
- row_enumerator = row_filter.new(options).call(row_enumerator)
53
+ row_enumerator = row_filter.call(row_enumerator)
55
54
  end
56
55
 
57
56
  row_enumerator = row_enumerator.map { |row| transform(row, table) }
@@ -71,5 +70,9 @@ module Toku
71
70
  source_db.schema(table) == destination_db.schema(table)
72
71
  end
73
72
  end
73
+
74
+ def row_filters?(table)
75
+ !@config[table.to_s]['rows'].nil? && @config[table.to_s]['rows'].any?
76
+ end
74
77
  end
75
78
  end
@@ -2,7 +2,7 @@ module Toku
2
2
  class RowFilter
3
3
  class Drop < Toku::RowFilter
4
4
  def call(stream)
5
- stream.each { |row| nil }
5
+ stream.select { |row| false }
6
6
  end
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Toku
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.0.1"
3
3
  end
@@ -6,7 +6,7 @@ require 'toku/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "toku"
8
8
  spec.version = Toku::VERSION
9
- spec.authors = ["PSKL"]
9
+ spec.authors = ["PSKL", "lordofthelake"]
10
10
  spec.email = ["hello@pascal.cc"]
11
11
 
12
12
  spec.summary = %q{Anonymize a database, fast}
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PSKL
8
+ - lordofthelake
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2017-12-28 00:00:00.000000000 Z
12
+ date: 2017-12-29 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler