Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify paths #923

Closed
Closed

Conversation

jordisala1991
Copy link
Contributor

Q A
Bug fix? No
New feature? Yes
BC breaks? No
Deprecations? No
Fixed tickets #922 #921 #920 #879

I'm trying to unify all paths into a variables (similar to Capistrano). What do you think about this PR? I know it's not complete, and will require to change some things and some documentation maybe.

With this PR, one should be able to modify the structure of deployer using the new variables.

We can include new paths like: current_release or previous_release to simplify and make simple to use release_path outside a release.

@jordisala1991 jordisala1991 changed the title [WIP] unifying paths Unify paths Dec 11, 2016
@jordisala1991
Copy link
Contributor Author

Ping @Elfet. Does this have any change to get merged? I have another PR depending on this one.

@antonmedv
Copy link
Member

This is cool release. But what about this?

I know it's not complete, and will require to change some things and some documentation maybe.

Also what PR you want to?

I have another PR depending on this one.

Also i'm wondering is this functionality is really needed? I mean how many people will be using it? Because this PR bring a lot of config option which lead to complicate thinks and refactoring.

For example releases_path and release_path differ only in one s letter which will lid to potential bugs. I think good naming will solve problems.

set('shared_dir', 'shared');
set('dep_dir', '.dep');

set('current_path', '{{deploy_path}}/{{current_dir}}');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now current_path will be returning symlink instead of real path with will lead to bugs. Also does not work with relative symlinks.

Why did you drop this code?

 -set('current_path', function () {
 -    $link = run("readlink {{deploy_path}}/current")->toString();
 -    return substr($link, 0, 1) === '/' ? $link : get('deploy_path') . '/' . $link;
 -});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using a symlink will lead to bugs on the code? I am letting the OS to resolve the symlink instead of forcing a readlink.

}

$link = run("readlink {{deploy_path}}/release")->toString();
return substr($link, 0, 1) === '/' ? $link : get('deploy_path') . '/' . $link;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here. Why you drop this code? Now it's does not support relative symlinks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, I wanted to change release_dirvariable to current_release like capistrano, but I wanted to mantain the PR with not too much changes.

set('release_dir', 'release');
set('releases_dir', 'releases');
set('shared_dir', 'shared');
set('dep_dir', '.dep');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need to modify dir name of .dep?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason to create variables for all directories is to be consistent in the code using those directories, like using a variable to avoid repetition of a constant value.

@antonmedv
Copy link
Member

Please send links to capistrano same fature realization: gonna take closer look.

@jordisala1991
Copy link
Contributor Author

I have another PR which focus on moving all if on the code to the test() function. It was already there, but not used consistently on the code. But since it touched a lot of code too, didn't want to rebase a lot of times.

Capistrano variables structure: https://www.admon.org/scripts/capistrano-variables-list/
Capistrano code: https://github.com/capistrano/capistrano/blob/0965373a4b239665360e15e3ee409f130b6c094b/lib/capistrano/dsl/paths.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants