data-anonymization 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e3354956cfd68076ea4bc342f611a9934f2b7385
4
- data.tar.gz: ac064ad09012df2877aa29bd726c9e074749c7ec
3
+ metadata.gz: 796e8e4ec064ab6777e4bdd05e33a8dd0e3b2bd4
4
+ data.tar.gz: 6cb7c3f04d5686db81ff1d49b198ac4c14829d8d
5
5
  SHA512:
6
- metadata.gz: 11b75a2a68c5ec5f80049378a6a23c3b25a7f9368e7063febc5d88107e80dcc165498038e55f8d4b651fcbfd0e30489918be751f7a647f37a535cd8dd40cc2d6
7
- data.tar.gz: 65edc1aeaf200ed7ef0774801a690806f2256a60c43aa838ac8717e3f9e8466292cf22a339dac975ee88ae32efea541991c761dec6adc5be88bbbee5ae352a83
6
+ metadata.gz: 2c60fc5490fc788c83d532848b163aa7bbf66d6c33e1d7dc5a94ca5da1c2ef0270fc89b13870141b4f01b6f5bf9cae11931ada0ca89bdc0fb03bf42604849af1
7
+ data.tar.gz: a223340e8f64df4687eb91d22dd261b6e601fb262c82df07f4adc4c46f93713bc08e90db21ccc475b29160b6bc71072ba86743a0c88fc8521519a4627d660b86
@@ -1,10 +1,10 @@
1
1
  language: ruby
2
2
  services:
3
3
  - mongodb
4
+ before_install: gem install bundler -v 1.11.2
4
5
  before_script: rake empty_dest
5
6
  rvm:
6
7
  - 1.9.3
7
- - 2.0.0
8
- - 2.1.5
9
- - 2.2.2
10
- - ruby-head
8
+ - 2.1.8
9
+ - 2.2.4
10
+ - 2.3.0
data/README.md CHANGED
@@ -70,6 +70,9 @@ Postgresql database having **composite primary key**
70
70
 
71
71
  ## Changelog
72
72
 
