如何让zeus为测试和开发环境启动solr实例?

时间:2013-06-24 12:28:00

标签: ruby-on-rails sunspot-solr zeus

我想在custom_plan.rb中添加一个自定义zeus命令来启动solr / sunspot,并在zeus启动时使其自动启动测试/开发环境。

我目前正在使用rake任务为两个实例运行solr:

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

我想将此添加到zeus custom_plan.rb作为命令:

require 'zeus/rails'

class CustomPlan < Zeus::Rails

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

end

Zeus.plan = CustomPlan.new

1 个答案:

答案 0 :(得分:2)

我找到了一种使用guard-sunspot插件的方法。

将gem'guard-sunspot'添加到您的Gemfile中并将其添加到Guardfile:

guard 'sunspot', :environment => 'test' do
  watch('Gemfile.lock')
  watch('config/sunspot.yml')
end