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 #144 from boxen/add-dotfile-support
Browse files Browse the repository at this point in the history
Add support for dotfiles to `boxen::personal`
  • Loading branch information
jacobbednarz authored Aug 8, 2017
2 parents dceb533 + 5dff14e commit f7ea9b2
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
41 changes: 41 additions & 0 deletions manifests/dotfiles.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Private: Manage dotfiles.
#
# Usage:
#
# boxen:dotfiles { 'dotfiles':
# repository => 'https://github.com/user/dotfiles',
# local_directory => '.dotfiles',
# install_command => 'install.sh'
# }
#
# Parameters:
#
# repository - Git repository URL.
# local_directory - Local location of where you would like to clone
# and manage the repository.
# install_command - Script or inline command that you use to setup
# your repository.
define boxen::dotfiles(
$repository = undef,
$local_directory = 'dotfiles',
$install_command = undef,
) {
require boxen::config

$home = "/Users/${::boxen_user}"
$dotfiles_dir = "${boxen::config::srcdir}/${local_directory}"

repository { $dotfiles_dir:
source => $repository,
}

if $install_command {
exec { 'install dotfiles':
cwd => $dotfiles_dir,
command => $install_command,
provider => shell,
creates => $dotfiles_dir,
require => Repository[$dotfiles_dir]
}
}
}
5 changes: 5 additions & 0 deletions manifests/personal.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
$osx_apps = undef,
$homebrew_packages = [],
$custom_projects = {},
$dotfiles = {},
){
include boxen::config

Expand Down Expand Up @@ -107,4 +108,8 @@
default => $custom_projects
}
create_resources(boxen::project, $_custom_projects)

if !empty($dotfiles) {
ensure_resource('boxen::dotfiles', 'dotfiles', $dotfiles)
}
}

0 comments on commit f7ea9b2

Please sign in to comment.