toku 0.1.0.4 → 0.1.0.4.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 +4 -4
- data/lib/toku.rb +10 -1
- data/lib/toku/filters/column_filter.rb +2 -1
- data/lib/toku/filters/row_filter.rb +3 -0
- data/lib/toku/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1333d67e1c83413fa3f553e9497e19ab9ccdacd4
|
4
|
+
data.tar.gz: 7f1b6a614639e5885ce2e682045824d101be60d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dafea67269e244cd83d02f403578b6d52ab6c46cb915adcc542bb31757dde94be1ae8b9a1341aa54469674fd3f06d8620b82171bbad1deeade4fd97bf81cfb45
|
7
|
+
data.tar.gz: 02e452d1cc15793ed3b000fa7b550860e781d8501e6b6e36d8c5f8c97c031fe37a8fc47540d348635b9e21e3e0b4d8c2a409015e39057e32ecd584df9e281166
|
data/lib/toku.rb
CHANGED
@@ -7,7 +7,7 @@ module Toku
|
|
7
7
|
attr_accessor :column_filters
|
8
8
|
attr_accessor :row_filters
|
9
9
|
|
10
|
-
# A few default filters mappings
|
10
|
+
# A few default column filters mappings
|
11
11
|
COLUMN_FILTER_MAP = {
|
12
12
|
none: Toku::ColumnFilter::Passthrough,
|
13
13
|
faker_last_name: Toku::ColumnFilter::FakerLastName,
|
@@ -15,6 +15,7 @@ module Toku
|
|
15
15
|
faker_email: Toku::ColumnFilter::FakerEmail
|
16
16
|
}
|
17
17
|
|
18
|
+
# A few default row filters mappings
|
18
19
|
ROW_FILTER_MAP = {
|
19
20
|
drop: Toku::RowFilter::Drop
|
20
21
|
}
|
@@ -28,6 +29,7 @@ module Toku
|
|
28
29
|
|
29
30
|
# @param [String] uri_db_source URI of the DB to be anonimized
|
30
31
|
# @param [String] uri_db_destination URI of the destination DB
|
32
|
+
# @return [void]
|
31
33
|
def run(uri_db_source, uri_db_destination)
|
32
34
|
|
33
35
|
source_db = Sequel.connect(uri_db_source)
|
@@ -80,12 +82,19 @@ module Toku
|
|
80
82
|
end.join(",") + "\n"
|
81
83
|
end
|
82
84
|
|
85
|
+
# Is the source database schema a subset of the destination database schema?
|
86
|
+
# @param source_db [String] URI of source database
|
87
|
+
# @param destination_db [String] URI of destination database
|
88
|
+
# @return [Boolean]
|
83
89
|
def source_schema_included?(source_db, destination_db)
|
84
90
|
source_db.tables.all? do |table|
|
85
91
|
source_db.schema(table) == destination_db.schema(table)
|
86
92
|
end
|
87
93
|
end
|
88
94
|
|
95
|
+
# Are there row filters specified for this table?
|
96
|
+
# @param table [Symbol]
|
97
|
+
# @return [Boolean]
|
89
98
|
def row_filters?(table)
|
90
99
|
!@config[table.to_s]['rows'].nil? && @config[table.to_s]['rows'].any?
|
91
100
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Toku
|
2
2
|
class ColumnFilter
|
3
|
-
# @param
|
3
|
+
# @param value [Object] initial value for the column
|
4
|
+
# @param options [Hash{String => Object}] arguments passed to the filter
|
4
5
|
def initialize(value, options)
|
5
6
|
@value = value
|
6
7
|
end
|
data/lib/toku/version.rb
CHANGED