Created
August 15, 2010 06:47
-
-
Save mattetti/525179 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Add that to your app make, after you define the sinatra env. | |
Thread.current[:thinking_sphinx_environment] = Sinatra::Application.environment | |
# When requiring TS add a new task to properly generate the config file | |
require 'thinking_sphinx' | |
require 'thinking_sphinx/tasks' | |
namespace :thinking_sphinx do | |
namespace :my_app do | |
desc "Generate the Sphinx configuration file using Thinking Sphinx's settings" | |
task :setup => :app_env do | |
Thread.current[:thinking_sphinx_environment] = Sinatra::Application.environment | |
config = ThinkingSphinx::Configuration.instance | |
config.reset(Sinatra::Application.root) | |
puts "Generating Configuration to #{config.config_file}" | |
config.build | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only think you really need to care about is:
If you set that up in your main file before loading your ts tasks, you are good to go.