Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d50c4078
Commit
d50c4078
authored
Jun 19, 2018
by
Micaël Bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply feedback from review
parent
f71fbe7a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
lib/pseudonymizer/dumper.rb
lib/pseudonymizer/dumper.rb
+2
-3
lib/pseudonymizer/options.rb
lib/pseudonymizer/options.rb
+1
-1
lib/pseudonymizer/uploader.rb
lib/pseudonymizer/uploader.rb
+4
-1
spec/lib/pseudonymizer/uploader_spec.rb
spec/lib/pseudonymizer/uploader_spec.rb
+4
-4
No files found.
lib/pseudonymizer/dumper.rb
View file @
d50c4078
...
...
@@ -64,8 +64,7 @@ module Pseudonymizer
private
def
output_filename
(
basename
=
nil
,
ext
=
"csv.gz"
)
file_timestamp
=
"
#{
basename
}
.
#{
ext
}
"
File
.
join
(
output_dir
,
file_timestamp
)
File
.
join
(
output_dir
,
"
#{
basename
}
.
#{
ext
}
"
)
end
def
schema_to_yml
...
...
@@ -147,7 +146,7 @@ module Pseudonymizer
end
def
write_to_csv_file
(
table
,
contents
)
file_path
=
output_filename
(
table
,
"csv.gz"
)
file_path
=
output_filename
(
table
)
Rails
.
logger
.
info
"
#{
self
.
class
.
name
}
writing
#{
table
}
to
#{
file_path
}
."
Zlib
::
GzipWriter
.
open
(
file_path
)
do
|
io
|
...
...
lib/pseudonymizer/options.rb
View file @
d50c4078
...
...
@@ -13,7 +13,7 @@ module Pseudonymizer
end
def
upload_dir
File
.
join
(
start_at
.
iso8601
)
start_at
.
iso8601
end
end
end
lib/pseudonymizer/uploader.rb
View file @
d50c4078
...
...
@@ -34,7 +34,10 @@ module Pseudonymizer
return
unless
File
.
exist?
(
@output_dir
)
progress_output
.
print
"Deleting tmp directory
#{
@output_dir
}
... "
progress_output
.
puts
FileUtils
.
rm_rf
(
@output_dir
)
?
"done"
.
color
(
:green
)
:
"failed"
.
color
(
:red
)
FileUtils
.
rm_rf
(
@output_dir
)
progress_output
.
puts
"done"
.
color
(
:green
)
rescue
progress_output
.
puts
"failed"
.
color
(
:red
)
end
private
...
...
spec/lib/pseudonymizer/uploader_spec.rb
View file @
d50c4078
...
...
@@ -23,6 +23,10 @@ describe Pseudonymizer::Uploader do
mock_file
(
"file_list.json"
)
end
after
do
FileUtils
.
rm_rf
(
base_dir
)
end
describe
"#upload"
do
it
"upload all file in the directory"
do
subject
.
upload
...
...
@@ -38,8 +42,4 @@ describe Pseudonymizer::Uploader do
expect
(
Dir
[
File
.
join
(
base_dir
,
"*"
)].
length
).
to
eq
(
0
)
end
end
after
do
FileUtils
.
rm_rf
(
base_dir
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment