Sha256: c3d19f8b7a3751d7c8dc5d5916cf1b3b8cda50f39d1d70cf668ea3cfabc79d5d

Contents?: true

Size: 642 Bytes

Versions: 6

Compression:

Stored size: 642 Bytes

Contents

module WebTranslateIt

  module Safe

    class Mongodump < Source

      def command # rubocop:todo Metrics/AbcSize
        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 - ."
      end

      def extension = '.tar'

      protected

      def output_directory
        File.join(TmpFile.tmproot, 'mongodump')
      end

    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
webtranslateit-safe-0.4.11 lib/web_translate_it/safe/mongodump.rb
webtranslateit-safe-0.4.10 lib/web_translate_it/safe/mongodump.rb
webtranslateit-safe-0.4.9 lib/web_translate_it/safe/mongodump.rb
webtranslateit-safe-0.4.8 lib/web_translate_it/safe/mongodump.rb
webtranslateit-safe-0.4.7 lib/web_translate_it/safe/mongodump.rb
webtranslateit-safe-0.4.6 lib/web_translate_it/safe/mongodump.rb