4daba1431696953a7737c7b64fc46cb05a736282

Author
Halil Özgür <226712+halilim@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

refactor(bundler): Remove bundle_install and just use: bundle install (#13617)

Diff

 1diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md
 2index 7b79cbcdc3a613e380edde7392a993e0296672b5..ddf5472763b9a07ee1ee2c09a0f35d2b911bac84 100644
 3--- a/plugins/bundler/README.md
 4+++ b/plugins/bundler/README.md
 5@@ -11,18 +11,18 @@ plugins=(... bundler)
 6 
 7 ## Aliases
 8 
 9-| Alias  | Command                              | Description                                                                              |
10-|--------|--------------------------------------|------------------------------------------------------------------------------------------|
11-| `ba`   | `bundle add`                         | Add gem to the Gemfile and run bundle install                                            |
12-| `bck`  | `bundle check`                       | Verifies if dependencies are satisfied by installed gems                                 |
13-| `bcn`  | `bundle clean`                       | Cleans up unused gems in your bundler directory                                          |
14-| `be`   | `bundle exec`                        | Execute a command in the context of the bundle                                           |
15-| `bi`   | `bundle install --jobs=<core_count>` | Install the dependencies specified in your Gemfile (using all cores in bundler >= 1.4.0) |
16-| `bl`   | `bundle list`                        | List all the gems in the bundle                                                          |
17-| `bo`   | `bundle open`                        | Opens the source directory for a gem in your bundle                                      |
18-| `bout` | `bundle outdated`                    | List installed gems with newer versions available                                        |
19-| `bp`   | `bundle package`                     | Package your needed .gem files into your application                                     |
20-| `bu`   | `bundle update`                      | Update your gems to the latest available versions                                        |
21+| Alias  | Command           | Description                                              |
22+| ------ | ----------------- | -------------------------------------------------------- |
23+| `ba`   | `bundle add`      | Add gem to the Gemfile and run bundle install            |
24+| `bck`  | `bundle check`    | Verifies if dependencies are satisfied by installed gems |
25+| `bcn`  | `bundle clean`    | Cleans up unused gems in your bundler directory          |
26+| `be`   | `bundle exec`     | Execute a command in the context of the bundle           |
27+| `bi`   | `bundle install`  | Install the dependencies specified in your Gemfile       |
28+| `bl`   | `bundle list`     | List all the gems in the bundle                          |
29+| `bo`   | `bundle open`     | Opens the source directory for a gem in your bundle      |
30+| `bout` | `bundle outdated` | List installed gems with newer versions available        |
31+| `bp`   | `bundle package`  | Package your needed .gem files into your application     |
32+| `bu`   | `bundle update`   | Update your gems to the latest available versions        |
33 
34 ## Gem wrapper
35 
36diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
37index c1cbb13ddeda375415015ba8c2012908fb27eb31..53b36f092d52776f97702d8f6148b37490ffb8c6 100644
38--- a/plugins/bundler/bundler.plugin.zsh
39+++ b/plugins/bundler/bundler.plugin.zsh
40@@ -4,45 +4,13 @@ alias ba="bundle add"
41 alias bck="bundle check"
42 alias bcn="bundle clean"
43 alias be="bundle exec"
44-alias bi="bundle_install"
45+alias bi="bundle install"
46 alias bl="bundle list"
47 alias bo="bundle open"
48 alias bout="bundle outdated"
49 alias bp="bundle package"
50 alias bu="bundle update"
51 
52-## Functions
53-
54-bundle_install() {
55-  # Bail out if bundler is not installed
56-  if (( ! $+commands[bundle] )); then
57-    echo "Bundler is not installed"
58-    return 1
59-  fi
60-
61-  # Bail out if not in a bundled project
62-  if ! _within-bundled-project; then
63-    echo "Can't 'bundle install' outside a bundled project"
64-    return 1
65-  fi
66-
67-  # Check the bundler version is at least 1.4.0
68-  autoload -Uz is-at-least
69-  local bundler_version=$(bundle version | cut -d' ' -f3)
70-  if ! is-at-least 1.4.0 "$bundler_version"; then
71-    bundle install "$@"
72-    return $?
73-  fi
74-
75-  # If bundler is at least 1.4.0, use all the CPU cores to bundle install
76-  if [[ "$OSTYPE" = (darwin|freebsd)* ]]; then
77-    local cores_num="$(sysctl -n hw.ncpu)"
78-  else
79-    local cores_num="$(nproc)"
80-  fi
81-  BUNDLE_JOBS="$cores_num" bundle install "$@"
82-}
83-
84 ## Gem wrapper
85 
86 bundled_commands=(