Permalink
Browse files

Fixes rake tasks when used with Rails

  • Loading branch information...
1 parent a4a5515 commit 307afb4048091795a00f3107e61f4e374c4b5790 @alindeman alindeman committed Nov 25, 2011
Showing with 17 additions and 4 deletions.
  1. +17 −4 sunspot_solr/lib/sunspot/solr/tasks.rb
@@ -1,21 +1,29 @@
namespace :sunspot do
namespace :solr do
-
desc 'Start the Solr instance'
task :start => :environment do
case RUBY_PLATFORM
when /w(in)?32$/, /java$/
abort("This command is not supported on #{RUBY_PLATFORM}. " +
"Use rake sunspot:solr:run to run Solr in the foreground.")
end
- Sunspot::Solr::Server.new.start
+
+ if defined?(Sunspot::Rails::Server)
+ Sunspot::Rails::Server.new.start
+ else
+ Sunspot::Solr::Server.new.start
+ end
puts "Successfully started Solr ..."
end
desc 'Run the Solr instance in the foreground'
task :run => :environment do
- Sunspot::Solr::Server.new.run
+ if defined?(Sunspot::Rails::Server)
+ Sunspot::Rails::Server.new.run
+ else
+ Sunspot::Solr::Server.new.run
+ end
end
desc 'Stop the Solr instance'
@@ -25,7 +33,12 @@
abort("This command is not supported on #{RUBY_PLATFORM}. " +
"Use rake sunspot:solr:run to run Solr in the foreground.")
end
- Sunspot::Solr::Server.new.stop
+
+ if defined?(Sunspot::Rails::Server)
+ Sunspot::Rails::Server.new.stop
+ else
+ Sunspot::Solr::Server.new.stop
+ end
puts "Successfully stopped Solr ..."
end

0 comments on commit 307afb4

Please sign in to comment.