lib/webtranslateit/safe/mongodump.rb in webtranslateit-safe-0.4.3 vs lib/webtranslateit/safe/mongodump.rb in webtranslateit-safe-0.4.4

- old
+ new

@@ -1,23 +1,29 @@ module WebTranslateIt + module Safe + class Mongodump < Source - + def command opts = [] opts << "--host #{config[:host]}" if config[:host] opts << "-u #{config[:user]}" if config[:user] opts << "-p #{config[:password]}" if config[:password] opts << "--out #{output_directory}" - - "mongodump -q \"{xxxx : { \\$ne : 0 } }\" --db #{@id} #{opts.join(" ")} && cd #{output_directory} && tar cf - ." + + "mongodump -q \"{xxxx : { \\$ne : 0 } }\" --db #{@id} #{opts.join(' ')} && cd #{output_directory} && tar cf - ." end - - def extension; '.tar'; end - + + def extension = '.tar' + protected + def output_directory File.join(TmpFile.tmproot, 'mongodump') end + end + end + end