Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
make version usefull for reinstalling
Browse files Browse the repository at this point in the history
  • Loading branch information
loosi committed Jan 20, 2017
1 parent b506d09 commit 1221074
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,16 @@
}

$composer_full_path = "${composer_target_dir}/${composer_command_name}"

$unless = $version ? {
undef => "/usr/bin/test -f ${composer_full_path}",
default => "${composer_full_path} -V |grep -q $version"
}

exec { 'composer-install':
command => "/usr/bin/wget --no-check-certificate -O ${composer_full_path} ${target}",
user => $composer_user,
creates => $composer_full_path,
unless => $unless,
timeout => $download_timeout,
require => Package['wget'],
}
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/composer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
it { should contain_exec('composer-install') \
.with_command('/usr/bin/wget --no-check-certificate -O /usr/local/bin/composer https://getcomposer.org/composer.phar') \
.with_user('root') \
.with_creates('/usr/local/bin/composer')
.with_unless('/usr/bin/test -f /usr/local/bin/composer')
}

it { should contain_file('/usr/local/bin/composer') \
Expand All @@ -15,7 +15,6 @@
}

it { should_not contain_exec('composer-update') }

describe 'with a given target_dir' do
let(:params) {{ :target_dir => '/usr/bin' }}

Expand Down Expand Up @@ -89,6 +88,7 @@
it { should contain_exec('composer-install') \
.with_command('/usr/bin/wget --no-check-certificate -O /usr/local/bin/composer https://getcomposer.org/download/1.0.0-alpha11/composer.phar') \
.with_user('root') \
.with_unless('/usr/local/bin/composer -V |grep -q 1.0.0-alpha11')
}
end

Expand Down

0 comments on commit 1221074

Please sign in to comment.