Sha256: fc3a5b17efd52e8cfb4d527177815e2cc0e78d0e259caf52aa270ce43f46f4ca
Contents?: true
Size: 1.89 KB
Versions: 3
Compression:
Stored size: 1.89 KB
Contents
require 'active_support/core_ext/module' module SchemaComments VERSION = '0.1.0' autoload :Base, 'schema_comments/base' autoload :ConnectionAdapters, 'schema_comments/connection_adapters' autoload :Migration, 'schema_comments/migration' autoload :Migrator, 'schema_comments/migrator' autoload :Schema, 'schema_comments/schema' autoload :SchemaComment, 'schema_comments/schema_comment' autoload :SchemaDumper, 'schema_comments/schema_dumper' mattr_accessor :yaml_path self.yaml_path = Rails.root.join("db/schema_comments.yml").to_s if defined?(Rails) mattr_accessor :quiet class YamlError < StandardError end class << self def setup base_names = %w(Base Migration Migrator Schema) + %w(Column ColumnDefinition TableDefinition).map{|name| "ConnectionAdapters::#{name}"} base_names.each do |base_name| ar_class = "ActiveRecord::#{base_name}".constantize sc_class = "SchemaComments::#{base_name}".constantize unless ar_class.ancestors.include?(sc_class) ar_class.__send__(:include, sc_class) end end unless ActiveRecord::ConnectionAdapters::AbstractAdapter.ancestors.include?(SchemaComments::ConnectionAdapters::Adapter) ActiveRecord::ConnectionAdapters::AbstractAdapter.module_eval do include SchemaComments::ConnectionAdapters::Adapter end end # %w(Mysql PostgreSQL SQLite3 SQLite Firebird DB2 Oracle Sybase Openbase Frontbase) %w(Mysql Mysql2 PostgreSQL SQLite3 SQLite).each do |adapter| begin require("active_record/connection_adapters/#{adapter.downcase}_adapter") adapter_class = ('ActiveRecord::ConnectionAdapters::' << "#{adapter}Adapter").constantize adapter_class.module_eval do include SchemaComments::ConnectionAdapters::ConcreteAdapter end rescue Exception => e end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
schema_comments-0.2.0.alpha5 | lib/schema_comments.rb |
schema_comments-0.2.0.alpha4 | lib/schema_comments.rb |
schema_comments-0.2.0.alpha3 | lib/schema_comments.rb |