Permalink
Browse files

Path to ruby can now be set in cap configuration

  • Loading branch information...
1 parent 0c90844 commit cdea56d556cf1575ddfed04b36e1fb23ccf18848 @kennethkalmer committed Nov 8, 2009
View
@@ -97,6 +97,20 @@ The only default remote dependency is the daemon-kit gem, and it will
check for the same version you currently have installed (or a later
one).
+== Non-standard Ruby installations
+
+If you have a non-standard Ruby installation (somewhere outside PATH), you can
+inform Capistrano about this by setting the following configuration:
+
+ set :ruby_path, "/path/to/ruby"
+
+Please be aware that Capistrano can have a reduced environment, so GEM_HOME
+and other environment variables can be blank causing the start and stop
+commands to misbehave, complaining about missing gems.
+
+This setup can lead to all kinds of strange issues, but jump on the mailing
+list so we can work towards refining it better.
+
== More capistrano resources
To see a list of available commands, please run the following command
@@ -33,6 +33,9 @@
# into the root directory of the deployment.
set :shared_children, %w{log tmp}
+# Using a ruby interpreter not in PATH? Set it here
+#set :ruby_path, '/opt/ree/bin/ruby'
+
# Record our dependencies
unless File.directory?( "#{DaemonKit.root}/vendor/daemon_kit" )
depend :remote, :gem, "daemon-kit", ">=#{DaemonKit::VERSION}"
@@ -2,5 +2,4 @@
#set :user, "<% name %>" # defaults to the currently logged in user
set :daemon_env, 'production'
-set :domain, 'example.com'
-server domain
+role :app, 'backoffice.example.com'
@@ -2,5 +2,4 @@
#set :user, "<% name %>" # defaults to the currently logged in user
set :daemon_env, 'staging'
-set :domain, 'example.com'
-server domain
+role :app, 'staging.example.com'
@@ -67,6 +67,9 @@ def _cset(name, *args, &block)
# standalone case, or during deployment.
_cset(:latest_release) { exists?(:deploy_timestamped) ? release_path : current_release }
+# Path to Ruby on the server
+_cset(:ruby_path) { capture("which ruby").chomp }
+
# =========================================================================
# These are helper methods that will be available to your recipes.
# =========================================================================
@@ -257,7 +260,7 @@ def try_runner(*args)
task :update_environment do
env = {
'daemon_root' => current_path,
- 'ruby_path' => capture("which ruby")
+ 'ruby_path' => fetch(:ruby_path)
}
put env.to_yaml, "#{release_path}/ENVIRONMENT"
@@ -449,7 +452,7 @@ def try_runner(*args)
the :use_sudo variable to false.
DESC
task :start do
- try_runner "/usr/bin/env DAEMON_ENV=#{fetch(:daemon_env)} #{current_path}/bin/#{application} start"
+ try_runner "#{fetch(:ruby_path)} #{current_path}/bin/#{application} start -e #{fetch(:daemon_env)}"
end
desc <<-DESC
@@ -461,7 +464,7 @@ def try_runner(*args)
the :use_sudo variable to false.
DESC
task :stop do
- try_runner "/usr/bin/env DAEMON_ENV=#{fetch(:daemon_env)} #{current_path}/bin/#{application} stop"
+ try_runner "#{fetch(:ruby_path)} #{current_path}/bin/#{application} stop -e #{fetch(:daemon_env)}"
end
namespace :pending do

0 comments on commit cdea56d

Please sign in to comment.