Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add flag to disable god in thinking sphinx plugin #3

Closed
wants to merge 1 commit into from

2 participants

@crankharder

I don't use god to monitor processes. Requiring it should be optional.

@technicalpickles

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 3, 2011
  1. @crankharder

    add option to disable god

    crankharder authored
This page is out of date. Refresh to see the latest.
Showing with 16 additions and 11 deletions.
  1. +1 −0  README.rdoc
  2. +15 −11 lib/sphinx.rb
View
1  README.rdoc
@@ -14,6 +14,7 @@ moonshine_sphinx requires:
* At least revision cf2c44881e49633a8507149024e1f2dcbf63335e[http://github.com/railsmachine/moonshine/commit/cf2c44881e49633a8507149024e1f2dcbf63335e] of moonshine
* moonshine_god to be installed as a plugin
+** moonshine_god can be disabled by setting :use_god: false in moonshine.yml
* thinking_sphinx installed and configured
=== Instructions
View
26 lib/sphinx.rb
@@ -6,7 +6,7 @@ def self.included(manifest)
manifest.class_eval do
extend ClassMethods
- configure :sphinx => { :version => '0.9.8.1', :extra => {} }
+ configure :sphinx => { :version => '0.9.8.1', :extra => {}, :use_god => true }
configure :rails_logrotate => {}
end
@@ -36,11 +36,13 @@ def sphinx_template_dir
# plugin :sphinx
# recipe :sphinx
def sphinx(options = {})
- if respond_to?(:god)
- # We need god in our lives to start/stop/monitor searchd
- recipe :god
- else
- raise "Could not find god recipe, aborting. Please install moonshine_god recipe: script/plugin install git://github.com/railsmachine/moonshine_god.git and redeploy"
+ if configuration[:sphinx][:use_god]
+ if respond_to?(:god)
+ # We need god in our lives to start/stop/monitor searchd
+ recipe :god
+ else
+ raise "Could not find god recipe, aborting. Please install moonshine_god recipe: script/plugin install git://github.com/railsmachine/moonshine_god.git and redeploy"
+ end
end
configure :sphinx => YAML::load(template(sphinx_template_dir + 'sphinx.yml', binding))
@@ -113,11 +115,13 @@ def sphinx(options = {})
:postrotate => "#{postrotate}\n pkill -USR1 searchd"
})
- file "/etc/god/#{configuration[:application]}-sphinx.god",
- :ensure => :present,
- :require => file('/etc/god/god.conf'),
- :content => template(sphinx_template_dir.join('sphinx.god')),
- :notify => exec('restart_god')
+ if configuration[:sphinx][:use_god]
+ file "/etc/god/#{configuration[:application]}-sphinx.god",
+ :ensure => :present,
+ :require => file('/etc/god/god.conf'),
+ :content => template(sphinx_template_dir.join('sphinx.god')),
+ :notify => exec('restart_god')
+ end
unless configuration[:sphinx][:index_cron] == false
current_rails_root = "#{configuration[:deploy_to]}/current"
Something went wrong with that request. Please try again.