From 9b21de22bcab56570c0a59c751116fe641e9bbe2 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 14 Jul 2016 19:45:37 +0200 Subject: [PATCH] [GH-15] install latest phantomjs version on default --- lib/facter/latest_phantomjsversion.rb | 11 +++++++++++ manifests/init.pp | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 lib/facter/latest_phantomjsversion.rb 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',