Skip to content

Commit

Permalink
Merge pull request #11 from mbrodala/project-user
Browse files Browse the repository at this point in the history
Add user option to composer::project
  • Loading branch information
igalic committed Jan 29, 2015
2 parents 49b06e8 + 23aff19 commit 9485c3b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion manifests/project.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
# [*lock*]
# Toggles whether to update only the hash in composer.lock to avoid "out of date" warnings. Default: false
#
# [*user*]
# The owner of the project. Default: 'root'
#

define composer::project (
$ensure = present,
Expand All @@ -52,6 +55,7 @@
$scripts = true,
$custom_inst = true,
$lock = false,
$user = 'root',
) {
include composer

Expand Down Expand Up @@ -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 ]), ' ')
$user_home = $user ? {
'root' => '/root',
default => "/home/${user}",
}

Exec {
cwd => $target,
path => $::path,
provider => 'posix',
environment => 'HOME=/root',
user => $user,
environment => "HOME=${user_home}",
require => Class['composer'],
}

Expand Down

0 comments on commit 9485c3b

Please sign in to comment.