Capistrano is unable to start and stop the new ferret_server script. An example capistrano task might look like:
namespace :ferret do
namespace :server do
task :stop, :role => :app do
rails_env = fetch(:rails_env, 'production')
run "cd #{latest_release}; script/ferret_server --environment=#{rails_env} stop"
end
end
end
It fails with errors like...
no such file to load -- /bin/../config/environment
./script/../vendor/plugins/acts_as_ferret/lib/server_manager.rb:39:in `require'
./script/../vendor/plugins/acts_as_ferret/lib/server_manager.rb:39
script/ferret_server:4:in `require'
script/ferret_server:4
It's caused by line 39 of server_manager.rb. It tries to find the location of config/environment.rb using ENV['_'], which works fine under normal circumstances (with ENV['_'] equal to script/ferret_server). With capistrano, however, ENV['_'] equals /bin/sh.
My patch is a quick workaround that adds a --root option to the command line that allows you to specify the exact location of your project.
My new ferret recipe looks like...
namespace :ferret do
namespace :server do
task :stop, :role => :app do
rails_env = fetch(:rails_env, 'production')
run "cd #{latest_release}; script/ferret_server --root=#{latest_release} --environment=#{rails_env} stop"
end
end
end