Closed Clindbergh closed 9 years ago
The default composer_working_dir
is:
set :composer_working_dir, -> { fetch(:release_path) }
You can override it like this:
set :composer_working_dir, -> { 'directory/with/composer/project' }
Can you confirm is that works or not? I don't see how it wouldn't but you never know.
No this does not work. My custom composer_working_dir
apparently needs to be a concatenation of my directory and the release path. And since :release_path
nil at the beginning, I need to do that check in my proc (probably the reason for #36).
Here is what happens:
set :composer_working_dir, -> { 'myDirectory' }
DEBUG [c24e6a58] Running /usr/bin/env if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi as deployer@127.0.0.1
DEBUG [c24e6a58] Command: if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi
DEBUG [c24e6a58] Directory does not exist 'myDirectory'
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deployer@127.0.0.1: if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi exit status: 1
if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi stdout: Nothing written
if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi stderr: Directory does not exist 'myDirectory'
SSHKit::Command::Failed: if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi exit status: 1
if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi stdout: Nothing written
if test ! -d myDirectory; then echo "Directory does not exist 'myDirectory'" 1>&2; false; fi stderr: Directory does not exist 'myDirectory'
Tasks: TOP => composer:run
set :composer_working_dir, -> { fetch(:release_path) }
INFO [7d242e5d] Running /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader as deployer@127.0.0.1
DEBUG [7d242e5d] Command: cd /var/www/home/live/releases/20150305150803 && ( SYMFONY_ENV=prod /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader )
set :composer_working_dir, Proc.new { fetch(:release_path) ? fetch(:release_path) + "myDirectory" :"" }
DEBUG [bd13c3b3] Running /usr/bin/env if test ! -d /var/www/home/live/releases/20150305150927/myDirectory; then echo "Directory does not exist '/var/www/home/live/releases/20150305150927/myDirectory'" 1>&2; false; fi as deployer@127.0.0.1
DEBUG [bd13c3b3] Command: if test ! -d /var/www/home/live/releases/20150305150927/myDirectory; then echo "Directory does not exist '/var/www/home/live/releases/20150305150927/myDirectory'" 1>&2; false; fi
DEBUG [bd13c3b3] Finished in 0.009 seconds with exit status 0 (successful).
INFO [3e2ab45f] Running /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader as deployer@127.0.0.1
DEBUG [3e2ab45f] Command: cd /var/www/home/live/releases/20150305150927/myDirectory&& ( SYMFONY_ENV=prod /usr/bin/env composer install --no-dev --prefer-dist --no-interaction --quiet --optimize-autoloader )
-> works
@swalkinshaw: The property "composer_project_dir" in my PR would now have the behaviour expected in your post.
release_path
should never be nil
during a deploy. I made a mistake when I suggested:
set :composer_working_dir, -> { fetch(:release_path) }
You're correct that it should be:
set :composer_working_dir, -> { "#{fetch(:release_path)/myDirectory}" }
# or
set :composer_working_dir, -> { File.join(fetch(:release_path), 'myDirectory') }
If my composer project was in a subdirectory, I expect to be able to do
However this fails, since the default is dependent on
:release_path
. This dependency should probably be handled within the code. Or if I am misunderstanding the use of it, maybe a second variable for this would be useful.Never having used ruby before, I came up with this alternative:
Might be related to this: #36