data-anonymization 0.8.2 → 0.8.6

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
- SHA1:
3
- metadata.gz: ea71406f4d69385841297c63312abbfe0a1ded34
4
- data.tar.gz: 6309e4f2155021c42c80aa561dc5ddd2cd4999f7
2
+ SHA256:
3
+ metadata.gz: b68a0165fb4a1e2d34cbb026f48b1bfe7fcdb78f14528d6df3882c8de0ef3cab
4
+ data.tar.gz: e3c810e9c58f27486fc28bb7f5c1dbd293da16c3c7e814bbd465598c3b245b02
5
5
  SHA512:
6
- metadata.gz: 6e3fde8664f03c76c8939e14899dc0ded79559e6b016ebdc966b2a6095964b3f1888286f4c09a0a42226d4a475a905e8249f5a9463530c87592455432f36a4f3
7
- data.tar.gz: 407caf0cec3c9962efa62272493b80cdf65acdcd49c33e799546419cad94157456733fad89a28f0c8523e1d92902193e2511f6d1fff98dff4a1194d68b4fc45c
6
+ metadata.gz: 4aabc744c832fa3bda18d9d20884792bc1870733e5dbb1dad328e611243359f237b419be686f1ac58eab6d45516a112ee4f05a1499ae621fc59bb252964d2cd7
7
+ data.tar.gz: 6376e641eecf9c113ef330ca40f72bc1f8b26ce9f16894aa35374e2258e65ee559a374a277f8462bcd839cc53568f61bedcaf98988715fbb3a6116488322102a
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.4.1
1
+ ruby-2.7.5
data/.travis.yml CHANGED
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
2
  services:
3
3
  - mongodb
4
- before_install: gem install bundler -v 1.15.3
4
+ before_install: gem install bundler
5
5
  before_script: rake empty_dest
6
6
  rvm:
7
- - 2.2.6
8
- - 2.3.3
9
- - 2.4.1
7
+ - 2.5.9
8
+ - 2.6.9
9
+ - 2.7.5
10
+ - 3.1.0
data/README.md CHANGED
@@ -81,6 +81,9 @@ Postgresql database having **composite primary key**
81
81
 
82
82
  ## Changelog
83
83
 
84
+ #### 0.8.5 (May 28, 2020)
85
+ 1. Upgraded to rails 6.x
86
+
84
87
  #### 0.8.1 (Aug 19, 2017)
