lib/thinking_sphinx/xml/tasks.rb in ts-xml-0.0.1 vs lib/thinking_sphinx/xml/tasks.rb in ts-xml-1.0.2

- old
+ new

@@ -1,11 +1,19 @@ -require 'thinking_sphinx' -require 'thinking_sphinx/xml' - namespace :thinking_sphinx do # http://www.sphinxsearch.com/docs/current.html#xmlpipe2 desc "Streams XML data to STDOUT" - task :xml => :app_env do + task :xml do + # Load app environment. + # Redirect STDOUT ("**Erubis 2.6.5" etc) to STDERR. + begin + _stdout = STDOUT.clone + STDOUT.reopen(STDERR) + Rake::Task["thinking_sphinx:app_env"].invoke + ensure + STDOUT.reopen(_stdout) + end + require 'thinking_sphinx' + require 'thinking_sphinx/xml' # ThinkingSphinx::Configuration.instance.load_models source_name = ENV["NAME"] # STDERR.puts "Source name: #{source_name}" source_name =~ /^(.+)_(delta|core)_(\d+)$/ sphinx_name = $1