Versions:
- Ruby 2.0.0
- Capistrano 3.3.5
Platform:
- debian wheezy.
hello group,
I encountered an unexpected feature of capistrano. When I test a file or
directory with 'if test [ -d .....]', in a within block, the directory of
that test is based on the working directory instead of the directory in the
within block.
Who can explain what happens?
The following Capfile illustrates this; the second task is the most
readable, but does not work as I expect. The first, in which the file test
is done outside the within block, is a working version of it. Has this
anything to do with the ssh toolkit? Can I use the second task by adjusting
the used syntax?
require 'capistrano/setup'
require 'capistrano/deploy'
namespace :rbg do
desc 'check git directory'
task :check_gitdir do
on roles :installatie, :test do
if test ( "[ -d " + fetch( :deploy_to) + "/.git ]" )
info " git-dir exists"
else
info " git-dir does not exist"
within deploy_to do
execute :git, 'init'
end
end
end
end
task :check_gitdir_doesn_work do
on roles :installatie, :test do
within deploy_to do
if test "[ -d .git ]"
info " git-dir exists"
else
info " git-dir does not exist"
execute :git, 'init'
end
end
end
end
end
Output of task 1 (correct) when applying this on a host with a .git
directory within the deploy directory:
INFO git-dir exists
Output of task 2 in the same situation:
INFO git-dir does not exist
INFO [e64c94b6] Running /usr/bin/env git init as [email protected]
INFO [e64c94b6] Finished in 0.238 seconds with exit status 0 (successful).
INFO [b45c3b5b] Running /usr/bin/env git remote add repo REPOSITORYNAME as
.......
Thanks in advance for helping me understanding what is going on.
Ruud
--
You received this message because you are subscribed to the Google Groups
"Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/capistrano/8d2bab9b-3355-43c3-be15-66a3e0606324%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.