forked from LCSB-BioCore/foreman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync_templates.sh
executable file
·37 lines (30 loc) · 1.06 KB
/
sync_templates.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# Copies unattended templates from community-templates repository to
# app/views/unattended/ where they can be seeded on new installations.
#
# Not intended for use on existing installations, only for development.
# Production installations should use the foreman_templates plugin to
# update the contents of the database.
REPO=$(mktemp -d)
trap "rm -rf $REPO" EXIT
git clone -q -b $(git symbolic-ref -q HEAD --short) \
https://github.com/theforeman/community-templates $REPO/ct
# move into destination dir if run from Foreman root
[ -d app/views/unattended ] && cd app/views/unattended
rsync -r --delete \
--exclude .gitignore \
--exclude README.md \
--exclude '.*' \
--exclude test \
--exclude Rakefile \
--exclude Gemfile \
--exclude LICENSE \
--exclude 'job_templates/' \
$REPO/ct/ ./
cd -
git status -- app/views/unattended
if [ $(git status --porcelain -u -- app/views/unattended | grep -c '^\?') -gt 0 ]; then
echo
echo "Warning: new files copied, update template snapshot tests using 'RAILS_ENV=test rake snapshots:generate' "
fi