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

Add user option to composer::project #11

Merged
merged 1 commit into from
Jan 29, 2015

Conversation

mbrodala
Copy link
Contributor

This option allows for setting a specific user to create composer projects
with. This is useful e.g. to have a SSH key of a user used for Git clones.

Fixes #10

@mbrodala
Copy link
Contributor Author

I had to drop $composer::params::user since it's apparently not evaluated in tests.

@@ -82,12 +86,17 @@
$create_project_opts = join(flatten([$dev_opt, "--prefer-${prefer}"]), ' ')
$install_opts = join(flatten([$dev_opt, $script_opt, $custom_inst_opt, "--prefer-${prefer}" ]), ' ')
$update_opts = join(flatten([$dev_opt, $script_opt, $custom_inst_opt, "--prefer-${prefer}", $lock_opt ]), ' ')
$home_directory = $user ? {
Copy link
Contributor

Choose a reason for hiding this comment

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

i'd simply allow this to be passed, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That'd cause a lot of headaches since a composer command executed as non-root must have write access to $target, otherwise an error occurs. I'd suggest adding a $composer_home option instead which sets COMPOSER_HOME. But that's something for a different PR.

@igalic
Copy link
Contributor

igalic commented Jan 29, 2015

the tests are failing because composer::params isn't evaluated (before they are running)

you could do that with:

 let :pre_condition do
   'include "composer"'
 end

in spec/defines/project_spec.rb. that should force the evaluation of composer::params before the tests are run.

@mbrodala
Copy link
Contributor Author

Although this would allow using $composer::params::user in the tests we cannot expect users to know about this. Thus I'd opt for keeping the value of $user defined locally since most of the time this option will differ from composer::$user anyways. (Latter most likely root, former most likely other user.)

This option allows for setting a specific user to create composer projects
with. This is useful e.g. to have a SSH key of a user used for Git clones.

Fixes Brainsware#10
@igalic
Copy link
Contributor

igalic commented Jan 29, 2015

agreed. let's merge this for now, and then clean it up properly.

igalic added a commit that referenced this pull request Jan 29, 2015
Add user option to composer::project
@igalic igalic merged commit 9485c3b into Brainsware:master Jan 29, 2015
@mbrodala mbrodala deleted the project-user branch January 29, 2015 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add user option to composer::project
2 participants