Install git and mercurial

To make "go get" work in most cases you need either git or mercurial installed to clone the dependencies.
Now the golang class will install these but the requirement to update aptitude (on debian based machines) is not a concern for the golang class and so is handled outside of the class.
This commit is contained in:
Darren Coxall
2014-12-24 13:33:29 +00:00
parent 1448a2deca
commit 413ae77b4f
3 changed files with 27 additions and 3 deletions

View File

@@ -29,7 +29,7 @@ hello
## Choosing golang version ## Choosing golang version
This repo is hardcoded to use 1.4 although this can easily be changed after cloning. If you want to use another version simply This repo is hardcoded to use 1.4 although this can easily be changed after cloning. If you want to use another version simply
change the `$version` parameter in `manifests/init.pp`. The version string is taken from the set the `$version` parameter when calling the class. The version string is taken from the
[golang downloads list](http://golang.org/dl/). Once changed you can either call `vagrant up` if you [golang downloads list](http://golang.org/dl/). Once changed you can either call `vagrant up` if you
haven't already setup the vagrant box or `vagrant provision` if the machine is already up. haven't already setup the vagrant box or `vagrant provision` if the machine is already up.

View File

@@ -1,3 +1,15 @@
class { "golang": stage { "prepare":
version => "1.4" before => Stage["main"],
}
class setup {
exec { "update-aptitude":
command => "/usr/bin/apt-get update -y",
}
}
class {
"setup":
stage => prepare;
"golang":;
} }

View File

@@ -26,4 +26,16 @@ class golang ( $version = "1.4" ) {
unless => "/bin/grep -q GOPATH /home/vagrant/.profile ; /usr/bin/test $? -eq 0" unless => "/bin/grep -q GOPATH /home/vagrant/.profile ; /usr/bin/test $? -eq 0"
} }
if ! defined(Package["git"]) {
package { "git":
ensure => present,
}
}
if ! defined(Package["mercurial"]) {
package { "mercurial":
ensure => present,
}
}
} }