fake_pipe 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +35 -33
- data/fake_pipe.gemspec +1 -1
- data/lib/fake_pipe/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c07b29d1ab2b3d32b98fab8942abe59e0ce45559
|
4
|
+
data.tar.gz: 0726decc0dc8929f3de8d5502ec9f4d0ab530eda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f0a8dfc6281091f53a60b2aef2ca19716eb076c3a891b114d60ef6460bcc7f34313041732f97654c10d353e6bf0e67909d2a22ca7e820855aa0d8a23395ac28
|
7
|
+
data.tar.gz: 57a1e3265c29828b8ef43933724921e0b1a752e706a1689a072905099a67feea9ba090c88598ffcf371f78162610b5935fff8c68f73240eea43a7edebf4f0604
|
data/README.md
CHANGED
@@ -5,42 +5,21 @@ for exporting to various departments for analytics and troubleshooting. This to
|
|
5
5
|
allows us to annotate a DB schema with special comments that can trigger
|
6
6
|
different data mutations
|
7
7
|
|
8
|
-
|
8
|
+
## Workflow with Fake Pipe
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
Here's how FakePipe could work in a projects lifecycle. These steps assume a
|
13
|
-
Postgres database:
|
10
|
+
Here's how FakePipe could work in a project's lifecycle. These steps assume
|
11
|
+
you're using Postgres database:
|
14
12
|
|
15
13
|
1. Add comment to table column: `COMMENT ON COLUMN user.phone IS 'anon: phone_number';`.
|
16
14
|
2. Pipe DB dump to fake_pipe: `pg_dump my_db | fake_pipe > anon-db-dump.sql`.
|
17
15
|
3. Send `anon-db-dump.sql` to needy people.
|
18
16
|
|
19
17
|
|
20
|
-
## Basic Class Diagram
|
21
|
-
|
22
|
-
TODO This is subject to change!
|
23
|
-
|
24
|
-
+---------------+ +----------------------------------+
|
25
|
-
| Piper | | DatabaseAdapter/PostgresAdapter |
|
26
|
-
| * stdin | | * match comments |
|
27
|
-
| * stdout +-------> * match dml |
|
28
|
-
| * main loop | | * delegate.on_cell(name, cell) |
|
29
|
-
| * def on_cell | | |
|
30
|
-
| | +----------------------------------+
|
31
|
-
| |
|
32
|
-
| | +-----------------+
|
33
|
-
| | | Mutator |
|
34
|
-
| +-------> * phone_number |
|
35
|
-
+---------------+ | * email |
|
36
|
-
| |
|
37
|
-
+-----------------+
|
38
|
-
|
39
18
|
# Comment Dialect
|
40
19
|
|
41
20
|
Schema columns comments are in [YAML format](http://www.yaml.org/start.html).
|
42
21
|
Using some of it's option quoting, it can look very much like JSON. The reason
|
43
|
-
it was chosen over JSON is
|
22
|
+
it was chosen over JSON is for the optional quotes. That means the following
|
44
23
|
syntax will resolve to the same Ruby definition:
|
45
24
|
|
46
25
|
```
|
@@ -59,20 +38,43 @@ Any keys unknown by FakePipe will be ignored. So annotations from other system
|
|
59
38
|
shouldn't interfere. We do hope the abbreviated YAML syntax is simple to parse
|
60
39
|
by all systems.
|
61
40
|
|
62
|
-
## Currently Support
|
41
|
+
## Currently Support Mutation Methods
|
63
42
|
|
64
43
|
To get a current list try running `rake methods` from terminal.
|
65
44
|
|
66
45
|
```sh
|
67
46
|
$ rake methods
|
68
|
-
anon:
|
69
|
-
anon:
|
70
|
-
anon:
|
47
|
+
anon: address_city # Faker::Address.city
|
48
|
+
anon: address_country # Faker::Address.country
|
49
|
+
anon: address_line_1 # Faker::Address.street_address
|
50
|
+
anon: address_line_2 # Faker::Address.secondary_address
|
51
|
+
anon: address_postcode # Faker::Address.postcode
|
52
|
+
anon: address_state # Faker::Address.state
|
53
|
+
anon: bcrypt_password # bcrypt password as 'password'
|
54
|
+
anon: bcrypt_salt # bcrypt salt used to generate password
|
55
|
+
anon: clean_phone_number # Faker::PhoneNumber 10-digits only
|
56
|
+
anon: company_catch_phrase # Faker::Company.catch_phrase
|
57
|
+
anon: company_name # Faker::Company.name
|
58
|
+
anon: email # Faker email
|
59
|
+
anon: empty_bracket # an empty bracket '[]' - good for json::array objects
|
60
|
+
anon: empty_curly # an empty curly brace '{}' - good for json object and array fields
|
61
|
+
anon: empty_string # an empty String
|
62
|
+
anon: first_name # Faker::Name.first_name
|
63
|
+
anon: full_name # Faker::Name.full_name
|
64
|
+
anon: guid # UUID
|
65
|
+
anon: last_name # Faker::Name.last_name
|
66
|
+
anon: lorem_paragraph # Faker::Lorem.paragraph
|
67
|
+
anon: lorem_sentence # Faker::Lorem.sentence
|
68
|
+
anon: lorem_word # Faker::Lorem.word
|
69
|
+
anon: md5 # MD5 hash of cell contents
|
70
|
+
anon: phone_ext # Faker::PhoneNumber.extension
|
71
|
+
anon: phone_number # Faker::PhoneNumber with punctuation and extensions
|
72
|
+
anon: ugcid # Six random uppercase letters followed by four random numbers - ex. 'ABCDEF1234'
|
73
|
+
anon: url # Faker::Internet.url
|
74
|
+
anon: user_name # Faker::Internet.user_name
|
75
|
+
anon: uuid # UUID
|
71
76
|
```
|
72
77
|
|
73
|
-
TODO clean up README. The following is default stock from `bundle gem ...`
|
74
|
-
|
75
|
-
|
76
78
|
# Decisions
|
77
79
|
- 2016-06-08
|
78
80
|
- parsing SQL file is okay for now. Reconsider using a temp DB when
|
@@ -114,7 +116,7 @@ git commits and tags, and push the `.gem` file to
|
|
114
116
|
## Contributing
|
115
117
|
|
116
118
|
Bug reports and pull requests are welcome on GitHub at
|
117
|
-
https://github.com/
|
119
|
+
https://github.com/ddrscott/fake_pipe.
|
118
120
|
|
119
121
|
|
120
122
|
## License
|
data/fake_pipe.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Scott Pierce']
|
10
10
|
spec.email = ['ddrscott@gmail.com']
|
11
11
|
|
12
|
-
spec.summary = '
|
12
|
+
spec.summary = 'Anonymize a database SQL dump file by adding schema comments and piping through `fake_pipe`'
|
13
13
|
spec.homepage = 'https://github.com/centro/fake_pipe'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
data/lib/fake_pipe/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fake_pipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Pierce
|
@@ -133,5 +133,6 @@ rubyforge_project:
|
|
133
133
|
rubygems_version: 2.6.13
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
|
-
summary:
|
136
|
+
summary: Anonymize a database SQL dump file by adding schema comments and piping through
|
137
|
+
`fake_pipe`
|
137
138
|
test_files: []
|