lib/brillo/scrubber.rb in brillo-2.0.0 vs lib/brillo/scrubber.rb in brillo-2.1.0
- old
+ new
@@ -14,11 +14,11 @@
jumble: ->(j) { j.downcase.chars.shuffle!(random: JUMBLE_PRNG.clone).join },
# strips extensions
phone: ->(n) { n = n.split(' ').first; n && n.length > 9 ? n[0..-5] + n[-1] + n[-2] + n[-3] + n[-4] : n},
name: ->(n) { n.downcase.split(' ').map do |word|
word.chars.shuffle!(random: JUMBLE_PRNG.clone).join
- end.each(&:capitalize!).join(' ')
+ end.each(&:capitalize!).join(' ')
},
}
TACTICS = {
latest: -> (klass) { klass.order("#{klass.primary_key} desc").limit(LATEST_LIMIT).pluck(klass.primary_key) },
@@ -33,13 +33,18 @@
end
def scrub!
FileUtils.rm config.compressed_filename, force: true
configure_polo
- adapter.dump_structure_and_migrations(config)
+ dump_structure_and_migrations
explore_all_classes
compress
config.transferrer.upload
+ end
+
+ def dump_structure_and_migrations
+ return unless config.recreate_db
+ adapter.dump_structure_and_migrations(config)
end
def explore_all_classes
File.open(config.dump_path, "a") do |sql_file|
sql_file.puts(adapter.header)