Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Using

class { '::phantomjs':
package_version => '1.9.7',
package_update => true,
install_dir => '/usr/local/bin',
source_dir => '/opt',
timeout => 300
Expand Down
17 changes: 10 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
$source_url = undef,
$source_dir = '/opt',
$install_dir = '/usr/local/bin',
$package_update = false,
$timeout = 300
) {

Expand Down Expand Up @@ -56,6 +55,14 @@
default => $source_url,
}

exec { 'remove phantomjs':
command => "/bin/rm -rf ${source_dir}/phantomjs",
onlyif => [
"/usr/bin/test $(${install_dir}/phantomjs --version) != '${package_version}'",
"/usr/bin/test -d ${source_dir}/phantomjs"
]
}

exec { 'get phantomjs':
command => "/usr/bin/curl --silent --show-error --fail --location ${pkg_src_url} --output ${source_dir}/phantomjs.tar.bz2 \
&& mkdir ${source_dir}/phantomjs \
Expand All @@ -65,16 +72,12 @@
timeout => $timeout
}

Exec['remove phantomjs'] ~> Exec[ 'get phantomjs' ]

file { "${install_dir}/phantomjs":
ensure => link,
target => "${source_dir}/phantomjs/bin/phantomjs",
force => true,
}

if $package_update {
exec { 'remove phantomjs':
command => "/bin/rm -rf ${source_dir}/phantomjs",
notify => Exec[ 'get phantomjs' ]
}
}
}