Sha256: 897f230799c64d6230b2effd795ae8de18546933d9f86a54934ae7ce9030d105

Contents?: true

Size: 618 Bytes

Versions: 14

Compression:

Stored size: 618 Bytes

Contents

module Shiba
  class Connection
    def self.build(hash)
      server_type = hash['server']
      if !server_type
        port = hash['port'].to_i
        if port == 3306
          server_type = 'mysql'
        elsif port == 5432
          server_type = 'postgres'
        else
          raise "couldn't determine server type!  please pass --server"
        end
      end

      if server_type == 'mysql'
        require 'shiba/connection/mysql'
        Shiba::Connection::Mysql.new(hash)
      else
        require 'shiba/connection/postgres'
        Shiba::Connection::Postgres.new(hash)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shiba-0.9.4 lib/shiba/connection.rb
shiba-0.9.3 lib/shiba/connection.rb
shiba-0.9.2 lib/shiba/connection.rb
shiba-0.9.1 lib/shiba/connection.rb
shiba-0.9.0 lib/shiba/connection.rb
shiba-0.8.1 lib/shiba/connection.rb
shiba-0.6.4 lib/shiba/connection.rb
shiba-0.6.3 lib/shiba/connection.rb
shiba-0.6.2 lib/shiba/connection.rb
shiba-0.6.1 lib/shiba/connection.rb
shiba-0.6.0 lib/shiba/connection.rb
shiba-0.5.0 lib/shiba/connection.rb
shiba-0.4.0 lib/shiba/connection.rb
shiba-0.3.0 lib/shiba/connection.rb