-
-
Save blever/7994730 to your computer and use it in GitHub Desktop.
Puppet defined type for installing R libraries.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# R libraries (on CRAN). | |
# | |
define tarski::r::library($lib = $title, $using = undef) { | |
Exec { | |
path => "/bin:/sbin:/usr/bin:/usr/sbin" | |
} | |
$require_base = [ | |
Package['R'], | |
Package['wget'] | |
] | |
if $using == undef { | |
$require_full = $require_base | |
} else { | |
$require_full = concat($require_base, (any2array($using).map |$u| { Exec[$u] })) | |
} | |
exec { "${lib}": | |
command => "wget http://cran.r-project.org/src/contrib/${lib}.tar.gz; R CMD INSTALL ${lib}.tar.gz; rm ${lib}.tar.gz", | |
require => $require_full | |
} | |
} | |
# Example useage: | |
tarski::r::library { 'plyr_1.8': } | |
tarski::r::library { 'stringr_0.6.2': } | |
tarski::r::library { 'reshape2_1.2.2': | |
using => 'stringr_0.6.2' | |
} | |
tarski::r::library { 'lubridate_1.3.2': | |
using => [ | |
'plyr_1.8', | |
'stringr_0.6.2' | |
] | |
} | |
tarski::r::library { 'data.table_1.8.10': } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment