forked from dropbox/dropbox-sdk-obj-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_version.sh
executable file
·64 lines (52 loc) · 1.74 KB
/
update_version.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
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
#!/bin/sh
# Script for updating ObjectiveDropboxOfficial version number
echo
if [ "$#" -ne 1 ]; then
echo "Requires 1 parameter. Usage: \`./update_version <VERSION>\`"
exit 1
fi
arg_version_regex="^[0-9]+\.[0-9]+\.[0-9]+$"
version_regex="[0-9]+\.[0-9]+\.[0-9]+"
podspec=./ObjectiveDropboxOfficial.podspec
readme=./README.md
user_agent=Source/ObjectiveDropboxOfficial/Shared/Handwritten/Resources/DBSDKConstants.m
ios_version=Source/ObjectiveDropboxOfficial/Platform/ObjectiveDropboxOfficial_iOS/Info.plist
mac_version=Source/ObjectiveDropboxOfficial/Platform/ObjectiveDropboxOfficial_macOS/Info.plist
if ! [[ $1 =~ $arg_version_regex ]]; then
echo "\"$1\" version string must have format x.x.x"
exit 1
else
echo "Updating SDK text to version \"$1\""
fi
echo
echo
echo "Replacing podspec version number..."
sed -i '' -E "s/s.version = '$version_regex'/s.version = '$1'/" $podspec
echo '--------------------'
cat $podspec | grep $1
echo '--------------------'
echo
echo "Replacing README version number..."
sed -i '' -E "s/~> $version_regex/~> $1/" $readme
echo '--------------------'
cat $readme | grep $1
echo '--------------------'
echo
echo "Replacing User Agent version number..."
sed -i '' -E "s/kV2SDKVersion = @\"$version_regex\";/kV2SDKVersion = @\"$1\";/" $user_agent
echo '--------------------'
cat $user_agent | grep $1
echo '--------------------'
echo
echo "Replacing iOS xcodeproj version number..."
sed -i '' -E "s/$version_regex/$1/" $ios_version
echo '--------------------'
cat $ios_version | grep $1
echo '--------------------'
echo
echo "Replacing macOS xcodeproj version number..."
sed -i '' -E "s/$version_regex/$1/" $mac_version
echo '--------------------'
cat $mac_version | grep $1
echo '--------------------'
echo