Sha256: c29f8a0148670bdf1ffddce08bcb3fba49cc6dc759b74f387fdd4159f81612e1

Contents?: true

Size: 1.86 KB

Versions: 13

Compression:

Stored size: 1.86 KB

Contents

#require 'dm-ar-finders'
#require 'dm-core'
require 'erb'
require 'composite_primary_keys'

module Bio
 class SQL
    class DummyBase < ActiveRecord::Base
      #NOTE: Using postgresql, not setting sequence name, system will discover the name by default.
      #NOTE: this class will not establish the connection automatically
      self.abstract_class = true
      self.pluralize_table_names = false
      #prepend table name to the usual id, avoid to specify primary id for every table
      self.primary_key_prefix_type = :table_name_with_underscore
      #biosql_configurations=YAML::load(ERB.new(IO.read(File.join(File.dirname(__FILE__),'./config', 'database.yml'))).result)
      #self.configurations=biosql_configurations
      #self.establish_connection "development"
    end #DummyBase

    require 'bio/io/biosql/ar-biosql'
    
  #  #no check is made
  def self.establish_connection(configurations, env)
    #  #configurations is an hash similar what YAML returns.

     #configurations.assert_valid_keys('development', 'production','test')
     #configurations[env].assert_valid_keys('hostname','database','adapter','username','password')
     DummyBase.configurations = configurations
    connection = DummyBase.establish_connection "#{env}"
    #Init of basis terms and ontologies
    Ontology.first(:conditions => ["name = ?", 'Annotation Tags']) || Ontology.create({:name => 'Annotation Tags'})
    Ontology.first(:conditions => ["name = ?", 'SeqFeature Keys']) || Ontology.create({:name => 'SeqFeature Keys'})
    Ontology.first(:conditions => ["name = ?", 'SeqFeature Sources']) ||Ontology.create({:name => 'SeqFeature Sources'})
    Term.first(:conditions => ["name = ?", 'EMBLGenBankSwit']) || Term.create({:name => 'EMBLGenBankSwit', :ontology => Ontology.first(:conditions => ["name = ?", 'SeqFeature Sources'])})
    connection 
  end #establish_connection
  
  end #SQL
end #Bio

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
bio-1.5.2 lib/bio/io/biosql/biosql.rb
bio-1.5.1 lib/bio/io/biosql/biosql.rb
bio-biosql-0.0.0 lib/bio/io/biosql/biosql.rb
bio-1.5.0 lib/bio/io/biosql/biosql.rb
bioruby-bio-1.3.0.9901 lib/bio/io/biosql/biosql.rb
bioruby-bio-1.3.1.5000 lib/bio/io/biosql/biosql.rb
ngoto-bio-1.3.1.5000 lib/bio/io/biosql/biosql.rb
bio-1.4.3.0001 lib/bio/io/biosql/biosql.rb
bio-1.4.3 lib/bio/io/biosql/biosql.rb
bio-1.4.2 lib/bio/io/biosql/biosql.rb
bio-1.4.1 lib/bio/io/biosql/biosql.rb
bio-1.4.0 lib/bio/io/biosql/biosql.rb
bio-1.3.1 lib/bio/io/biosql/biosql.rb