Skip to content
This repository has been archived by the owner on May 22, 2018. It is now read-only.

Commit

Permalink
Merge pull request #72 from boxen/priority-env.d
Browse files Browse the repository at this point in the history
Add boxen::env_script defined type
  • Loading branch information
wfarr committed Oct 28, 2013
2 parents 6d4ad5d + bebb51d commit d0da385
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
8 changes: 2 additions & 6 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,8 @@
mode => '0755',
}

file { "${envdir}/config.sh":
content => template('boxen/config.sh.erb')
}

file { "${envdir}/gh_creds.sh":
content => template('boxen/gh_creds.sh.erb')
file { ["${envdir}/config.sh", "${envdir}/gh_creds.sh"]:
ensure => absent,
}

group { 'puppet':
Expand Down
31 changes: 31 additions & 0 deletions manifests/env_script.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
define boxen::env_script(
$ensure = 'present',
$scriptname = $name,
$priority = 'normal',
$source = undef,
$content = undef,
) {

if $source == undef and $content == undef {
fail("One of source or content must not be undef!")
}

$real_priority = $priority ? {
'highest' => '10',
'higher' => '30',
'high' => '40',
'normal' => '50',
'low' => '60',
'lower' => '70',
'lowest' => '90',
}

include boxen::config

file { "${boxen::config::envdir}/${real_priority}_${scriptname}.sh":
ensure => $ensure,
source => $source,
content => $content,
}

}
11 changes: 10 additions & 1 deletion manifests/environment.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,13 @@
include boxen::sudoers

include_projects_from_boxen_cli()
}

boxen::env_script {
'config':
content => template('boxen/config.sh.erb'),
priority => 'highest' ;
'gh_creds':
content => template('boxen/gh_creds.sh.erb'),
priority => 'higher' ;
}
}

0 comments on commit d0da385

Please sign in to comment.