Created
December 6, 2013 00:22
-
-
Save glarizza/7816619 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| require 'uri' | |
| require 'pathname' | |
| Puppet::Type.newtype(:rcsrepo) do | |
| desc "A Puppet type to model a Version Control Repository" | |
| ensurable | |
| newparam(:path, :namevar => true) do | |
| desc "Path to our version control repository" | |
| validate do |value| | |
| path = Pathname.new(value) | |
| unless path.absolute? | |
| raise Puppet::Error, "Path must be an absolute path, not #{value}" | |
| end | |
| end | |
| end | |
| newparam(:source) do | |
| desc "The source URL for the repository" | |
| validate do |value| | |
| unless value =~ URI.regexp | |
| raise Puppet::Error, "Value must be a valid URI, not #{value}" | |
| end | |
| end | |
| end | |
| newproperty(:revision) do | |
| desc "The revision of the repository" | |
| defaultto "HEAD" | |
| newvalues(/^\S+$/) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment