Module: Blacklight

Extended by:
Configurable, SearchFields
Defined in:
vendor/plugins/blacklight/lib/blacklight.rb

Defined Under Namespace

Modules: CatalogHelper, Configurable, CoreExt, Marc, Routes, SearchFields, Solr, SolrHelper, User

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, search_field_options_for_select

Methods included from Configurable

config, configs, configure, reset_configs!

Class Attribute Details

+ (Object) solr

Returns the value of attribute solr



22
23
24
# File 'vendor/plugins/blacklight/lib/blacklight.rb', line 22

def solr
  @solr
end

+ (Object) solr_config

Returns the value of attribute solr_config



22
23
24
# File 'vendor/plugins/blacklight/lib/blacklight.rb', line 22

def solr_config
  @solr_config
end

Class Method Details

+ (Object) init



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'vendor/plugins/blacklight/lib/blacklight.rb', line 35

def self.init
  
  solr_config = YAML::load(File.open("#{RAILS_ROOT}/config/solr.yml"))
  raise "The #{RAILS_ENV} environment settings were not found in the solr.yml config" unless solr_config[RAILS_ENV]
  
  Blacklight.solr_config[:url] = solr_config[RAILS_ENV]['url']
  
  if Gem.available? 'curb'
    require 'curb'
    Blacklight.solr = RSolr::Ext.connect(Blacklight.solr_config.merge(:adapter=>:curb))
  else
    Blacklight.solr = RSolr::Ext.connect(Blacklight.solr_config)
  end
  
  # set the SolrDocument.connection to Blacklight.solr
  SolrDocument.connection = Blacklight.solr
  logger.info("BLACKLIGHT: running version #{Blacklight.version}")
  logger.info("BLACKLIGHT: initialized with Blacklight.solr_config: #{Blacklight.solr_config.inspect}")
  logger.info("BLACKLIGHT: initialized with Blacklight.solr: #{Blacklight.solr.inspect}")
  logger.info("BLACKLIGHT: initialized with Blacklight.config: #{Blacklight.config.inspect}")
  
end

+ (Object) locate_path(*subpath_fragments)

Searches Rails.root then Blacklight.root for a valid path returns a full path if a valid path is found returns nil if nothing is found. First looks in Rails.root, then Blacklight.root

Example: full_path_to_solr_marc_jar = Blacklight.locate_path ‘solr_marc’, ‘SolrMarc.jar’



83
84
85
86
87
88
89
# File 'vendor/plugins/blacklight/lib/blacklight.rb', line 83

def self.locate_path(*subpath_fragments)
  subpath = subpath_fragments.join('/')
  base_match = [Rails.root, self.root].find do |base|
    File.exists? File.join(base, subpath)
  end
  File.join(base_match.to_s, subpath) if base_match
end

+ (Object) logger



58
59
60
# File 'vendor/plugins/blacklight/lib/blacklight.rb', line 58

def self.logger
  RAILS_DEFAULT_LOGGER
end

+ (Object) root

returns the full path the the blacklight plugin installation



71
72
73
# File 'vendor/plugins/blacklight/lib/blacklight.rb', line 71

def self.root
  @root ||= File.expand_path File.join(__FILE__, '..', '..')
end

+ (Object) version

Just returning a string for the Blacklight version number. I’ve just put master here now, should it say when it’s running under master? (Master?) We need to find a better way of increasing this number automatically during releases, but this is a good way for now.



31
32
33
# File 'vendor/plugins/blacklight/lib/blacklight.rb', line 31

def self.version
  "2.7.0"
end