Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I include the capistrano thinking sphinx tasks when using the gem

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'

like image 956
Sam Saffron Avatar asked Jan 24 '23 04:01

Sam Saffron


2 Answers

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.

like image 132
pat Avatar answered Jan 26 '23 07:01

pat


@Khelll: could you please read the Topic? You are pasting code for using TS as plugin.

As Gem you should use:

require 'thinking_sphinx/deploy/capistrano'

That works perfectly.

One should also change the capistrano tasks mentioned on the website to reflect the new before and after callbacks from capistrano to get rid off the deprecation notices:

before "deploy:update_code", "thinking_sphinx:stop"
after "deploy:symlink", "symlink_sphinx_indexes"
after "deploy:symlink", "thinking_sphinx:configure"
after "deploy:symlink", "thinking_sphinx:start"
like image 35
tvdeyen Avatar answered Jan 26 '23 06:01

tvdeyen