File tree Expand file tree Collapse file tree 4 files changed +27
-11
lines changed
Expand file tree Collapse file tree 4 files changed +27
-11
lines changed Original file line number Diff line number Diff line change 88fi
99HOMEBREW_PREFIX=" $( cd " $( dirname " ${SCRIPT_PATH} " ) " /../ && pwd) "
1010
11- " ${HOMEBREW_PREFIX} /bin/brew " install-bundler-gems --add-groups=style,typecheck,vscode > /dev/null 2>&1
12-
13- export PATH =" ${HOMEBREW_PREFIX} /Library/Homebrew/vendor/portable-ruby/current/bin: ${PATH} "
11+ # These are used by the functions needed from utils/ruby.sh
12+ export HOMEBREW_BREW_FILE= " ${HOMEBREW_PREFIX} /bin/brew "
13+ export HOMEBREW_LIBRARY =" ${HOMEBREW_PREFIX} /Library"
1414export BUNDLE_WITH=" style:typecheck:vscode"
15+
16+ # shellcheck disable=SC1091
17+ source " ${HOMEBREW_PREFIX} /Library/Homebrew/utils/ruby.sh"
18+
19+ setup-ruby-path
20+ setup-gem-home-bundle-gemfile
21+ ensure-bundle-dependencies
Original file line number Diff line number Diff line change @@ -34,8 +34,5 @@ homebrew-setup-ruby() {
3434
3535 setup-gem-home-bundle-gemfile
3636
37- if ! bundle check & > /dev/null
38- then
39- " ${HOMEBREW_BREW_FILE} " install-bundler-gems
40- fi
37+ ensure-bundle-dependencies
4138}
Original file line number Diff line number Diff line change @@ -12,10 +12,7 @@ homebrew-rubocop() {
1212 BUNDLE_WITH=" style"
1313 export BUNDLE_WITH
1414
15- if ! bundle check & > /dev/null
16- then
17- " ${HOMEBREW_BREW_FILE} " install-bundler-gems --add-groups=" ${BUNDLE_WITH} "
18- fi
15+ ensure-bundle-dependencies
1916
2017 export PATH=" ${GEM_HOME} /bin:${PATH} "
2118
Original file line number Diff line number Diff line change @@ -187,3 +187,18 @@ setup-gem-home-bundle-gemfile() {
187187 export GEM_HOME
188188 export BUNDLE_GEMFILE
189189}
190+
191+ ensure-bundle-dependencies () {
192+ local install_args=()
193+
194+ if ! bundle check & > /dev/null
195+ then
196+ if [[ -n " ${BUNDLE_WITH} " ]]
197+ then
198+ # Convert colon-separated BUNDLE_WITH to comma-separated for --add-groups
199+ local groups_for_flag=" ${BUNDLE_WITH//:/ ,} "
200+ install_args+=(" --add-groups=${groups_for_flag} " )
201+ fi
202+ " ${HOMEBREW_BREW_FILE} " install-bundler-gems " ${install_args[@]} "
203+ fi
204+ }
You can’t perform that action at this time.
0 commit comments