Files
vagrant-golang/modules/golang/manifests/init.pp

48 lines
1.3 KiB
ObjectPascal
Raw Normal View History

2016-01-23 11:12:27 +01:00
class golang ( $version = "1.5.3" ) {
2013-05-02 08:46:45 +01:00
2014-10-01 21:44:30 +01:00
exec { "download-golang":
command => "/usr/bin/wget --no-check-certificate -O /usr/local/src/go$version.linux-amd64.tar.gz http://golang.org/dl/go$version.linux-amd64.tar.gz",
creates => "/usr/local/src/go$version.linux-amd64.tar.gz"
}
2013-05-02 08:46:45 +01:00
2014-10-01 21:44:30 +01:00
exec { "remove-previous-version":
command => "/bin/rm -r /usr/local/go",
onlyif => "/usr/bin/test -d /usr/local/go",
before => Exec["unarchive-golang-tools"]
}
2013-05-02 08:46:45 +01:00
2014-10-01 21:44:30 +01:00
exec { "unarchive-golang-tools":
command => "/bin/tar -C /usr/local -xzf /usr/local/src/go$version.linux-amd64.tar.gz",
require => Exec["download-golang"]
}
2013-05-02 08:46:45 +01:00
2014-10-01 21:44:30 +01:00
exec { "setup-path":
command => "/bin/echo 'export PATH=/vagrant/bin:/usr/local/go/bin:\$PATH' >> /home/vagrant/.profile",
unless => "/bin/grep -q /usr/local/go /home/vagrant/.profile ; /usr/bin/test $? -eq 0"
}
2013-05-02 08:46:45 +01:00
2014-10-01 21:44:30 +01:00
exec { "setup-workspace":
command => "/bin/echo 'export GOPATH=/vagrant' >> /home/vagrant/.profile",
unless => "/bin/grep -q GOPATH /home/vagrant/.profile ; /usr/bin/test $? -eq 0"
}
2013-05-02 08:46:45 +01:00
if ! defined(Package["git"]) {
package { "git":
ensure => present,
}
}
2015-01-18 08:52:21 +00:00
if ! defined(Package["bzr"]) {
package { "bzr":
ensure => present,
}
}
if ! defined(Package["mercurial"]) {
package { "mercurial":
ensure => present,
}
}
2013-05-02 08:46:45 +01:00
}