class Object

Public Instance Methods

sunspot_solr_in_load_path?() click to toggle source
# File lib/sunspot/rails/tasks.rb, line 76
def sunspot_solr_in_load_path?
  # http://www.rubular.com/r/rJGDh7eOSc
  $:.any? { |path| path.to_s =~ %r{sunspot_solr(-[^/]+)?/lib$} }
end
with_session(new_session) { || ... } click to toggle source

Swaps sunspot sessions for the duration of the block Ensures the session is returned to normal in case this task is called from within the rails app and not just a one-off from the command line

# File lib/sunspot/rails/tasks.rb, line 68
def with_session(new_session)
  original_session = Sunspot.session
  Sunspot.session = new_session
  yield
ensure
  Sunspot.session = original_session
end