Sha256: 0a738256ff3f2a4d0fa11258fc12f85aa0f51a73ba946f1174774dfb863069b5

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

#
# testing ruote-sequel
#
# Thu Feb 10 11:14:56 JST 2011
#

require 'rufus-json/automatic'
require 'ruote-sequel'


unless $sequel

  $sequel = case ENV['RUOTE_STORAGE_DB'] || 'postgres'
    when 'pg', 'postgres'
      Sequel.connect('postgres://localhost/ruote_test')
    when 'my', 'mysql'
      #Sequel.connect('mysql://root:root@localhost/ruote_test')
      Sequel.connect('mysql://root@localhost/ruote_test')
    when 'mysql2'
      Sequel.connect('mysql2://root@localhost/ruote_test')
    when /:/
      Sequel.connect(ENV['RUOTE_STORAGE_DB'])
    else
      raise ArgumentError.new("unknown DB: #{ENV['RUOTE_STORAGE_DB'].inspect}")
  end

  require 'logger'

  logger = case ENV['RUOTE_STORAGE_DEBUG']
    when 'log'
      FileUtils.rm('debug.log') rescue nil
      Logger.new('debug.log')
    when 'stdout'
      Logger.new($stdout)
    else
      nil
  end

  if logger
    logger.level = Logger::DEBUG
    $sequel.loggers << logger
  end

  Ruote::Sequel.create_table($sequel, true)
    # true forces re_create of 'documents' table
end


def new_storage(opts)

  Ruote::Sequel::Storage.new($sequel, opts)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruote-sequel-2.3.0 test/connection.rb