capistrano / composer

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

composer_working_dir dependent on release path #37

Closed Clindbergh closed 9 years ago

Clindbergh commented 9 years ago

If my composer project was in a subdirectory, I expect to be able to do

set :composer_working_dir, "directory/with/composer/project"

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:

set :composer_working_dir, Proc.new { fetch(:release_path) ? fetch(:release_path) + "mySubdirectory" :"" }

Might be related to this: #36

swalkinshaw commented 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.

Clindbergh commented 9 years ago

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:

Clindbergh commented 9 years ago

@swalkinshaw: The property "composer_project_dir" in my PR would now have the behaviour expected in your post.

swalkinshaw commented 9 years ago

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') }