Skip to content

Commit

Permalink
add permissions exec after gem install #17
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning committed Nov 14, 2013
1 parent a4bd481 commit e16d84c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 38 deletions.
4 changes: 4 additions & 0 deletions manifests/gem.pp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
exec { "rbenv-rehash-${gem}-${ruby_version}":
command => "${install_dir}/bin/rbenv rehash",
refreshonly => true,
}~>
exec { "rbenv-permissions-${gem}-${ruby_version}":
command => "/bin/chown -R ${rbenv::owner}:${rbenv::group} ${install_dir}/versions/${ruby_version}/lib/ruby/gems && /bin/chmod -R g+w ${install_dir}/versions/${ruby_version}/lib/ruby/gems",
refreshonly => true,
}

Exec { require => Exec["rbenv-install-${ruby_version}"] }
Expand Down
16 changes: 1 addition & 15 deletions manifests/plugin.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,6 @@
# Default: $rbenv::install_dir
# This variable is required.
#
# [$owner]
# This is set when you declare the rbenv class. There is no
# need to overrite it when calling the rbenv::build define.
# Default: $rbenv::owner
# This variable is required.
#
# [$group]
# This is set when you declare the rbenv class. There is no
# need to overrite it when calling the rbenv::build define.
# Default: $rbenv::group
# This variable is required.
#
# === Requires
#
# You will need to install the git package on the host system.
Expand All @@ -34,8 +22,6 @@
#
define rbenv::plugin(
$install_dir = $rbenv::install_dir,
$owner = $rbenv::owner,
$group = $rbenv::group,
) {
include rbenv

Expand All @@ -48,7 +34,7 @@
unless => "/usr/bin/test -d ${install_dir}/plugins/${plugin[1]}",
}~>
exec { "rbenv-permissions-${name}":
command => "/bin/chown -R ${owner}:${group} ${install_dir} && /bin/chmod -R g+w ${install_dir}",
command => "/bin/chown -R ${rbenv::owner}:${rbenv::group} ${install_dir} && /bin/chmod -R g+w ${install_dir}",
refreshonly => true,
}

Expand Down
4 changes: 1 addition & 3 deletions spec/defines/gem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
end

it { should include_class('rbenv') }

it { should contain_exec("gem-install-bundler-2.0.0-p247") }

it { should contain_exec("rbenv-rehash-bundler-2.0.0-p247") }

it { should contain_exec("rbenv-permissions-bundler-2.0.0-p247") }
end
end
20 changes: 0 additions & 20 deletions spec/defines/plugin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,11 @@
let(:params) do
{
:install_dir => '/usr/local/rbenv',
:owner => 'root',
:group => 'adm',
}
end

it { should include_class('rbenv') }

it { should contain_exec("install-sstephenson/ruby-build") }
#it { should contain_exec("install-ruby-build").with(
# {
# 'command' => "/usr/bin/git clone git://github.com/sstephenson/ruby-build.git",
# 'cwd' => "/usr/local/rbenv/plugins",
# 'onlyif' => "/usr/bin/test -d /usr/local/rbenv/plugins",
# 'unless' => "/usr/bin/test -d /usr/local/rbenv/plugins/ruby-build",
# }
#)}

it { should contain_exec("rbenv-permissions-sstephenson/ruby-build") }
#it { should contain_exec('rbenv-permissions-ruby-build').with(
# {
# 'command' => "chown -R root:adm /usr/local/rbenv && chmod -R g+w /usr/local/rbenv",
# 'refreshonly' => true,
# }
#)}

end

end

0 comments on commit e16d84c

Please sign in to comment.