lib/endeca.rb in endeca-1.4.2 vs lib/endeca.rb in endeca-1.5.0
- old
+ new
@@ -1,60 +1,65 @@
require 'curb'
require 'yajl'
require 'logger'
+require 'uri'
$:.unshift(File.dirname(__FILE__))
require 'core_ext'
require 'endeca/logging'
require 'endeca/benchmarking'
-require 'endeca/readers'
-require 'endeca/map'
-require 'endeca/transformer'
-require 'endeca/dimension'
-require 'endeca/refinement_dimension'
-require 'endeca/refinement'
-require 'endeca/breadcrumbs'
-require 'endeca/breadcrumb'
-require 'endeca/request'
-require 'endeca/document_collection'
-require 'endeca/document'
-
module Endeca
extend Benchmarking
extend Logging
# :stopdoc:
- VERSION = '1.4.2'
+ VERSION = '1.5.0'
# :startdoc:
# Returns the version string for the library.
def self.version
VERSION
end
- # Set Endeca.debug = true to turn on query logging
- # Set Endeca.benchmark = true to turn on query benchmarking
+ # Set ENV['ENDECA_DEBUG'] = true to turn on query logging
+ # Set ENV['ENDECA_BENCHMARK'] = true to turn on query benchmarking
class << self
attr_accessor :logger
- attr_accessor :debug
- attr_accessor :benchmark
attr_accessor :timeout
def analyze?
- debug && logger && benchmark
+ debug? && benchmark?
end
+ def debug?
+ ENV['ENDECA_DEBUG'] == 'true'
+ end
+
+ def benchmark?
+ ENV['ENDECA_BENCHMARK'] == 'true'
+ end
+
end
self.logger = Logger.new(STDOUT)
- self.debug = false
- self.benchmark = false
self.timeout = 8
# Endeca URIs require colons to be escaped
def self.escape(str)
URI.escape(str, /[^-_.!~*'()a-zA-Z\d;\/?@&=+$,\[\]]/n)
end
end
+
+require 'endeca/readers'
+require 'endeca/map'
+require 'endeca/transformer'
+require 'endeca/dimension'
+require 'endeca/refinement_dimension'
+require 'endeca/refinement'
+require 'endeca/breadcrumbs'
+require 'endeca/breadcrumb'
+require 'endeca/request'
+require 'endeca/document_collection'
+require 'endeca/document'
puts ">> Using Endeca gem version: #{Endeca::VERSION}"