Class: Guard::Sunspot

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/sunspot.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ Sunspot

Returns a new instance of Sunspot.



7
8
9
10
11
# File 'lib/guard/sunspot.rb', line 7

def initialize(watchers=[], options={})
  super

  @environment = options[:environment] || 'development'
end

Instance Method Details

#reloadObject



23
24
25
26
# File 'lib/guard/sunspot.rb', line 23

def reload
  stop
  start
end

#run_on_changes(path) ⇒ Object



28
29
30
# File 'lib/guard/sunspot.rb', line 28

def run_on_changes(path)
  reload
end

#startObject



13
14
15
16
# File 'lib/guard/sunspot.rb', line 13

def start
  system("rake sunspot:solr:start RAILS_ENV=#{@environment}")
  UI.info "Sunspot started"
end

#stopObject



18
19
20
21
# File 'lib/guard/sunspot.rb', line 18

def stop
  system("rake sunspot:solr:stop RAILS_ENV=#{@environment}")
  UI.info "Sunspot stopped"
end