This repository has been archived by the owner on Sep 9, 2019. It is now read-only.
forked from bitrise-steplib/steps-cocoapods-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_pod_install.sh
executable file
·83 lines (72 loc) · 2.33 KB
/
run_pod_install.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
THIS_SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${THIS_SCRIPTDIR}/_bash_utils/utils.sh"
source "${THIS_SCRIPTDIR}/_bash_utils/formatted_output.sh"
function pod_install {
if [ $1 ]; then
bundle exec pod --no-repo-update install
else
pod --no-repo-update install
fi
if [ $? -ne 0 ]; then
echo
echo "Install failed - spec are likely out of date."
echo
echo "Retrying install with repo update"
echo
if [ $1 ]; then
bundle exec pod install
else
pod install
fi
fi
if [ $? -ne 0 ]; then
echo "WARNING: Pod quick install failed! Consider moving back to Bitrise standard cocoapods installer"
exit 1
fi
}
CONFIG_cocoapods_ssh_source_fix_script_path="${THIS_SCRIPTDIR}/cocoapods_ssh_source_fix.rb"
write_section_to_formatted_output "### Searching for podfiles and installing the found ones"
podcount=0
IFS=$'\n'
for podfile in $(find . -type f -iname 'Podfile' -not -path "*.git/*")
do
podcount=$[podcount + 1]
echo " (i) Podfile found at: ${podfile}"
curr_podfile_dir=$(dirname "${podfile}")
curr_podfile_basename=$(basename "${podfile}")
echo " (i) Podfile directory: ${curr_podfile_dir}"
(
echo
echo " ===> Pod install: ${podfile}"
cd "${curr_podfile_dir}"
fail_if_cmd_error "Failed to cd into dir: ${curr_podfile_dir}"
ruby "${CONFIG_cocoapods_ssh_source_fix_script_path}" --podfile="${curr_podfile_basename}"
fail_if_cmd_error "Failed to fix Podfile: ${curr_podfile_basename}"
if [ -f './Gemfile' ] ; then
echo
echo "==> Found 'Gemfile' - using it..."
bundle install
fail_if_cmd_error "Failed to bundle install"
echo
echo "==> Gemfile specified CocoaPods version:"
bundle exec pod --version
fail_if_cmd_error "Failed to get pod version"
pod_install true
fail_if_cmd_error "Failed to pod install"
else
echo "==> System Installed CocoaPods version:"
pod --version
fail_if_cmd_error "Failed to get pod version"
pod_install false
fail_if_cmd_error "Failed to pod install"
fi
)
if [ $? -ne 0 ] ; then
write_section_to_formatted_output "Could not install podfile: ${podfile}"
exit 1
fi
echo_string_to_formatted_output "* Installed podfile: ${podfile}"
done
unset IFS
write_section_to_formatted_output "**${podcount} podfile(s) found and installed**"