Skip to content

Instantly share code, notes, and snippets.

@hardyoyo
Created February 13, 2015 17:22
Show Gist options
  • Save hardyoyo/d60c5f8a3f525f56c702 to your computer and use it in GitHub Desktop.
Save hardyoyo/d60c5f8a3f525f56c702 to your computer and use it in GitHub Desktop.
snippet that handles cloning DSpace from GitHub the "funky" way
### BEGIN clone of DSpace from GitHub to ~/dspace-src (this is a bit of a strange way to ckeck out, we do it this
### way to support cases where src_dir already exists)
# if the src_dir folder does not yet exist, create it
file { "${src_dir}":
ensure => "directory",
owner => "${owner}",
group => "${group}",
mode => 770,
}
->
exec { "initializing ${src_dir} as a Git repository, setting origin, fetching all, checking out master and setting file ownership":
command => "git init && git remote add origin ${git_repo} && git fetch --all && git checkout master && chown -R ${owner}:${group} ${src_dir}",
creates => "${src_dir}/.git",
cwd => $src_dir, # run command from this directory
logoutput => true,
tries => 2, # try 2 times, with a ten minute timeout, GitHub is sometimes slow, if it's too slow, might as well get everything else done
timeout => 600,
require => [Package["git"], Exec["Verify SSH connection to GitHub works?"]],
}
### END clone of DSpace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment