forked from kickstarter/android-oss
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·73 lines (57 loc) · 2.62 KB
/
bootstrap
File metadata and controls
executable file
·73 lines (57 loc) · 2.62 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env sh
function say {
str=$1
ruby -e "print \"\033[0;32m$1\033[0m\n\""
}
function loudspeaker {
str=$1
ruby -e "print \"\n\033[0;31m📢 📢 📢 $1\033[0m\n\n\""
}
say "Starting bootstrap\n"
git submodule update --init --recursive
ANDROID_STUDIO_PREFERENCES_PATH=`find ${HOME}/Library/Preferences -name 'AndroidStudio*' -depth 1 | sort -r | head -1`
if [ ! -d $ANDROID_STUDIO_PREFERENCES_PATH ]; then
say "Android Studio expected in ${HOME}/Library/Preferences"
exit 1
fi
# Signing config
test -e app/signing.gradle || cp app/signing.gradle.example app/signing.gradle
say "Running bundle install\n"
bundle install
say "Bootstrapping configs\n"
script/bootstrap_configs
# Update Kickstarter style
mkdir -p "${ANDROID_STUDIO_PREFERENCES_PATH}/codestyles"
ANDROID_STYLE_PATH="${ANDROID_STUDIO_PREFERENCES_PATH}/codestyles/Kickstarter.xml"
REPOSITORY_STYLE_PATH="script/style/Kickstarter.xml"
cmp -s "${ANDROID_STYLE_PATH}" "${REPOSITORY_STYLE_PATH}"
if [ $? -ne 0 ]; then
if [ ! -f $ANDROID_STYLE_PATH ]; then
loudspeaker "You need to switch to the Kickstarter code style in Android Studio. Update this setting in Preferences > Code Style. If Android Studio is currently open you may need to restart first to see the code style."
else
say "Updated Kickstarter code style, restart Android Studio to apply changes\n"
fi
cp $REPOSITORY_STYLE_PATH $ANDROID_STYLE_PATH
fi
# Remove author from new files
FILE_HEADER_PATH="${ANDROID_STUDIO_PREFERENCES_PATH}/fileTemplates/includes/File Header.java"
if [ -f "$FILE_HEADER_PATH" ]; then
cat /dev/null > $FILE_HEADER_PATH
fi
# Install/update pidcat. Can also install pidcat via brew, but it's way out of date
curl -s "https://raw.githubusercontent.com/JakeWharton/pidcat/a6815e906a066b7b6e3ef93b989da52790174640/pidcat.py" > /tmp/pidcat
chmod +x /tmp/pidcat
cmp -s /tmp/pidcat /usr/local/bin/pidcat
if [ $? -ne 0 ]; then
say "Updating pidcat\n"
mv /tmp/pidcat /usr/local/bin/pidcat
fi
if [ ! -e "app/kickstarter.keystore" ]; then
say "File \`app/kickstarter.keystore\` does not exist, this will prevent you from creating release builds."
say "To fix this, download the keystore from \`s3://android-ksr-keystores/kickstarter.keystore\` to \`app/kickstarter.keystore\`.\n"
fi
if [ ! -e "app/signing.gradle" ]; then
say "File \`app/signing.gradle\` does not exist, this will prevent you from creating release builds."
say "To fix this, copy the example keystore from \`app/signing.gradle.example\` to \`app/signing.gradle\` then fill out the file with the correct credentials. These can be found in passpack under the entry Android - Keystore.\n"
fi
say "Bootstrap complete!"