85
88
  1. Multi-threading support added by [stanislav-tyutin](https://github.com/stanislav-tyutin) using Pull Request.
86
89
  2. Fixed to work with Ruby 2.4.x, issue with Integer data type
data/commands.txt ADDED
@@ -0,0 +1,4 @@
1
+ bundle update
2
+ bundle outdated
3
+
4
+ bundle exec rake
@@ -19,12 +19,12 @@ Gem::Specification.new do |gem|
19
19
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
20
  gem.require_paths = ['lib']
21
21
 
22
- gem.add_dependency('activerecord', '~> 5.1')
23
- gem.add_dependency('composite_primary_keys', '~> 10.0')
24
- gem.add_dependency('activesupport', '~> 5.1')
25
- gem.add_dependency('rgeo', '~> 1.0')
26
- gem.add_dependency('rgeo-geojson', '~> 2.0')
27
- gem.add_dependency('powerbar', '~> 1.0')
28
- gem.add_dependency('parallel', '~> 1.12')
29
- gem.add_dependency('thor', '~> 0.20')
22
+ gem.add_dependency('activerecord', '~> 6.1')
23
+ gem.add_dependency('activesupport', '~> 6.1')
24
+ gem.add_dependency('composite_primary_keys', '~> 13.0')
25
+ gem.add_dependency('parallel', '~> 1.20')
26
+ gem.add_dependency('powerbar', '~> 2.0')
27
+ gem.add_dependency('rgeo', '~> 2.3')
28
+ gem.add_dependency('rgeo-geojson', '~> 2.1')
29
+ gem.add_dependency('thor', '~> 1.1')
30
30
  end
@@ -3,15 +3,16 @@ module DataAnon
3
3
  class Blacklist < DataAnon::Strategy::Base
4
4
 
5
5
  def process_record index, record
6
+ updates = {}
6
7
  @fields.each do |field, strategy|
7
8
  database_field_name = record.attributes.select { |k,v| k == field }.keys[0]
8
9
  field_value = record.attributes[database_field_name]
9
10
  unless field_value.nil? || is_primary_key?(database_field_name)
10
11
  field = DataAnon::Core::Field.new(database_field_name, field_value, index, record, @name)
11
- record[database_field_name] = strategy.anonymize(field)
12
+ updates[database_field_name] = strategy.anonymize(field)
12
13
  end
13
14
  end
14
- record.save!
15
+ record.update_columns(updates) if updates.any?
15
16
  end
16
17
 
17
18
  end
@@ -58,8 +58,8 @@ module DataAnon
58
58
  month = @anonymize_month? DataAnon::Utils::RandomInt.generate(1,12) : original_time.month
59
59
  days_in_month = Time.new(year,month,1,1,1,1).end_of_month.day
60
60
  day = @anonymize_day? DataAnon::Utils::RandomInt.generate(1,days_in_month) : original_time.day
61
- hour = @anonymize_hour? DataAnon::Utils::RandomInt.generate(1,24) : original_time.hour
62
- min = @anonymize_min? DataAnon::Utils::RandomInt.generate(1,60) : original_time.min
61
+ hour = @anonymize_hour? DataAnon::Utils::RandomInt.generate(0,23) : original_time.hour
62
+ min = @anonymize_min? DataAnon::Utils::RandomInt.generate(0,59) : original_time.min
63
63
  sec = original_time.sec
64
64
 
65
65
  create_object(year, month, day, hour, min, sec)
@@ -74,4 +74,4 @@ module DataAnon
74
74
  end
75
75
  end
76
76
  end
77
- end
77
+ end
@@ -16,7 +16,7 @@ module DataAnon
16
16
  end
17
17
 
18
18
  def anonymize field
19
- return BigDecimal.new("#{field.value + DataAnon::Utils::RandomFloat.generate(-@delta, +@delta)}")
19
+ return BigDecimal("#{field.value + DataAnon::Utils::RandomFloat.generate(-@delta, +@delta)}")
20
20
  end
21
21
 
22
22
  end
@@ -25,7 +25,7 @@ module DataAnon
25
25
 
26
26
  def self.create_table database, table_name, primary_keys = []
27
27
  klass_name = table_name.to_s.downcase.capitalize
28
- return database.const_get klass_name if database.const_defined? klass_name
28
+ return database.const_get(klass_name, false) if database.const_defined?(klass_name, false)
29
29
  database.const_set(klass_name, Class.new(database) do
30
30
  self.table_name = table_name
31
31
  self.primary_keys = primary_keys if primary_keys.length > 1
@@ -4,8 +4,8 @@ module DataAnon
4
4
 
5
5
  def self.generate min, max
6
6
  return 0 if (min == 0 && max == 0)
7
- Random.new.rand min...max
7
+ Random.new.rand min..max
8
8
  end
9
9
  end
10
10
  end
11
- end
11
+ end
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DataAnonymization
2
- VERSION = '0.8.2'
2
+ VERSION = '0.8.6'
3
3
  end
@@ -95,7 +95,7 @@ describe 'End 2 End MongoDB Whitelist Acceptance Test' do
95
95
  feature1 = plan['features'][0]
96
96
  [10737418240, 21474836480, 53687091200].should include(feature1['max_storage'])
97
97
  feature1['type'].should == 'AmazonS3'
98
- feature1['users']['max'].should be_kind_of(Fixnum)
98
+ feature1['users']['max'].should be_kind_of(Integer)
99
99
  [true,false].should include(feature1['users']['additional'])
100
100
 
101
101
 
@@ -29,14 +29,14 @@ describe FieldStrategy::DefaultAnon do
29
29
  let(:field) {DataAnon::Core::Field.new('int_field',2,1,nil)}
30
30
  let(:anonymized_value) {DefaultAnon.new.anonymize(field)}
31
31
 
32
- it { anonymized_value.should be_kind_of Fixnum }
32
+ it { anonymized_value.should be_kind_of Integer }
33
33
  end
34
34
 
35
35
  describe 'anonymized bignum value' do
36
36
  let(:field) {DataAnon::Core::Field.new('int_field',2348723489723847382947,1,nil)}
37
37
  let(:anonymized_value) {DefaultAnon.new.anonymize(field)}
38
38
 
39
- it { anonymized_value.should be_kind_of Bignum }
39
+ it { anonymized_value.should be_kind_of Integer }
40
40
  end
41
41
 
42
42
  describe 'anonymized string value' do
@@ -4,7 +4,7 @@ require 'bigdecimal'
4
4
  describe FieldStrategy::RandomBigDecimalDelta do
5
5
 
6
6
  RandomBigDecimalDelta = FieldStrategy::RandomBigDecimalDelta
7
- let(:field) {DataAnon::Core::Field.new('decimal_field',BigDecimal.new("53422342378687687342893.23324"),1,nil)}
7
+ let(:field) {DataAnon::Core::Field.new('decimal_field',BigDecimal("53422342378687687342893.23324"),1,nil)}
8
8
 
9
9
  describe 'anonymized big decimal should not be the same as original value' do
10
10
  let(:anonymized_value) {RandomBigDecimalDelta.new.anonymize(field)}
@@ -16,10 +16,10 @@ describe 'Utils' do
16
16
  album.all.length > 0
17
17
  end
18
18
 
19
- it 'should test the connection to destination database' do
20
- album = DataAnon::Utils::DestinationTable.create 'Album', ['AlbumId']
21
- album.count.should == 0
22
- album.all.length == 0
19
+ it 'ignores inherited constants when creating a table with matching name' do
20
+ conditionals = DataAnon::Utils::SourceTable.create 'Conditionals'
21
+ conditionals.count.should == 0
22
+ conditionals.all.length == 0
23
23
  end
24
24
 
25
25
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data-anonymization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunit Parekh
8
8
  - Anand Agrawal
9
9
  - Satyam Agarwala
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-03-07 00:00:00.000000000 Z
13
+ date: 2022-01-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -18,58 +18,58 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '5.1'
21
+ version: '6.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - "~>"
27
27
  - !ruby/object:Gem::Version
28
- version: '5.1'
28
+ version: '6.1'
29
29
  - !ruby/object:Gem::Dependency
30
- name: composite_primary_keys
30
+ name: activesupport
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '10.0'
35
+ version: '6.1'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '10.0'
42
+ version: '6.1'
43
43
  - !ruby/object:Gem::Dependency
44
- name: activesupport
44
+ name: composite_primary_keys
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '5.1'
49
+ version: '13.0'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '5.1'
56
+ version: '13.0'
57
57
  - !ruby/object:Gem::Dependency
58
- name: rgeo
58
+ name: parallel
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '1.0'
63
+ version: '1.20'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '1.0'
70
+ version: '1.20'
71
71
  - !ruby/object:Gem::Dependency
72
- name: rgeo-geojson
72
+ name: powerbar
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - "~>"
@@ -83,47 +83,47 @@ dependencies:
83
83
  - !ruby/object:Gem::Version
84
84
  version: '2.0'
85
85
  - !ruby/object:Gem::Dependency
86
- name: powerbar
86
+ name: rgeo
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '1.0'
91
+ version: '2.3'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '1.0'
98
+ version: '2.3'
99
99
  - !ruby/object:Gem::Dependency
100
- name: parallel
100
+ name: rgeo-geojson
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: '1.12'
105
+ version: '2.1'
106
106
  type: :runtime
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '1.12'
112
+ version: '2.1'
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: thor
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: '0.20'
119
+ version: '1.1'
120
120
  type: :runtime
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - "~>"
125
125
  - !ruby/object:Gem::Version
126
- version: '0.20'
126
+ version: '1.1'
127
127
  description: Data anonymization tool for RDBMS and MongoDB databases
128
128
  email:
129
129
  - parekh.sunit@gmail.com
@@ -146,6 +146,7 @@ files:
146
146
  - README.md
147
147
  - Rakefile
148
148
  - bin/datanon
149
+ - commands.txt
149
150
  - data-anonymization.gemspec
150
151
  - examples/blacklist_dsl.rb
151
152
  - examples/mongodb_blacklist_dsl.rb
@@ -282,7 +283,7 @@ homepage: http://sunitparekh.github.com/data-anonymization
282
283
  licenses:
283
284
  - MIT
284
285
  metadata: {}
285
- post_install_message:
286
+ post_install_message:
286
287
  rdoc_options: []
287
288
  require_paths:
288
289
  - lib
@@ -297,9 +298,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
298
  - !ruby/object:Gem::Version
298
299
  version: '0'
299
300
  requirements: []
300
- rubyforge_project:
301
- rubygems_version: 2.6.12
302
- signing_key:
301
+ rubygems_version: 3.1.6
302
+ signing_key:
303
303
  specification_version: 4
304
304
  summary: Tool to create anonymized production data dump to use for performance and
305
305
  testing environments.