diff --git a/lib/facter/latest_phantomjsversion.rb b/lib/facter/latest_phantomjsversion.rb new file mode 100644 index 0000000..d27723c --- /dev/null +++ b/lib/facter/latest_phantomjsversion.rb @@ -0,0 +1,11 @@ +Facter.add("latest_phantomjsversion") do + setcode do + require 'open-uri' + url="http://phantomjs.org/download.html" + + file = open("#{url}") + contents = file.read() + match = contents.match(/phantomjs-((\d\.){2}\d)-linux/) + version = match[1] + end +end diff --git a/manifests/init.pp b/manifests/init.pp index 8b1c029..4291daa 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,6 +1,6 @@ # Base class for phantomjs module class phantomjs ( - $package_version = '1.9.7', + $package_version = $::latest_phantomjsversion, $source_url = undef, $source_dir = '/opt', $install_dir = '/usr/local/bin',