Sha256: 629733781459ccf0a91fa05a8c0ac4a3957f897ce4d7ca6b42cc7339844edc3c

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module SearchCraft
  class Error < StandardError; end

  extend self

  def configure
    yield(config)
  end

  def config
    @config ||= Configuration.new
  end

  def database_ready?
    ActiveRecord::Base.connection.table_exists?("schema_migrations")
  rescue
    false
  end

  def dependencies_ready?
    config.explicit_builder_class_names.all? do |builder_class_name|
      builder_class_name.constantize.new.dependencies_ready?
    end
  end

  def debug?
    config.debug
  end

  def load_tasks
    return if @tasks_loaded

    Dir[File.join(File.dirname(__FILE__), "tasks", "**/*.rake")].each do |rake|
      load rake
    end

    @tasks_loaded = true
  end
end

require "active_record"

require_relative "searchcraft/version"
require_relative "searchcraft/configuration"
require_relative "searchcraft/annotate"
require_relative "searchcraft/depends_on"
require_relative "searchcraft/dump_schema"
require_relative "searchcraft/builder"
require_relative "searchcraft/model"
require_relative "searchcraft/view_hash_store"
require_relative "searchcraft/railtie" if defined?(Rails)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
searchcraft-0.4.0 lib/searchcraft.rb