8f2e53c33e70ee35fda33419a7225d84c307bfc4

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge pull request #2107 from maxd/master

Check bundler version to avoid error with unsupported command line arguments

Diff

 1diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
 2index 5bd28cbdc83c0db2c9fdfbc740485e24aae20044..2e657e5a820b83463b4af463d76f035b6404c58f 100644
 3--- a/plugins/bundler/bundler.plugin.zsh
 4+++ b/plugins/bundler/bundler.plugin.zsh
 5@@ -4,13 +4,18 @@ alias bp="bundle package"
 6 alias bo="bundle open"
 7 alias bu="bundle update"
 8 
 9-if [[ "$(uname)" == 'Darwin' ]]
10-then
11-  local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
12+bundler_version=`bundle version | cut -d' ' -f3`
13+if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
14+  if [[ "$(uname)" == 'Darwin' ]]
15+  then
16+    local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
17+  else
18+    local cores_num="$(nproc)"
19+  fi
20+  eval "alias bi='bundle install --jobs=$cores_num'"
21 else
22-  local cores_num="$(nproc)"
23+  alias bi='bundle install' 
24 fi
25-eval "alias bi='bundle install --jobs=$cores_num'"
26 
27 # The following is based on https://github.com/gma/bundler-exec
28