views:

547

answers:

3

Im using the gem for thinking sphinx:

sudo gem install freelancing-god-thinking-sphinx \
  --source http://gems.github.com

So:

require 'vendor/plugins/thinking-sphinx/recipes/thinking_sphinx'

Which is prescribed on the website does not work.

How do I include the capistrano thinking sphinx tasks in my deploy.rb file when using the gem?

EDIT

Adding: require 'thinking_sphinx/deploy/capistrano'

gives me:

 
/usr/lib/ruby/gems/1.8/gems/freelancing-god-thinking-sphinx-1.1.12/lib/thinking_sphinx/deploy/capistrano.rb:1: undefined method `namespace' for main:Object (NoMethodError)
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/gems/1.8/gems/capistrano-2.5.8/lib/capistrano/configuration/loading.rb:152:in `require'

A: 

How about:

require 'vendor/plugins/thinking_sphinx/lib/thinking_sphinx/deploy/capistrano'
khelll
+1  A: 

You're talking about installing a gem and then requiring a plugin. Have you tried installing the plugin version of Thinking Sphinx?

EDIT: I speak too quickly, clearly. The deployment recipes are in lib/thinking_sphinx/deploy/capistrano. Try require 'thinking_sphinx/deploy/capistrano' and you should have access to the deployment recipes—in a test project I just threw that in my Rakefile and I have access to them.

On a brand new project, I put the following in my Capfile:

load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy'
require 'thinking_sphinx/deploy/capistrano'

When I do cap -T, I see the thinking_sphinx capistrano tasks. I think what I wrote above was because I had the plugin installed. /me smacks self.

theIV
yeah that failed
Sam Saffron
Hmm, I'll double check to see if I did anything differently.
theIV
Ok, sudo gem update fixed whatever mess I had
Sam Saffron
Sorry, Im giving pat the answer as he is the authority on everything thinking sphinx
Sam Saffron
No worries. Glad you got it working! :)
theIV
+3  A: 

The simple require as defined in another answer - thinking_sphinx/deploy/capistrano - should work. If it's not, are you seeing any errors? What version of the gem are you using?

If that fails, perhaps try a sudo gem update in case your gems are old.

pat
Pat, thanks so much for taking your time to answer, Im still getting an error (using cap 2.5.8 and sphinx 1.1.12) I put a full log in my answer
Sam Saffron
OK, *sudo gem update* fixed whatever mess I had. Thanks for your help and for the awesome library. (I hope you don't mind that I edited that in to your answer)
Sam Saffron
Not at all, as long as you got it working :)I don't think the cap tasks were there in 1.1.12 (could be, it's been a few months), so that was almost certainly the cause.
pat