Sha256: a3958e8f7a3bec5cad698c0eeea1189811553265630a0a8a20e4020135742799

Contents?: true

Size: 1.78 KB

Versions: 22

Compression:

Stored size: 1.78 KB

Contents

require 'yaml'

require 'custom_attributes/acts_as/acts_as_customizable'
require 'custom_attributes/acts_as/acts_as_custom_field'
require 'custom_attributes/acts_as/acts_as_custom_value'

require 'custom_attributes/field_type'
require 'custom_attributes/field_types/unbounded'
require 'custom_attributes/field_types/list'
require 'custom_attributes/field_types/numeric'

require 'custom_attributes/field_types/bool_field_type'
require 'custom_attributes/field_types/date_field_type'
require 'custom_attributes/field_types/float_field_type'
require 'custom_attributes/field_types/text_field_type'
require 'custom_attributes/field_types/string_field_type'
require 'custom_attributes/field_types/list_field_type'
require 'custom_attributes/field_types/int_field_type'

require 'custom_attributes/custom_field_value'

require 'custom_attributes/api/custom_attributes_controller_helper'

require 'custom_attributes/concerns/searchable'

module CustomAttributes
  # Gem configuration credits to: https://stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem#10112179
  @config = {
    search_user: ENV["ELASTICSEARCH_USER"] || 'elastic',
    search_pass: ENV["ELASTICSEARCH_PASSWORD"] || 'changeme',
    search_host: ENV["ELASTICSEARCH_HOST"] || 'localhost:9200',
    search_index_prefix: ENV["ELASTICSEARCH_INDEX_PREFIX"] || 'es'
  }

  @valid_config_keys = @config.keys

  # Configure through hash
  def self.configure(opts = {})
    opts.each { |k, v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym }

    after_configuration
  end

  def self.config
    @config
  end

  def self.after_configuration
    # Set up ElasticSearch
    Elasticsearch::Model.client = Elasticsearch::Client.new host: "http://#{@config[:search_user]}:#{@config[:search_pass]}@#{@config[:search_host]}"
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
create_custom_attributes-0.5.23 lib/custom_attributes.rb
create_custom_attributes-0.5.22 lib/custom_attributes.rb
create_custom_attributes-0.5.21 lib/custom_attributes.rb
create_custom_attributes-0.5.20 lib/custom_attributes.rb
create_custom_attributes-0.5.19 lib/custom_attributes.rb
create_custom_attributes-0.5.18 lib/custom_attributes.rb
create_custom_attributes-0.5.17 lib/custom_attributes.rb
create_custom_attributes-0.5.16 lib/custom_attributes.rb
create_custom_attributes-0.5.15 lib/custom_attributes.rb
create_custom_attributes-0.5.14 lib/custom_attributes.rb
create_custom_attributes-0.5.13 lib/custom_attributes.rb
create_custom_attributes-0.5.12 lib/custom_attributes.rb
create_custom_attributes-0.5.11 lib/custom_attributes.rb
create_custom_attributes-0.5.10 lib/custom_attributes.rb
create_custom_attributes-0.5.9 lib/custom_attributes.rb
create_custom_attributes-0.5.8 lib/custom_attributes.rb
create_custom_attributes-0.5.7 lib/custom_attributes.rb
create_custom_attributes-0.5.6 lib/custom_attributes.rb
create_custom_attributes-0.5.5 lib/custom_attributes.rb
create_custom_attributes-0.5.4 lib/custom_attributes.rb