mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-24 05:09:50 +00:00
refactor(bundler): Remove bundle_install and just use: bundle install (#13617)
This commit is contained in:
@@ -11,18 +11,18 @@ plugins=(... bundler)
|
|||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|--------|--------------------------------------|------------------------------------------------------------------------------------------|
|
| ------ | ----------------- | -------------------------------------------------------- |
|
||||||
| `ba` | `bundle add` | Add gem to the Gemfile and run bundle install |
|
| `ba` | `bundle add` | Add gem to the Gemfile and run bundle install |
|
||||||
| `bck` | `bundle check` | Verifies if dependencies are satisfied by installed gems |
|
| `bck` | `bundle check` | Verifies if dependencies are satisfied by installed gems |
|
||||||
| `bcn` | `bundle clean` | Cleans up unused gems in your bundler directory |
|
| `bcn` | `bundle clean` | Cleans up unused gems in your bundler directory |
|
||||||
| `be` | `bundle exec` | Execute a command in the context of the bundle |
|
| `be` | `bundle exec` | Execute a command in the context of the bundle |
|
||||||
| `bi` | `bundle install --jobs=<core_count>` | Install the dependencies specified in your Gemfile (using all cores in bundler >= 1.4.0) |
|
| `bi` | `bundle install` | Install the dependencies specified in your Gemfile |
|
||||||
| `bl` | `bundle list` | List all the gems in the bundle |
|
| `bl` | `bundle list` | List all the gems in the bundle |
|
||||||
| `bo` | `bundle open` | Opens the source directory for a gem in your bundle |
|
| `bo` | `bundle open` | Opens the source directory for a gem in your bundle |
|
||||||
| `bout` | `bundle outdated` | List installed gems with newer versions available |
|
| `bout` | `bundle outdated` | List installed gems with newer versions available |
|
||||||
| `bp` | `bundle package` | Package your needed .gem files into your application |
|
| `bp` | `bundle package` | Package your needed .gem files into your application |
|
||||||
| `bu` | `bundle update` | Update your gems to the latest available versions |
|
| `bu` | `bundle update` | Update your gems to the latest available versions |
|
||||||
|
|
||||||
## Gem wrapper
|
## Gem wrapper
|
||||||
|
|
||||||
|
|||||||
@@ -4,45 +4,13 @@ alias ba="bundle add"
|
|||||||
alias bck="bundle check"
|
alias bck="bundle check"
|
||||||
alias bcn="bundle clean"
|
alias bcn="bundle clean"
|
||||||
alias be="bundle exec"
|
alias be="bundle exec"
|
||||||
alias bi="bundle_install"
|
alias bi="bundle install"
|
||||||
alias bl="bundle list"
|
alias bl="bundle list"
|
||||||
alias bo="bundle open"
|
alias bo="bundle open"
|
||||||
alias bout="bundle outdated"
|
alias bout="bundle outdated"
|
||||||
alias bp="bundle package"
|
alias bp="bundle package"
|
||||||
alias bu="bundle update"
|
alias bu="bundle update"
|
||||||
|
|
||||||
## Functions
|
|
||||||
|
|
||||||
bundle_install() {
|
|
||||||
# Bail out if bundler is not installed
|
|
||||||
if (( ! $+commands[bundle] )); then
|
|
||||||
echo "Bundler is not installed"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Bail out if not in a bundled project
|
|
||||||
if ! _within-bundled-project; then
|
|
||||||
echo "Can't 'bundle install' outside a bundled project"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check the bundler version is at least 1.4.0
|
|
||||||
autoload -Uz is-at-least
|
|
||||||
local bundler_version=$(bundle version | cut -d' ' -f3)
|
|
||||||
if ! is-at-least 1.4.0 "$bundler_version"; then
|
|
||||||
bundle install "$@"
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If bundler is at least 1.4.0, use all the CPU cores to bundle install
|
|
||||||
if [[ "$OSTYPE" = (darwin|freebsd)* ]]; then
|
|
||||||
local cores_num="$(sysctl -n hw.ncpu)"
|
|
||||||
else
|
|
||||||
local cores_num="$(nproc)"
|
|
||||||
fi
|
|
||||||
BUNDLE_JOBS="$cores_num" bundle install "$@"
|
|
||||||
}
|
|
||||||
|
|
||||||
## Gem wrapper
|
## Gem wrapper
|
||||||
|
|
||||||
bundled_commands=(
|
bundled_commands=(
|
||||||
|
|||||||
Reference in New Issue
Block a user