sample_data_dump 0.0.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 +7 -0
- data/.gitignore +1 -0
- data/.reek.yml +32 -0
- data/.rspec +2 -0
- data/.rspec_status +9 -0
- data/.rubocop.yml +61 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +28 -0
- data/Gemfile.lock +189 -0
- data/Guardfile +16 -0
- data/README.md +27 -0
- data/lib/sample_data_dump/entities/table_configuration.rb +19 -0
- data/lib/sample_data_dump/interfaces/persistence.rb +47 -0
- data/lib/sample_data_dump/types.rb +9 -0
- data/lib/sample_data_dump/use_cases/actor_downloads_sample_data_files.rb +34 -0
- data/lib/sample_data_dump/use_cases/actor_dumps_sample_data_to_files.rb +34 -0
- data/lib/sample_data_dump/use_cases/actor_loads_sample_data_files.rb +42 -0
- data/lib/sample_data_dump/use_cases/actor_uploads_sample_data_files.rb +34 -0
- data/lib/sample_data_dump/version.rb +5 -0
- data/lib/sample_data_dump.rb +3 -0
- data/sample_data_dump.gemspec +40 -0
- metadata +177 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 9cc7e8b7228910401bba4a6183eae46a28c4a3b2
|
|
4
|
+
data.tar.gz: 2170275aa22f92f616dc221695fdd291bad88ef8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: be2af199d1d6d3ff13e4b9c49a181cc96aa8fcc573fcc12a64e2d199e5b69548acd1fa8a98d35b29448e9cb1dfabb0687af5b8f86127bb83c60a14ee7e516566
|
|
7
|
+
data.tar.gz: 43044756c988a517ec8b76474ed4963b70d33e4e13b8d731d7e2ef02f0cb392b45c1c5ffe9321350f301c7f8407bd2514499d2b08e9fe54b40c70e196d212a4a
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
coverage/
|
data/.reek.yml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
detectors:
|
|
3
|
+
IrresponsibleModule:
|
|
4
|
+
enabled: false
|
|
5
|
+
TooManyStatements:
|
|
6
|
+
enabled: true
|
|
7
|
+
max_statements: 10
|
|
8
|
+
NilCheck:
|
|
9
|
+
enabled: false
|
|
10
|
+
directories:
|
|
11
|
+
app/controllers:
|
|
12
|
+
NestedIterators:
|
|
13
|
+
max_allowed_nesting: 2
|
|
14
|
+
UnusedPrivateMethod:
|
|
15
|
+
enabled: false
|
|
16
|
+
app/helpers:
|
|
17
|
+
UtilityFunction:
|
|
18
|
+
enabled: false
|
|
19
|
+
exclude_paths:
|
|
20
|
+
- app/assets
|
|
21
|
+
- bin
|
|
22
|
+
- client/node_modules
|
|
23
|
+
- config
|
|
24
|
+
- coverage
|
|
25
|
+
- data
|
|
26
|
+
- db
|
|
27
|
+
- dw
|
|
28
|
+
- log
|
|
29
|
+
- phrase
|
|
30
|
+
- public
|
|
31
|
+
- tmp
|
|
32
|
+
- vendor
|
data/.rspec
ADDED
data/.rspec_status
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
example_id | status | run_time |
|
|
2
|
+
-------------------------------------------------------------------------------------- | ------ | --------------- |
|
|
3
|
+
./spec/duckface/acts_as_interface_spec.rb[1:1:1:1:1] | passed | 0.00232 seconds |
|
|
4
|
+
./spec/duckface/acts_as_interface_spec.rb[1:1:1:1:2] | passed | 0.00333 seconds |
|
|
5
|
+
./spec/lib/sample_data_dump/entities/table_configuration_spec.rb[1:1:1] | passed | 0.00021 seconds |
|
|
6
|
+
./spec/lib/sample_data_dump/use_cases/actor_downloads_sample_data_files_spec.rb[1:1:1] | passed | 0.01413 seconds |
|
|
7
|
+
./spec/lib/sample_data_dump/use_cases/actor_dumps_sample_data_to_files_spec.rb[1:1:1] | passed | 0.00108 seconds |
|
|
8
|
+
./spec/lib/sample_data_dump/use_cases/actor_loads_sample_data_files_spec.rb[1:1:1] | passed | 0.00174 seconds |
|
|
9
|
+
./spec/lib/sample_data_dump/use_cases/actor_uploads_sample_data_files_spec.rb[1:1:1] | passed | 0.001 seconds |
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
Documentation:
|
|
3
|
+
Enabled: false
|
|
4
|
+
Rails:
|
|
5
|
+
Enabled: true
|
|
6
|
+
AllCops:
|
|
7
|
+
Include:
|
|
8
|
+
- app/**/*.rb
|
|
9
|
+
- lib/**/*.rb
|
|
10
|
+
- spec/**/*.rb
|
|
11
|
+
Exclude:
|
|
12
|
+
- app/assets/**/*
|
|
13
|
+
- bin/**/*
|
|
14
|
+
- client/node_modules/**/*
|
|
15
|
+
- config/**/*
|
|
16
|
+
- coverage/**/*
|
|
17
|
+
- data/**/*
|
|
18
|
+
- db/**/*
|
|
19
|
+
- db_*/**/*
|
|
20
|
+
- dw/**/*
|
|
21
|
+
- log/**/*
|
|
22
|
+
- phrase/**/*
|
|
23
|
+
- public/**/*
|
|
24
|
+
- tmp/**/*
|
|
25
|
+
- vendor/**/*
|
|
26
|
+
TargetRubyVersion: 2.4
|
|
27
|
+
Metrics/LineLength:
|
|
28
|
+
Max: 100
|
|
29
|
+
Layout/MultilineMethodCallIndentation:
|
|
30
|
+
EnforcedStyle: indented
|
|
31
|
+
Style/PercentLiteralDelimiters:
|
|
32
|
+
PreferredDelimiters:
|
|
33
|
+
"%w": "[]"
|
|
34
|
+
RSpec/ExampleLength:
|
|
35
|
+
Enabled: false
|
|
36
|
+
Max: 10
|
|
37
|
+
RSpec/MultipleExpectations:
|
|
38
|
+
Enabled: false
|
|
39
|
+
Max: 10
|
|
40
|
+
RSpec/NestedGroups:
|
|
41
|
+
Enabled: false
|
|
42
|
+
Max: 10
|
|
43
|
+
RSpec/MessageExpectation:
|
|
44
|
+
Enabled: false
|
|
45
|
+
RSpec/MissingExampleGroupArgument:
|
|
46
|
+
Enabled: false
|
|
47
|
+
require:
|
|
48
|
+
- rubocop-rspec
|
|
49
|
+
- test_prof/rubocop
|
|
50
|
+
Metrics/BlockLength:
|
|
51
|
+
Enabled: false
|
|
52
|
+
RSpec/MessageSpies:
|
|
53
|
+
Enabled: false
|
|
54
|
+
RSpec/ExpectInHook:
|
|
55
|
+
Enabled: false
|
|
56
|
+
RSpec/AggregateFailures:
|
|
57
|
+
Enabled: true
|
|
58
|
+
Include:
|
|
59
|
+
- spec/**/*.rb
|
|
60
|
+
Rails/InverseOf:
|
|
61
|
+
Enabled: false
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.4.5
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
|
|
5
|
+
# Specify your gem's dependencies in bellroy-products.gemspec
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
group :development, :test do
|
|
9
|
+
gem 'guard-rspec'
|
|
10
|
+
gem 'pry-byebug'
|
|
11
|
+
gem 'rb-fsevent', require: false
|
|
12
|
+
gem 'rb-readline'
|
|
13
|
+
gem 'reek'
|
|
14
|
+
gem 'rspec'
|
|
15
|
+
gem 'rubocop'
|
|
16
|
+
gem 'rubocop-rspec'
|
|
17
|
+
gem 'shoulda-matchers', require: false
|
|
18
|
+
gem 'stackprof'
|
|
19
|
+
gem 'timecop'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
group :development do
|
|
23
|
+
gem 'pry'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
group :test do
|
|
27
|
+
gem 'simplecov'
|
|
28
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
sample_data_dump (0.0.1)
|
|
5
|
+
dry-matcher
|
|
6
|
+
dry-monads
|
|
7
|
+
dry-struct
|
|
8
|
+
dry-types
|
|
9
|
+
duckface-interfaces
|
|
10
|
+
|
|
11
|
+
GEM
|
|
12
|
+
remote: https://rubygems.org/
|
|
13
|
+
specs:
|
|
14
|
+
activesupport (5.2.0)
|
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
16
|
+
i18n (>= 0.7, < 2)
|
|
17
|
+
minitest (~> 5.1)
|
|
18
|
+
tzinfo (~> 1.1)
|
|
19
|
+
ast (2.4.0)
|
|
20
|
+
axiom-types (0.1.1)
|
|
21
|
+
descendants_tracker (~> 0.0.4)
|
|
22
|
+
ice_nine (~> 0.11.0)
|
|
23
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
24
|
+
byebug (10.0.2)
|
|
25
|
+
codeclimate-engine-rb (0.4.1)
|
|
26
|
+
virtus (~> 1.0)
|
|
27
|
+
coderay (1.1.2)
|
|
28
|
+
coercible (1.0.0)
|
|
29
|
+
descendants_tracker (~> 0.0.1)
|
|
30
|
+
concurrent-ruby (1.0.5)
|
|
31
|
+
descendants_tracker (0.0.4)
|
|
32
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
|
33
|
+
diff-lcs (1.3)
|
|
34
|
+
docile (1.3.1)
|
|
35
|
+
dry-configurable (0.7.0)
|
|
36
|
+
concurrent-ruby (~> 1.0)
|
|
37
|
+
dry-container (0.6.0)
|
|
38
|
+
concurrent-ruby (~> 1.0)
|
|
39
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
|
40
|
+
dry-core (0.4.7)
|
|
41
|
+
concurrent-ruby (~> 1.0)
|
|
42
|
+
dry-equalizer (0.2.1)
|
|
43
|
+
dry-inflector (0.1.2)
|
|
44
|
+
dry-logic (0.4.2)
|
|
45
|
+
dry-container (~> 0.2, >= 0.2.6)
|
|
46
|
+
dry-core (~> 0.2)
|
|
47
|
+
dry-equalizer (~> 0.2)
|
|
48
|
+
dry-matcher (0.7.0)
|
|
49
|
+
dry-monads (1.1.0)
|
|
50
|
+
concurrent-ruby (~> 1.0)
|
|
51
|
+
dry-core (~> 0.4, >= 0.4.4)
|
|
52
|
+
dry-equalizer
|
|
53
|
+
dry-struct (0.6.0)
|
|
54
|
+
dry-core (~> 0.4, >= 0.4.3)
|
|
55
|
+
dry-equalizer (~> 0.2)
|
|
56
|
+
dry-types (~> 0.13)
|
|
57
|
+
ice_nine (~> 0.11)
|
|
58
|
+
dry-types (0.13.3)
|
|
59
|
+
concurrent-ruby (~> 1.0)
|
|
60
|
+
dry-container (~> 0.3)
|
|
61
|
+
dry-core (~> 0.4, >= 0.4.4)
|
|
62
|
+
dry-equalizer (~> 0.2)
|
|
63
|
+
dry-inflector (~> 0.1, >= 0.1.2)
|
|
64
|
+
dry-logic (~> 0.4, >= 0.4.2)
|
|
65
|
+
duckface-interfaces (0.0.3)
|
|
66
|
+
equalizer (0.0.11)
|
|
67
|
+
ffi (1.9.25)
|
|
68
|
+
formatador (0.2.5)
|
|
69
|
+
guard (2.14.2)
|
|
70
|
+
formatador (>= 0.2.4)
|
|
71
|
+
listen (>= 2.7, < 4.0)
|
|
72
|
+
lumberjack (>= 1.0.12, < 2.0)
|
|
73
|
+
nenv (~> 0.1)
|
|
74
|
+
notiffany (~> 0.0)
|
|
75
|
+
pry (>= 0.9.12)
|
|
76
|
+
shellany (~> 0.0)
|
|
77
|
+
thor (>= 0.18.1)
|
|
78
|
+
guard-compat (1.2.1)
|
|
79
|
+
guard-rspec (4.7.3)
|
|
80
|
+
guard (~> 2.1)
|
|
81
|
+
guard-compat (~> 1.1)
|
|
82
|
+
rspec (>= 2.99.0, < 4.0)
|
|
83
|
+
i18n (1.0.1)
|
|
84
|
+
concurrent-ruby (~> 1.0)
|
|
85
|
+
ice_nine (0.11.2)
|
|
86
|
+
jaro_winkler (1.5.1)
|
|
87
|
+
json (2.1.0)
|
|
88
|
+
kwalify (0.7.2)
|
|
89
|
+
listen (3.1.5)
|
|
90
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
91
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
|
92
|
+
ruby_dep (~> 1.2)
|
|
93
|
+
lumberjack (1.0.13)
|
|
94
|
+
method_source (0.9.0)
|
|
95
|
+
minitest (5.11.3)
|
|
96
|
+
nenv (0.3.0)
|
|
97
|
+
notiffany (0.1.1)
|
|
98
|
+
nenv (~> 0.1)
|
|
99
|
+
shellany (~> 0.0)
|
|
100
|
+
parallel (1.12.1)
|
|
101
|
+
parser (2.5.1.2)
|
|
102
|
+
ast (~> 2.4.0)
|
|
103
|
+
powerpack (0.1.2)
|
|
104
|
+
pry (0.11.3)
|
|
105
|
+
coderay (~> 1.1.0)
|
|
106
|
+
method_source (~> 0.9.0)
|
|
107
|
+
pry-byebug (3.6.0)
|
|
108
|
+
byebug (~> 10.0)
|
|
109
|
+
pry (~> 0.10)
|
|
110
|
+
rainbow (3.0.0)
|
|
111
|
+
rake (12.3.1)
|
|
112
|
+
rb-fsevent (0.10.3)
|
|
113
|
+
rb-inotify (0.9.10)
|
|
114
|
+
ffi (>= 0.5.0, < 2)
|
|
115
|
+
rb-readline (0.5.5)
|
|
116
|
+
reek (5.0.2)
|
|
117
|
+
codeclimate-engine-rb (~> 0.4.0)
|
|
118
|
+
kwalify (~> 0.7.0)
|
|
119
|
+
parser (>= 2.5.0.0, < 2.6, != 2.5.1.1)
|
|
120
|
+
rainbow (>= 2.0, < 4.0)
|
|
121
|
+
rspec (3.8.0)
|
|
122
|
+
rspec-core (~> 3.8.0)
|
|
123
|
+
rspec-expectations (~> 3.8.0)
|
|
124
|
+
rspec-mocks (~> 3.8.0)
|
|
125
|
+
rspec-core (3.8.0)
|
|
126
|
+
rspec-support (~> 3.8.0)
|
|
127
|
+
rspec-expectations (3.8.0)
|
|
128
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
129
|
+
rspec-support (~> 3.8.0)
|
|
130
|
+
rspec-mocks (3.8.0)
|
|
131
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
132
|
+
rspec-support (~> 3.8.0)
|
|
133
|
+
rspec-support (3.8.0)
|
|
134
|
+
rubocop (0.58.2)
|
|
135
|
+
jaro_winkler (~> 1.5.1)
|
|
136
|
+
parallel (~> 1.10)
|
|
137
|
+
parser (>= 2.5, != 2.5.1.1)
|
|
138
|
+
powerpack (~> 0.1)
|
|
139
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
140
|
+
ruby-progressbar (~> 1.7)
|
|
141
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
|
142
|
+
rubocop-rspec (1.27.0)
|
|
143
|
+
rubocop (>= 0.56.0)
|
|
144
|
+
ruby-progressbar (1.9.0)
|
|
145
|
+
ruby_dep (1.5.0)
|
|
146
|
+
shellany (0.0.1)
|
|
147
|
+
shoulda-matchers (3.1.2)
|
|
148
|
+
activesupport (>= 4.0.0)
|
|
149
|
+
simplecov (0.16.1)
|
|
150
|
+
docile (~> 1.1)
|
|
151
|
+
json (>= 1.8, < 3)
|
|
152
|
+
simplecov-html (~> 0.10.0)
|
|
153
|
+
simplecov-html (0.10.2)
|
|
154
|
+
stackprof (0.2.12)
|
|
155
|
+
thor (0.20.0)
|
|
156
|
+
thread_safe (0.3.6)
|
|
157
|
+
timecop (0.9.1)
|
|
158
|
+
tzinfo (1.2.5)
|
|
159
|
+
thread_safe (~> 0.1)
|
|
160
|
+
unicode-display_width (1.4.0)
|
|
161
|
+
virtus (1.0.5)
|
|
162
|
+
axiom-types (~> 0.1)
|
|
163
|
+
coercible (~> 1.0)
|
|
164
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
|
165
|
+
equalizer (~> 0.0, >= 0.0.9)
|
|
166
|
+
|
|
167
|
+
PLATFORMS
|
|
168
|
+
ruby
|
|
169
|
+
|
|
170
|
+
DEPENDENCIES
|
|
171
|
+
bundler (>= 1.13)
|
|
172
|
+
guard-rspec
|
|
173
|
+
pry
|
|
174
|
+
pry-byebug
|
|
175
|
+
rake (>= 10.0)
|
|
176
|
+
rb-fsevent
|
|
177
|
+
rb-readline
|
|
178
|
+
reek
|
|
179
|
+
rspec
|
|
180
|
+
rubocop
|
|
181
|
+
rubocop-rspec
|
|
182
|
+
sample_data_dump!
|
|
183
|
+
shoulda-matchers
|
|
184
|
+
simplecov
|
|
185
|
+
stackprof
|
|
186
|
+
timecop
|
|
187
|
+
|
|
188
|
+
BUNDLED WITH
|
|
189
|
+
1.17.1
|
data/Guardfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
|
4
|
+
require 'guard/rspec/dsl'
|
|
5
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
|
6
|
+
|
|
7
|
+
# RSpec files
|
|
8
|
+
rspec = dsl.rspec
|
|
9
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
|
10
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
|
11
|
+
watch(rspec.spec_files)
|
|
12
|
+
|
|
13
|
+
# Ruby files
|
|
14
|
+
ruby = dsl.ruby
|
|
15
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
|
16
|
+
end
|
data/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Sample Data Dump
|
|
2
|
+
|
|
3
|
+
This gem provides:
|
|
4
|
+
- Use cases for sample data dump utility
|
|
5
|
+
- Persistence interface for sample data dump utility
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
1. Create a class that implements the persistence interface.
|
|
10
|
+
2. Pass it to the appropriate use case.
|
|
11
|
+
3. Use the result to take your next action.
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
SampleDataDump::UseCases::ActorDownloadsSampleDataFiles.new(persistence).result
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Add this line to your application's Gemfile:
|
|
20
|
+
|
|
21
|
+
```ruby
|
|
22
|
+
gem 'sample_data_dump', git: 'git@github.com:tricycle/sample_data_dump.git'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
And then execute:
|
|
26
|
+
|
|
27
|
+
$ bundle install
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'dry/struct'
|
|
4
|
+
require 'sample_data_dump/types'
|
|
5
|
+
|
|
6
|
+
module SampleDataDump
|
|
7
|
+
module Entities
|
|
8
|
+
class TableConfiguration < Dry::Struct
|
|
9
|
+
attribute :schema_name, Types::Strict::String
|
|
10
|
+
attribute :table_name, Types::Strict::String
|
|
11
|
+
attribute :dump_where, Types::Strict::String.default('')
|
|
12
|
+
attribute :obfuscate_columns, Types::Strict::Array.of(Types::Strict::String).default([])
|
|
13
|
+
|
|
14
|
+
def qualified_table_name
|
|
15
|
+
"#{schema_name}.#{table_name}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'duckface'
|
|
4
|
+
|
|
5
|
+
module SampleDataDump
|
|
6
|
+
module Interfaces
|
|
7
|
+
module Persistence
|
|
8
|
+
extend Duckface::ActsAsInterface
|
|
9
|
+
|
|
10
|
+
def decompress_compressed_dump_file(_table_configuration)
|
|
11
|
+
raise NotImplementedError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def dump_and_compress_data_to_local_file(_table_configuration)
|
|
15
|
+
raise NotImplementedError
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def load_dump_file(_table_configuration)
|
|
19
|
+
raise NotImplementedError
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def load_table_configurations
|
|
23
|
+
raise NotImplementedError
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def move_compressed_dump_file_to_central_location(_table_configuration)
|
|
27
|
+
raise NotImplementedError
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def reset_sequence(_table_configuration)
|
|
31
|
+
raise NotImplementedError
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def retrieve_compressed_dump_file_from_central_location(_table_configuration)
|
|
35
|
+
raise NotImplementedError
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def valid?(_table_configuration)
|
|
39
|
+
raise NotImplementedError
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def wipe_table(_table_configuration)
|
|
43
|
+
raise NotImplementedError
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SampleDataDump
|
|
4
|
+
module UseCases
|
|
5
|
+
class ActorDownloadsSampleDataFiles
|
|
6
|
+
def initialize(persistence)
|
|
7
|
+
@persistence = persistence
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def result
|
|
11
|
+
@persistence.load_table_configurations.fmap do |table_configurations|
|
|
12
|
+
result = process_table_configurations_list(table_configurations)
|
|
13
|
+
return result if result.failure?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def process_table_configurations_list(table_configurations)
|
|
20
|
+
results = table_configurations.map do |table_configuration|
|
|
21
|
+
result = process_table_configuration(table_configuration)
|
|
22
|
+
return result if result.failure?
|
|
23
|
+
end
|
|
24
|
+
results.last || Dry::Monads::Success(true)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def process_table_configuration(table_configuration)
|
|
28
|
+
@persistence.valid?(table_configuration).bind do
|
|
29
|
+
@persistence.retrieve_compressed_dump_file_from_central_location(table_configuration)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SampleDataDump
|
|
4
|
+
module UseCases
|
|
5
|
+
class ActorDumpsSampleDataToFiles
|
|
6
|
+
def initialize(persistence)
|
|
7
|
+
@persistence = persistence
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def result
|
|
11
|
+
@persistence.load_table_configurations.fmap do |table_configurations|
|
|
12
|
+
result = process_table_configurations_list(table_configurations)
|
|
13
|
+
return result if result.failure?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def process_table_configurations_list(table_configurations)
|
|
20
|
+
results = table_configurations.map do |table_configuration|
|
|
21
|
+
result = process_table_configuration(table_configuration)
|
|
22
|
+
return result if result.failure?
|
|
23
|
+
end
|
|
24
|
+
results.last || Dry::Monads::Success(true)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def process_table_configuration(table_configuration)
|
|
28
|
+
@persistence.valid?(table_configuration).bind do
|
|
29
|
+
@persistence.dump_and_compress_data_to_local_file(table_configuration)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SampleDataDump
|
|
4
|
+
module UseCases
|
|
5
|
+
class ActorLoadsSampleDataFiles
|
|
6
|
+
def initialize(persistence)
|
|
7
|
+
@persistence = persistence
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def result
|
|
11
|
+
@persistence.load_table_configurations.fmap do |table_configurations|
|
|
12
|
+
result = process_table_configurations_list(table_configurations)
|
|
13
|
+
return result if result.failure?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def process_table_configurations_list(table_configurations)
|
|
20
|
+
table_configurations.reverse_each do |table_configuration|
|
|
21
|
+
@persistence.wipe_table(table_configuration)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
results = table_configurations.map do |table_configuration|
|
|
25
|
+
result = process_table_configuration(table_configuration)
|
|
26
|
+
return result if result.failure?
|
|
27
|
+
end
|
|
28
|
+
results.last || Dry::Monads::Success(true)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def process_table_configuration(table_configuration)
|
|
32
|
+
@persistence.valid?(table_configuration).bind do
|
|
33
|
+
@persistence.decompress_compressed_dump_file(table_configuration).bind do
|
|
34
|
+
@persistence.load_dump_file(table_configuration).bind do
|
|
35
|
+
@persistence.reset_sequence(table_configuration)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SampleDataDump
|
|
4
|
+
module UseCases
|
|
5
|
+
class ActorUploadsSampleDataFiles
|
|
6
|
+
def initialize(persistence)
|
|
7
|
+
@persistence = persistence
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def result
|
|
11
|
+
@persistence.load_table_configurations.fmap do |table_configurations|
|
|
12
|
+
result = process_table_configurations_list(table_configurations)
|
|
13
|
+
return result if result.failure?
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def process_table_configurations_list(table_configurations)
|
|
20
|
+
results = table_configurations.map do |table_configuration|
|
|
21
|
+
result = process_table_configuration(table_configuration)
|
|
22
|
+
return result if result.failure?
|
|
23
|
+
end
|
|
24
|
+
results.last || Dry::Monads::Success(true)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def process_table_configuration(table_configuration)
|
|
28
|
+
@persistence.valid?(table_configuration).bind do
|
|
29
|
+
@persistence.move_compressed_dump_file_to_central_location(table_configuration)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require 'sample_data_dump/version'
|
|
6
|
+
|
|
7
|
+
Gem::Specification.new do |spec|
|
|
8
|
+
spec.name = 'sample_data_dump'
|
|
9
|
+
spec.version = SampleDataDump::VERSION
|
|
10
|
+
spec.authors = ['Bellroy Dev Team']
|
|
11
|
+
spec.email = ['techsupport@bellroy.com']
|
|
12
|
+
|
|
13
|
+
spec.summary = 'Generic sample data dump utility'
|
|
14
|
+
spec.description = ''
|
|
15
|
+
spec.homepage = 'http://www.bellroy.com'
|
|
16
|
+
|
|
17
|
+
if spec.respond_to?(:metadata)
|
|
18
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
|
19
|
+
else
|
|
20
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
|
21
|
+
'public gem pushes.'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
25
|
+
f.match(%r{^(test|spec|features)/})
|
|
26
|
+
end
|
|
27
|
+
spec.bindir = 'exe'
|
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
29
|
+
spec.require_paths = ['lib']
|
|
30
|
+
|
|
31
|
+
spec.add_dependency 'dry-matcher'
|
|
32
|
+
spec.add_dependency 'dry-monads'
|
|
33
|
+
spec.add_dependency 'dry-struct'
|
|
34
|
+
spec.add_dependency 'dry-types'
|
|
35
|
+
spec.add_dependency 'duckface-interfaces'
|
|
36
|
+
|
|
37
|
+
spec.add_development_dependency 'bundler', '>= 1.13'
|
|
38
|
+
spec.add_development_dependency 'rake', '>= 10.0'
|
|
39
|
+
spec.add_development_dependency 'rspec', '>= 3.0'
|
|
40
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sample_data_dump
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Bellroy Dev Team
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-11-30 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: dry-matcher
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: dry-monads
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: dry-struct
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: dry-types
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: duckface-interfaces
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: bundler
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '1.13'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '1.13'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rake
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '10.0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '10.0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rspec
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '3.0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '3.0'
|
|
125
|
+
description: ''
|
|
126
|
+
email:
|
|
127
|
+
- techsupport@bellroy.com
|
|
128
|
+
executables: []
|
|
129
|
+
extensions: []
|
|
130
|
+
extra_rdoc_files: []
|
|
131
|
+
files:
|
|
132
|
+
- ".gitignore"
|
|
133
|
+
- ".reek.yml"
|
|
134
|
+
- ".rspec"
|
|
135
|
+
- ".rspec_status"
|
|
136
|
+
- ".rubocop.yml"
|
|
137
|
+
- ".ruby-version"
|
|
138
|
+
- CHANGELOG.md
|
|
139
|
+
- Gemfile
|
|
140
|
+
- Gemfile.lock
|
|
141
|
+
- Guardfile
|
|
142
|
+
- README.md
|
|
143
|
+
- lib/sample_data_dump.rb
|
|
144
|
+
- lib/sample_data_dump/entities/table_configuration.rb
|
|
145
|
+
- lib/sample_data_dump/interfaces/persistence.rb
|
|
146
|
+
- lib/sample_data_dump/types.rb
|
|
147
|
+
- lib/sample_data_dump/use_cases/actor_downloads_sample_data_files.rb
|
|
148
|
+
- lib/sample_data_dump/use_cases/actor_dumps_sample_data_to_files.rb
|
|
149
|
+
- lib/sample_data_dump/use_cases/actor_loads_sample_data_files.rb
|
|
150
|
+
- lib/sample_data_dump/use_cases/actor_uploads_sample_data_files.rb
|
|
151
|
+
- lib/sample_data_dump/version.rb
|
|
152
|
+
- sample_data_dump.gemspec
|
|
153
|
+
homepage: http://www.bellroy.com
|
|
154
|
+
licenses: []
|
|
155
|
+
metadata:
|
|
156
|
+
allowed_push_host: https://rubygems.org
|
|
157
|
+
post_install_message:
|
|
158
|
+
rdoc_options: []
|
|
159
|
+
require_paths:
|
|
160
|
+
- lib
|
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
|
+
requirements:
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: '0'
|
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
|
+
requirements:
|
|
168
|
+
- - ">="
|
|
169
|
+
- !ruby/object:Gem::Version
|
|
170
|
+
version: '0'
|
|
171
|
+
requirements: []
|
|
172
|
+
rubyforge_project:
|
|
173
|
+
rubygems_version: 2.6.14.3
|
|
174
|
+
signing_key:
|
|
175
|
+
specification_version: 4
|
|
176
|
+
summary: Generic sample data dump utility
|
|
177
|
+
test_files: []
|