Module: Blacklight
- Extended by:
- Deprecation
- Defined in:
- app/helpers/blacklight/layout_helper_behavior.rb,
lib/blacklight.rb,
lib/blacklight/solr.rb,
lib/blacklight/utils.rb,
lib/blacklight/engine.rb,
lib/blacklight/routes.rb,
lib/blacklight/version.rb,
lib/blacklight/exceptions.rb,
lib/blacklight/parameters.rb,
app/values/blacklight/types.rb,
lib/blacklight/search_state.rb,
lib/blacklight/configuration.rb,
lib/blacklight/search_builder.rb,
lib/blacklight/runtime_registry.rb,
lib/blacklight/routes/exportable.rb,
lib/blacklight/routes/searchable.rb,
lib/blacklight/abstract_repository.rb,
lib/blacklight/configuration/field.rb,
lib/blacklight/configuration/fields.rb,
app/models/blacklight/suggest_search.rb,
lib/blacklight/configuration/context.rb,
app/models/blacklight/facet_paginator.rb,
app/services/blacklight/field_retriever.rb,
lib/blacklight/configuration/null_field.rb,
lib/blacklight/configuration/sort_field.rb,
app/presenters/blacklight/json_presenter.rb,
app/presenters/blacklight/rendering/join.rb,
app/presenters/blacklight/show_presenter.rb,
lib/blacklight/configuration/facet_field.rb,
lib/blacklight/configuration/tool_config.rb,
lib/generators/blacklight/user_generator.rb,
app/controllers/concerns/blacklight/facet.rb,
app/presenters/blacklight/field_presenter.rb,
app/presenters/blacklight/index_presenter.rb,
lib/blacklight/configuration/search_field.rb,
lib/generators/blacklight/solr4_generator.rb,
lib/generators/blacklight/solr5_generator.rb,
lib/generators/blacklight/assets_generator.rb,
lib/generators/blacklight/models_generator.rb,
app/controllers/concerns/blacklight/suggest.rb,
lib/generators/blacklight/install_generator.rb,
app/presenters/blacklight/document_presenter.rb,
app/presenters/blacklight/rendering/pipeline.rb,
lib/generators/blacklight/document_generator.rb,
app/presenters/blacklight/rendering/microdata.rb,
app/helpers/blacklight/suggest_helper_behavior.rb,
app/presenters/blacklight/rendering/terminator.rb,
lib/generators/blacklight/controller_generator.rb,
app/models/concerns/blacklight/suggest/response.rb,
app/helpers/blacklight/component_helper_behavior.rb,
app/services/blacklight/search_params_yaml_coder.rb,
lib/generators/blacklight/test_support_generator.rb,
app/presenters/blacklight/rendering/abstract_step.rb,
app/presenters/blacklight/rendering/helper_method.rb,
app/presenters/blacklight/rendering/link_to_facet.rb,
app/controllers/concerns/blacklight/saved_searches.rb,
app/controllers/concerns/blacklight/search_history.rb,
app/presenters/blacklight/link_alternate_presenter.rb,
lib/generators/blacklight/search_builder_generator.rb,
app/controllers/concerns/blacklight/request_builders.rb,
app/helpers/blacklight/deprecated_url_helper_behavior.rb,
app/controllers/concerns/blacklight/default_component_configuration.rb
Overview
Methods added to this helper will be available to all templates in the hosting application
Defined Under Namespace
Modules: Base, BlacklightHelperBehavior, Bookmarks, Catalog, CatalogHelperBehavior, ComponentHelperBehavior, Configurable, ConfigurationHelperBehavior, Controller, DefaultComponentConfiguration, DeprecatedUrlHelperBehavior, Document, Exceptions, Facet, FacetsHelperBehavior, HashAsHiddenFieldsHelperBehavior, LayoutHelperBehavior, Parameters, RenderConstraintsHelperBehavior, RenderPartialsHelper, Rendering, RequestBuilders, Routes, SavedSearches, SearchContext, SearchFields, SearchHelper, SearchHistory, SearchHistoryConstraintsHelperBehavior, Solr, Suggest, SuggestHelperBehavior, TokenBasedUser, Types, UrlHelperBehavior, User, Utils
Classes: AbstractRepository, Assets, Configuration, ControllerGenerator, DocumentGenerator, DocumentPresenter, Engine, FacetPaginator, FieldPresenter, FieldRetriever, IndexPresenter, Install, JsonPresenter, LinkAlternatePresenter, ModelsGenerator, NestedOpenStructWithHashAccess, OpenStructWithHashAccess, RuntimeRegistry, SearchBuilder, SearchBuilderGenerator, SearchParamsYamlCoder, SearchState, ShowPresenter, Solr4Generator, Solr5Generator, SuggestSearch, TestSupport, UserGenerator
Constant Summary
collapse
- VERSION =
self.version
Class Method Summary
collapse
Class Method Details
.blacklight_config_file ⇒ Object
24
25
26
|
# File 'lib/blacklight.rb', line 24
def self.blacklight_config_file
"#{::Rails.root}/config/blacklight.yml"
end
|
.blacklight_yml ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/blacklight.rb', line 71
def self.blacklight_yml
require 'erb'
require 'yaml'
return @blacklight_yml if @blacklight_yml
unless File.exist?(blacklight_config_file)
raise "You are missing a configuration file: #{blacklight_config_file}. Have you run \"rails generate blacklight:install\"?"
end
begin
blacklight_erb = ERB.new(IO.read(blacklight_config_file)).result(binding)
rescue StandardError, SyntaxError => e
raise("#{blacklight_config_file} was found, but could not be parsed with ERB. \n#{e.inspect}")
end
begin
@blacklight_yml = YAML.load(blacklight_erb)
rescue => e
raise("#{blacklight_config_file} was found, but could not be parsed.\n#{e.inspect}")
end
if @blacklight_yml.nil? || !@blacklight_yml.is_a?(Hash)
raise("#{blacklight_config_file} was found, but was blank or malformed.\n")
end
@blacklight_yml
end
|
.connection_config ⇒ Object
60
61
62
63
64
65
|
# File 'lib/blacklight.rb', line 60
def self.connection_config
Blacklight::RuntimeRegistry.connection_config ||= begin
raise "The #{::Rails.env} environment settings were not found in the blacklight.yml config" unless blacklight_yml[::Rails.env]
blacklight_yml[::Rails.env].symbolize_keys
end
end
|
.connection_config=(value) ⇒ Object
.default_configuration ⇒ Object
The default Blacklight configuration.
.default_index ⇒ Object
The default index connection for the search index
.default_index=(repository) ⇒ Object
.logger ⇒ Object
99
100
101
102
103
|
# File 'lib/blacklight.rb', line 99
def self.logger
@logger ||= begin
::Rails.logger if defined? Rails and Rails.respond_to? :logger
end
end
|
.logger=(logger) ⇒ Object
105
106
107
|
# File 'lib/blacklight.rb', line 105
def self.logger= logger
@logger = logger
end
|
.repository_class ⇒ Object
The configured repository class. By convention, this is the class Blacklight::(name of the adapter)::Repository, e.g.
elastic_search => Blacklight::ElasticSearch::Repository
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/blacklight.rb', line 42
def self.repository_class
case connection_config[:adapter]
when 'solr'
Blacklight::Solr::Repository
when /::/
connection_config[:adapter].constantize
else
raise "The value for :adapter was not found in the blacklight.yml config" unless connection_config.key? :adapter
Blacklight.const_get("#{connection_config.fetch(:adapter)}/Repository".classify)
end
end
|
.root ⇒ Object
returns the full path the the blacklight plugin installation
118
119
120
|
# File 'lib/blacklight.rb', line 118
def self.root
@root ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
end
|
.version ⇒ Object
4
5
6
|
# File 'lib/blacklight/version.rb', line 4
def self.version
@version ||= File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION')).chomp
end
|