I was wondering why capistrano symlinks the current directory from the
the root / and not just ../releases/2006xxxx
Small change but it's more robust I think.
Jeroen
- Jamis
> --~--~---------~--~----~------------~-------~--~----~
> To unsubscribe from this group, send email to capistrano-
> unsub...@googlegroups.com
> For more options, visit this group at http://groups.google.com/
> group/capistrano
> -~----------~----~----~----~------~----~------~--~---
>
me too. But if I'm quite positive the relationships between folders are
*very* unlikely to ever change than I will use relative links to make it
more portable.
In this case I have more trust in the fact that the releases folder will
always be in current/../releases than my app's folder staying in the
same place.
I have moved my app's location several times and had to reapply the
symlink. It's no biggy though!
Jeroen
A little def like this:
def relative_path (from_str, to_str)
require 'pathname'
Pathname.new(to_str).relative_path_from(Pathname.new(from_str)).to_s
end
and then the update_code task to get you started.
desc <<-DESC
Update all servers with the latest revision of the source code.
This does a checkout and links into the shared directories.
DESC
task :update_code, :except => { :no_release => true} do
on_rollback { delete release_path, :recursive => true }
log_path = File.join(release_path, 'log')
public_path = File.join(release_path, 'public')
system_path = File.join(public_path, 'system')
shared_log = relative_path(release_path, File.join(shared_path,
'log'))
shared_system = relative_path(public_path, File.join(shared_path,
'system'))
source.checkout(self)
delete log_path, :recursive => true
delete system_path, :recursive => true
send(run_method, "ln -nfs #{shared_log} #{log_path}")
send(run_method, "ln -nfs #{shared_system} #{system_path}")
# Remove release cache
@releases = nil
end