73
+ #### 0.7.3 (Feb 5, 2016)
74
+ 1. Fixed issue with batchsize. Thanks to [Jan Raasch](https://github.com/janraasch) for sending pull request.
75
+
73
76
  #### 0.7.2 (Sep 26, 2015)
74
77
  1. Upgraded MongoDB to latest gem version 2.1.0 and tested with MongoDB 3.x version.
75
78
  2. Upgraded gems to latest version
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = DataAnonymization::VERSION
9
9
  gem.authors = ['Sunit Parekh', 'Anand Agrawal', 'Satyam Agarwala']
10
10
  gem.email = %w(parekh.sunit@gmail.com anand.agrawal84@gmail.com satyamag@gmail.com)
11
- gem.description = %q{Data anonymization tool for RDBMS databases}
12
- gem.summary = %q{Tool to create anonymized production data dump to use for PREF and other TEST environments.}
11
+ gem.description = %q{Data anonymization tool for RDBMS and MongoDB databases}
12
+ gem.summary = %q{Tool to create anonymized production data dump to use for performance and testing environments.}
13
13
  gem.homepage = 'http://sunitparekh.github.com/data-anonymization'
14
14
  gem.license = 'MIT'
15
15
 
@@ -76,14 +76,16 @@ module DataAnon
76
76
 
77
77
  def dest_table
78
78
  return @dest_table unless @dest_table.nil?
79
- DataAnon::Utils::DestinationDatabase.establish_connection @destination_database if @destination_database
80
- @dest_table = Utils::DestinationTable.create @name, @primary_keys
79
+ table_klass = Utils::DestinationTable.create @name, @primary_keys
80
+ table_klass.establish_connection @destination_database if @destination_database
81
+ @dest_table = table_klass
81
82
  end
82
83
 
83
84
  def source_table
84
85
  return @source_table unless @source_table.nil?
85
- DataAnon::Utils::SourceDatabase.establish_connection @source_database
86
- @source_table = Utils::SourceTable.create @name, @primary_keys
86
+ table_klass = Utils::SourceTable.create @name, @primary_keys
87
+ table_klass.establish_connection @source_database
88
+ @source_table = table_klass
87
89
  end
88
90
 
89
91
  def process
@@ -30,14 +30,17 @@ module DataAnon
30
30
  class BaseTable
31
31
 
32
32
  def self.create_table database, table_name, primary_keys = []
33
- Class.new(database) do
34
- self.table_name = table_name
35
- self.primary_keys = primary_keys if primary_keys.length > 1
36
- self.primary_key = primary_keys[0] if primary_keys.length == 1
37
- self.primary_key = nil if primary_keys.length == 0
38
- self.inheritance_column = :_type_disabled
39
- self.mass_assignment_sanitizer = MassAssignmentIgnoreSanitizer.new
40
- end
33
+ klass_name = table_name.to_s.downcase.capitalize
34
+ return database.const_get klass_name if database.const_defined? klass_name
35
+ database.const_set(klass_name, Class.new(database) do
36
+ self.table_name = table_name
37
+ self.primary_keys = primary_keys if primary_keys.length > 1
38
+ self.primary_key = primary_keys[0] if primary_keys.length == 1
39
+ self.primary_key = nil if primary_keys.length == 0
40
+ self.inheritance_column = :_type_disabled
41
+ self.mass_assignment_sanitizer = MassAssignmentIgnoreSanitizer.new
42
+ end
43
+ )
41
44
  end
42
45
 
43
46
  end
@@ -1,3 +1,3 @@
1
1
  module DataAnonymization
2
- VERSION = '0.7.2'
2
+ VERSION = '0.7.3'
3
3
  end
@@ -53,6 +53,29 @@ describe 'End 2 End RDBMS Whitelist Acceptance Test using SQLite database' do
53
53
  new_rec.updated_at.should == Time.new(2010,5,5)
54
54
  end
55
55
 
56
+ describe 'batch_size' do
57
+ it 'processes all records in batches' do
58
+ database 'Customer' do
59
+ strategy DataAnon::Strategy::Whitelist
60
+ source_db source_connection_spec
61
+ destination_db dest_connection_spec
62
+
63
+ table 'customers' do
64
+ batch_size 1
65
+ whitelist 'first_name'
66
+ end
67
+ end
68
+
69
+ DataAnon::Utils::DestinationDatabase.establish_connection dest_connection_spec
70
+ dest_table = DataAnon::Utils::DestinationTable.create 'customers'
71
+ dest_table.count.should == 2
72
+ first_rec = dest_table.first
73
+ first_rec.first_name.should eq('Sunit')
74
+ second_rec = dest_table.second
75
+ second_rec.first_name.should eq('Rohit')
76
+ end
77
+ end
78
+
56
79
  describe 'limiting' do
57
80
  it 'returns only last record' do
58
81
  database 'Customer' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data-anonymization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunit Parekh
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-10-11 00:00:00.000000000 Z
13
+ date: 2016-02-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -138,7 +138,7 @@ dependencies:
138
138
  - - "~>"
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0.19'
141
- description: Data anonymization tool for RDBMS databases
141
+ description: Data anonymization tool for RDBMS and MongoDB databases
142
142
  email:
143
143
  - parekh.sunit@gmail.com
144
144
  - anand.agrawal84@gmail.com
@@ -311,11 +311,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
311
311
  version: '0'
312
312
  requirements: []
313
313
  rubyforge_project:
314
- rubygems_version: 2.4.8
314
+ rubygems_version: 2.5.1
315
315
  signing_key:
316
316
  specification_version: 4
317
- summary: Tool to create anonymized production data dump to use for PREF and other
318
- TEST environments.
317
+ summary: Tool to create anonymized production data dump to use for performance and
318
+ testing environments.
319
319
  test_files:
320
320
  - spec/acceptance/mongodb_blacklist_spec.rb
321
321
  - spec/acceptance/mongodb_whitelist_spec.rb