Skip to content

Commit 50ee5dd

Browse files
fix(utilities): make utility scripts easier (#15507)
* docs: add link through to utilities README into CONTRIBUTING guide * fix(utilities): exit early if event data directory already exists * fix(utilities): exit early if event content directory already exists
1 parent d29908e commit 50ee5dd

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ If you'd like to edit a specific devopsdays event site (and/or contribute code),
1313
1. Have the ability to run Hugo. This can be done locally or through
1414
Docker.
1515
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repo and clone a copy locally.
16+
1. Check out the available [utility scripts](./utilities/README.md) to help organize your event.
1617

1718
#### Run Hugo with Docker (Recommended)
1819

utilities/add_new_event.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ twitter=$(echo $twitter | sed 's/@//')
3636
# We use the term event_slug in the hugo files too
3737
event_slug=$year-$city_slug
3838

39+
# Check if the event directory already exists
40+
if [ -d "../content/events/$event_slug" ]; then
41+
echo "The event content directory already exists:"
42+
echo "./content/events/$event_slug"
43+
exit 1
44+
fi
45+
3946
# Update the redirection for a previous year of this event to the desired year
4047
if grep -q "^/$city_slug" "../static/_redirects";
4148
then
@@ -46,6 +53,13 @@ else
4653
echo "/$city_slug/* /events/$event_slug/:splat 302" >> "../static/_redirects"
4754
fi
4855

56+
# Check if the event directory already exists
57+
if [ -d "../data/events/$year/$city_slug" ]; then
58+
echo "The event data directory already exists:"
59+
echo "./data/events/$year/$city_slug"
60+
exit 1
61+
fi
62+
4963
# Create data directory for the event
5064
mkdir -p ../data/events/$year/$city_slug
5165
# Create default event datafile

0 commit comments

Comments
 (0)