Sha256: 8c2db7a5cbb7283c4375ac8bde481e7b449af39286e58d449f9ecad618867778
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
module Storey class BuildsDumpCommand easy_class_to_instance def initialize(options={}) @options = options if @options[:database].blank? raise ArgumentError, 'database must be supplied' end end def execute switches = {} switches['schema-only'] = nil if @options[:structure_only] switches['no-privileges'] = nil switches['no-owner'] = nil switches['host'] = @options[:host] if @options[:host].present? switches['username'] = @options[:username] if @options[:username].present? switches[:file] = Shellwords.escape(@options[:file]) if @options[:schemas] schemas = @options[:schemas].split(',') schemas_switches = schemas.map do |part| Utils.command_line_switches_from({schema: Shellwords.escape(part) }) end end command_parts = [] if @options[:password].present? command_parts << "PGPASSWORD=#{@options[:password]}" end command_parts += ['pg_dump', Utils.command_line_switches_from(switches), schemas_switches, @options[:database]] command_parts.compact.join(' ') end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
storey-2.0.2 | lib/storey/builds_dump_command.rb |
storey-2.0.1 | lib/storey/builds_dump_command.rb |
storey-2.0.0 | lib/storey/builds_dump_command.rb |