capistrano / composer

Capistrano extension for Composer tasks
MIT License
183 stars 48 forks source link

Wrong usage of application symbol #43

Open webdevilopers opened 8 years ago

webdevilopers commented 8 years ago

Originally came from https://github.com/xuwupeng2000/capsitrano-scm-gitcopy/issues/33.

I'm not sure if this is NOT a Capistrano issue. But since everything used to work fine in staging before implementing scm-gitcopy into production I will post it here.

In my deploy.rb my application symbol is set to:

set :application, 'Semcoglas'
set :deploy_to, '/var/www/semcoweb'

I always regarded application as App name.

When I run cap production deploy everything works fine so far. All paths are used correctly based on the deploy_to symbol.

But then, when Composer is supposed to run, the path suddenly changes to /var/www/Semcoglas <- name of the :application symbol.

Of course I get a _Could not open file: /var/www/Semcoglas/shared/composer.phar_ error.

I tried without defining :application and indeed the wrong path will become /var/www/shared/....

Any idea what is happening here?

webdevilopers commented 8 years ago

For instance I had to set :application separately in my staging deploy files to make composer get the correct shared path:

# staging.rb

set :application, 'semcoglas'
set :deploy_to, '/var/www/semcoglas'
set :scm, :git

set :composer_install_flags, '--no-dev --no-interaction --optimize-autoloader'

SSHKit.config.command_map[:composer] = "php #{shared_path.join("composer.phar")}"
# production.rb

set :application, 'semcoweb'
set :deploy_to, '/var/www/semcoweb'
set :scm, :git_copy

set :composer_install_flags, '--no-dev --no-interaction --optimize-autoloader'

SSHKit.config.command_map[:composer] = "php #{shared_path.join("composer.phar")}"

The shared_path should actually look the same as the deploy_to. But without the :applicationsymbol is only /var/www/shared/ as described above.

webdevilopers commented 8 years ago

I just saw that this is related to issue https://github.com/capistrano/composer/issues/39 by @gagarine. @swalkinshaw closed that one as not an issue.

Also related: