Sha256: 42214c60f33a38b2d2e9d45dead92f7cf3985f1b8cab67b934ee772c7d33e0e6

Contents?: true

Size: 917 Bytes

Versions: 8

Compression:

Stored size: 917 Bytes

Contents

module Storey
  class BuildsLoadCommand

    easy_class_to_instance

    def initialize(options={})
      @options = options
    end

    def execute
      switches = {}
      if @options[:file].present?
        switches[:file] = Shellwords.escape(@options[:file])
      end
      switches[:dbname] = @options[:database]
      switches[:username] = @options[:username] if @options[:username].present?
      switches[:host] = @options[:host] if @options[:host].present?
      switches[:port] = @options[:port] if @options[:port].present?
      if @options[:password].present?
        switches[:password] = @options[:password]
      else
        switches['no-password'] = nil
      end
      switches[:command] = %Q("#{@options[:command]}") if @options[:command].present?
      command_parts = ['psql',
                       Utils.command_line_switches_from(switches)]
      command_parts.join(' ')
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
storey-2.0.2 lib/storey/builds_load_command.rb
storey-2.0.1 lib/storey/builds_load_command.rb
storey-2.0.0 lib/storey/builds_load_command.rb
storey-1.0.0 lib/storey/builds_load_command.rb
storey-0.6.0 lib/storey/builds_load_command.rb
storey-0.5.2 lib/storey/builds_load_command.rb
storey-0.5.1 lib/storey/builds_load_command.rb
storey-0.5.0 lib/storey/builds_load_command.rb