Created
June 10, 2009 16:59
-
-
Save DimaD/127349 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :sunspot do | |
namespace :solr do | |
desc 'Start the Solr instance' | |
task :start => :merb_env do | |
sunspot_solr = Merb.root / 'vendor' / 'sunspot' / 'bin' / 'sunspot-solr' | |
pid_path = Merb.root / 'tmp' / 'solr' / 'pids' | |
data_path = Merb.root / 'tmp' / 'solr' / 'data' | |
pid_path = Merb.root / 'tmp' / 'solr' / 'pids' | |
solr_home = nil | |
[data_path, pid_path].each { |path| FileUtils.mkdir_p(path) } | |
port = Sunspot::Merb.config.port | |
command = [sunspot_solr, 'start', '--', '-p', port.to_s, '-d', data_path, '--pid-dir', pid_path] | |
FileUtils.cd(File.join(pid_path)) do | |
puts | |
sh command.join(' ') | |
end | |
end | |
desc 'Stop the Solr instance' | |
task :stop => :merb_env do | |
sunspot_solr = Merb.root / 'vendor' / 'sunspot' / 'bin' / 'sunspot-solr' | |
pid_path = Merb.root / 'tmp' / 'solr' / 'pids' | |
port = Sunspot::Merb.config.port | |
command = [sunspot_solr, 'stop', '--', '--pid-dir', pid_path] | |
FileUtils.cd(pid_path) do | |
puts | |
sh command.join(' ') | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment