-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupdate
More file actions
executable file
·51 lines (48 loc) · 1.85 KB
/
update
File metadata and controls
executable file
·51 lines (48 loc) · 1.85 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" || exit 1
cd ..
# Update ElementsOfProgramming-Pretty
# Copy files to Sources direcotry
rm -rf ElementsOfProgramming-Pretty/Chapter*.swift
cp -R ElementsOfProgramming/Chapter*.swift ElementsOfProgramming-Pretty/
# Remove conditional compilation blocks and playground examples
sed -i '' '/#if/,/#endif/d' ElementsOfProgramming-Pretty/*.swift
#Update playgrounds
declare -a chapters=("01" "02" "03" "04" "05" "06" "07" "08" "09" "10")
for i in "${chapters[@]}"
do
# Copy files to Sources direcotry
rm -rf "Playgrounds/Chapter$i.playground/Sources/"*
cp -R EOP/*.swift "Playgrounds/Chapter$i.playground/Sources/"
cp -R EOP/Types/*.swift "Playgrounds/Chapter$i.playground/Sources/"
# Copy Chapter contents
rm -f "Playgrounds/Chapter$i.playground/Contents.swift"
cp "ElementsOfProgramming/Chapter$i.swift" "Playgrounds/Chapter$i.playground/Contents.swift"
sed -i '' '/import EOP/d' "Playgrounds/Chapter$i.playground/Contents.swift"
done
# Chapter 6 dependencies
declare -a chapters=("04" "05")
for i in "${chapters[@]}"
do
cp -R "ElementsOfProgramming/Chapter$i.swift" Playgrounds/Chapter06.playground/Sources/
done
# Chapter 7 dependencies
declare -a chapters=("01" "04" "05" "06")
for i in "${chapters[@]}"
do
cp -R "ElementsOfProgramming/Chapter$i.swift" Playgrounds/Chapter07.playground/Sources/
done
# Chapter 9 dependencies
declare -a chapters=("08")
for i in "${chapters[@]}"
do
cp -R "ElementsOfProgramming/Chapter$i.swift" Playgrounds/Chapter09.playground/Sources/
done
# Chapter 10 dependencies
declare -a chapters=("04" "05" "06" "08" "09")
for i in "${chapters[@]}"
do
cp -R "ElementsOfProgramming/Chapter$i.swift" Playgrounds/Chapter10.playground/Sources/
done
# Remove EOP imports
sed -i '' '/import EOP/d' Playgrounds/Chapter*.playground/Sources/Chapter*.swift