diff --git a/README.md b/README.md index 9cfc02b..ea23d99 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ hello ## 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 -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 haven't already setup the vagrant box or `vagrant provision` if the machine is already up. diff --git a/manifests/init.pp b/manifests/init.pp index 76e43dc..fa85048 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,3 +1,15 @@ -class { "golang": - version => "1.4" +stage { "prepare": + before => Stage["main"], +} + +class setup { + exec { "update-aptitude": + command => "/usr/bin/apt-get update -y", + } +} + +class { + "setup": + stage => prepare; + "golang":; } diff --git a/modules/golang/manifests/init.pp b/modules/golang/manifests/init.pp index cec9e6d..2472ad2 100644 --- a/modules/golang/manifests/init.pp +++ b/modules/golang/manifests/init.pp @@ -26,4 +26,16 @@ class golang ( $version = "1.4" ) { 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, + } + } + }