Vagrant: Add phantomjs and casperjs

refs #4219
This commit is contained in:
Eric Lippmann 2013-06-06 14:36:20 +02:00 committed by Marius Hein
parent ea2ad1f8c0
commit 117c8430be
4 changed files with 148 additions and 0 deletions

View File

@ -0,0 +1 @@
export PATH="$PATH:/usr/local/bin"

View File

@ -240,3 +240,19 @@ exec { 'populate-openldap':
require => [Service['slapd'], File['openldap/db.ldif'],
File['openldap/dit.ldif'], File['openldap/users.ldif']]
}
class { 'phantomjs':
url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2',
output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2',
creates => '/usr/local/phantomjs'
}
class { 'casperjs':
url => 'https://github.com/n1k0/casperjs/tarball/1.0.2',
output => 'casperjs-1.0.2.tar.gz',
creates => '/usr/local/casperjs'
}
file { '/etc/profile.d/env.sh':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/profile.d/env.sh'
}

View File

@ -0,0 +1,66 @@
# Class: casperjs
#
# This module downloads, extracts, and installs casperjs tar.gz archives
# using wget and tar.
#
# Parameters:
# [*url*] - fetch archive via wget from this url.
# [*output*] - filename to fetch the archive into.
# [*creates*] - target directory the software will install to.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# class {'casperjs':
# url => 'https://github.com/n1k0/casperjs/tarball/1.0.2',
# output => 'casperjs-1.0.2.tar.gz',
# creates => '/usr/local/casperjs'
# }
#
class casperjs(
$url,
$output,
$creates
) {
Exec { path => '/usr/bin:/bin' }
$cwd = '/usr/local/src'
include wget
exec { 'download-casperjs':
cwd => $cwd,
command => "wget -q ${url} -O ${output}",
creates => "${cwd}/${output}",
timeout => 120,
require => Class['wget']
}
$tld = inline_template('<%= File.basename(output, ".tar.bz2") %>')
$src = "${cwd}/casperjs"
exec { 'extract-casperjs':
cwd => $cwd,
command => "mkdir -p casperjs && tar --no-same-owner \
--no-same-permissions -xzf ${output} -C ${src} \
--strip-components 1",
creates => $src,
require => Exec['download-casperjs']
}
file { 'install-casperjs':
path => $creates,
source => $src,
recurse => true,
require => Exec['extract-casperjs']
}
file { 'link-casperjs-bin':
ensure => "${creates}/bin/casperjs",
path => '/usr/local/bin/casperjs'
}
}

View File

@ -0,0 +1,65 @@
# Class: phantomjs
#
# This module downloads, extracts, and installs phantomjs tar.bz2 archives
# using wget and tar.
#
# Parameters:
# [*url*] - fetch archive via wget from this url.
# [*output*] - filename to fetch the archive into.
# [*creates*] - target directory the software will install to.
#
# Actions:
#
# Requires:
#
# Sample Usage:
#
# class {'phantomjs':
# url => 'https://phantomjs.googlecode.com/files/phantomjs-1.9.1-linux-x86_64.tar.bz2',
# output => 'phantomjs-1.9.1-linux-x86_64.tar.bz2',
# creates => '/usr/local/phantomjs'
# }
#
class phantomjs(
$url,
$output,
$creates
) {
Exec { path => '/usr/bin:/bin' }
$cwd = '/usr/local/src'
include wget
exec { 'download-phantomjs':
cwd => $cwd,
command => "wget -q ${url} -O ${output}",
creates => "${cwd}/${output}",
timeout => 120,
require => Class['wget']
}
$src = "${cwd}/phantomjs"
exec { 'extract-phantomjs':
cwd => $cwd,
command => "mkdir -p phantomjs && tar --no-same-owner \
--no-same-permissions -xjf ${output} -C ${src} \
--strip-components 1",
creates => $src,
require => Exec['download-phantomjs']
}
file { 'install-phantomjs':
path => $creates,
source => $src,
recurse => true,
require => Exec['extract-phantomjs']
}
file { 'link-phantomjs-bin':
ensure => "${creates}/bin/phantomjs",
path => '/usr/local/bin/phantomjs'
}
}