witsec 0.1.0 → 0.1.2

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
  SHA256:
3
- metadata.gz: 4ac7324ae9480a4bbabaca4d462bb4205a2fa470b1f872c7226f3a809c2c588f
4
- data.tar.gz: 1d2fa60ac0531ad1f010f74658f7a6aeadddd0f343fc4712f9cc2f0caeb097d2
3
+ metadata.gz: f9efdb6fa50bf7dfccc53c018e720fba3ecca0bc700f030f3a094782bae65cd6
4
+ data.tar.gz: 57d8ff0a76ae65f6069d375877ba5d46c4a85f23f3378d3448b5d221f8fcbf40
5
5
  SHA512:
6
- metadata.gz: d580f3f361aaac94331a2935c7ed79da3e82106925f1c0012bc6b6e5319de1e77e1a28e295a8c47eb0ab42c8cec56a11f69b1363034397633fbdf37964750a56
7
- data.tar.gz: c46f2392c59e03d4b81ab353c4e83b1c928eaf7974b21e3e6e55c70707fc33b3b9a5937d2990fd8bb47d2a69d3a3b5b481c777b2e5454472d8efe52de58f4e9b
6
+ metadata.gz: 3fb14f542f8044531e8197907cacb81920cdc49443fc19bd6082496e271e051f41e6ae04ff80218cae72700f25f06a60b407ffc10f18c57a4c85fc73d8c1ff6f
7
+ data.tar.gz: 260e6e6467b1f8888fdb9779cc1d534cd7f069060a25722a6f9e8c37149d33a04f9fc1dd21b990e7150dbd6201b8db879d34b5f6fa3a6df53d7eaf96d07691d6
data/Rakefile CHANGED
@@ -1,3 +1,9 @@
1
1
  require "bundler/setup"
2
-
3
2
  require "bundler/gem_tasks"
3
+ require "rake/testtask"
4
+
5
+ task default: :test
6
+ Rake::TestTask.new do |t|
7
+ t.libs << "test"
8
+ t.pattern = "test/*_test.rb"
9
+ end
@@ -4,6 +4,8 @@ module Witsec
4
4
 
5
5
  def initialize
6
6
  @schema = instance_eval(File.read("config/witsec/schema.rb"))
7
+
8
+ check_input_and_output_are_different
7
9
  end
8
10
 
9
11
  attr_reader :schema
@@ -74,6 +76,14 @@ module Witsec
74
76
 
75
77
  private
76
78
 
79
+ def check_input_and_output_are_different
80
+ return if Rails.env.test?
81
+
82
+ if input_connection_pool.lease_connection.current_database == output_connection_pool.lease_connection.current_database
83
+ raise Witsec::InputAndOutputDatabasesAreTheSame, "You've probably forgotten to setup the output database. It must be named anonymized."
84
+ end
85
+ end
86
+
77
87
  def input_database_configuration
78
88
  Rails.configuration.database_configuration[Rails.env]["primary"]
79
89
  end
@@ -1,3 +1,3 @@
1
1
  module Witsec
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/witsec.rb CHANGED
@@ -5,5 +5,6 @@ require "witsec/anonymizer"
5
5
  require "witsec/schema"
6
6
 
7
7
  module Witsec
8
- # Your code goes here...
8
+ class InputAndOutputDatabasesAreTheSame < StandardError
9
+ end
9
10
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: witsec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolai Bach Woller
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-02-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
- rubygems_version: 3.6.2
105
+ rubygems_version: 3.6.7
106
106
  specification_version: 4
107
107
  summary: Anonymize your database for dumping
108
108
  test_files: []