Question

I would like to add a custom zeus command in custom_plan.rb for starting solr/sunspot and make this to be automatically started for test/development environments when zeus starts.

I am currently running solr for both instances using rake tasks:

 rake sunspot:solr:start RAILS_ENV=test; rake sunspot:solr:start RAILS_ENV=development

I would like to add this to zeus custom_plan.rb as a command:

require 'zeus/rails'

class CustomPlan < Zeus::Rails

  def solr
    # something like this?
    # Sunspot::Rails::Server.new.start
  end

end

Zeus.plan = CustomPlan.new
Was it helpful?

Solution

I found a way to do it using guard-sunspot plugin.

Add gem 'guard-sunspot' to your Gemfile and the add this to Guardfile:

guard 'sunspot', :environment => 'test' do
  watch('Gemfile.lock')
  watch('config/sunspot.yml')
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top