Module: Blacklight

Extended by:
SearchFields
Defined in:
lib/blacklight/facet.rb,
lib/blacklight.rb,
lib/blacklight/utils.rb,
lib/blacklight/routes.rb,
lib/blacklight/engine.rb,
lib/blacklight/version.rb,
lib/blacklight/exceptions.rb,
lib/blacklight/configuration.rb,
lib/blacklight/solr_repository.rb,
lib/blacklight/request_builders.rb,
lib/blacklight/document_presenter.rb,
lib/blacklight/configuration/fields.rb,
lib/blacklight/configuration/solr_field.rb,
lib/blacklight/configuration/sort_field.rb,
lib/blacklight/configuration/tool_config.rb,
lib/blacklight/configuration/facet_field.rb,
lib/blacklight/configuration/search_field.rb,
lib/generators/blacklight/assets_generator.rb,
lib/generators/blacklight/models_generator.rb,
lib/generators/blacklight/install_generator.rb,
lib/blacklight/catalog/component_configuration.rb,
app/helpers/blacklight/component_helper_behavior.rb,
lib/generators/blacklight/test_support_generator.rb

Overview

These are methods that are used at both the view helper and controller layers They are only dependent on `blacklight_config` and `@response`

Defined Under Namespace

Modules: Base, BlacklightHelperBehavior, Bookmarks, Catalog, CatalogHelperBehavior, ComponentHelperBehavior, Configurable, ConfigurationHelperBehavior, Controller, Exceptions, Facet, FacetsHelperBehavior, HashAsHiddenFieldsHelperBehavior, RenderConstraintsHelperBehavior, RenderPartialsHelper, RequestBuilders, SearchFields, SearchHistoryConstraintsHelperBehavior, Solr, SolrHelper, TokenBasedUser, UrlHelperBehavior, User Classes: Assets, Configuration, DocumentPresenter, Engine, Install, ModelsGenerator, NestedOpenStructWithHashAccess, OpenStructWithHashAccess, Routes, SolrRepository, SolrResponse, TestSupport

Constant Summary

VERSION =
self.version
@@secret_key =
nil

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from SearchFields

default_search_field, label_for_search_field, search_field_def_for_key, search_field_list

Class Attribute Details

.solrObject

Returns the value of attribute solr



39
40
41
# File 'lib/blacklight.rb', line 39

def solr
  @solr
end

.solr_configObject

Returns the value of attribute solr_config



39
40
41
# File 'lib/blacklight.rb', line 39

def solr_config
  @solr_config
end

Class Method Details

.add_routes(router, options = {}) ⇒ Object



51
52
53
# File 'lib/blacklight.rb', line 51

def self.add_routes(router, options = {})
  Blacklight::Routes.new(router, options).draw
end

.loggerObject



94
95
96
# File 'lib/blacklight.rb', line 94

def self.logger
  ::Rails.logger
end

.rootObject

returns the full path the the blacklight plugin installation



107
108
109
# File 'lib/blacklight.rb', line 107

def self.root
  @root ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
end

.solr_fileObject



47
48
49
# File 'lib/blacklight.rb', line 47

def self.solr_file
  "#{::Rails.root.to_s}/config/solr.yml"
end

.solr_ymlObject



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/blacklight.rb', line 66

def self.solr_yml
  require 'erb'
  require 'yaml'

  return @solr_yml if @solr_yml
  unless File.exists?(solr_file)
    raise "You are missing a solr configuration file: #{solr_file}. Have you run \"rails generate blacklight:install\"?"  
  end

  begin
    @solr_erb = ERB.new(IO.read(solr_file)).result(binding)
  rescue Exception => e
    raise("solr.yml was found, but could not be parsed with ERB. \n#{$!.inspect}")
  end

  begin
    @solr_yml = YAML::load(@solr_erb)
  rescue StandardError => e
    raise("solr.yml was found, but could not be parsed.\n")
  end

  if @solr_yml.nil? || !@solr_yml.is_a?(Hash)
    raise("solr.yml was found, but was blank or malformed.\n")
  end

  return @solr_yml
end

.versionObject



4
5
6
# File 'lib/blacklight/version.rb', line 4

def self.version
  @version ||= File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).chomp
end