summaryrefslogtreecommitdiff
path: root/plugins/bundler
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/bundler')
-rw-r--r--plugins/bundler/README.md9
-rw-r--r--plugins/bundler/bundler.plugin.zsh20
2 files changed, 19 insertions, 10 deletions
diff --git a/plugins/bundler/README.md b/plugins/bundler/README.md
index 56f0c7176..9f211b02f 100644
--- a/plugins/bundler/README.md
+++ b/plugins/bundler/README.md
@@ -2,17 +2,20 @@
- adds completion for basic bundler commands
- adds short aliases for common bundler commands
- - `be` aliased to `bundle exec`
+ - `be` aliased to `bundle exec`.
+ It also supports aliases (if `rs` is `rails server`, `be rs` will bundle-exec `rails server`).
- `bl` aliased to `bundle list`
- `bp` aliased to `bundle package`
- `bo` aliased to `bundle open`
+ - `bout` aliased to `bundle outdated`
- `bu` aliased to `bundle update`
- `bi` aliased to `bundle install --jobs=<cpu core count>` (only for bundler `>= 1.4.0`)
- adds a wrapper for common gems:
- looks for a binstub under `./bin/` and executes it (if present)
- calls `bundle exec <gem executable>` otherwise
-For a full list of *common gems* being wrapped by default please look at the `bundler.plugin.zsh` file.
+Common gems wrapped by default (by name of the executable):
+`annotate`, `cap`, `capify`, `cucumber`, `foodcritic`, `guard`, `hanami`, `irb`, `jekyll`, `kitchen`, `knife`, `middleman`, `nanoc`, `pry`, `puma`, `rackup`, `rainbows`, `rake`, `rspec`, `rubocop`, `shotgun`, `sidekiq`, `spec`, `spork`, `spring`, `strainer`, `tailor`, `taps`, `thin`, `thor`, `unicorn` and `unicorn_rails`.
## Configuration
@@ -39,7 +42,7 @@ This will exclude the `foreman` and `spin` gems (i.e. their executable) from bei
## Excluded gems
-These gems should not be called with `bundle exec`. Please see the Issues on GitHub for clarification.
+These gems should not be called with `bundle exec`. Please see [issue #2923](https://github.com/ohmyzsh/ohmyzsh/pull/2923) on GitHub for clarification.
`berks`
`foreman`
diff --git a/plugins/bundler/bundler.plugin.zsh b/plugins/bundler/bundler.plugin.zsh
index ba3d3f623..665cb5e43 100644
--- a/plugins/bundler/bundler.plugin.zsh
+++ b/plugins/bundler/bundler.plugin.zsh
@@ -2,8 +2,10 @@ alias be="bundle exec"
alias bl="bundle list"
alias bp="bundle package"
alias bo="bundle open"
+alias bout="bundle outdated"
alias bu="bundle update"
alias bi="bundle_install"
+alias bcn="bundle clean"
bundled_commands=(
annotate
@@ -12,6 +14,7 @@ bundled_commands=(
cucumber
foodcritic
guard
+ hanami
irb
jekyll
kitchen
@@ -24,6 +27,7 @@ bundled_commands=(
rainbows
rake
rspec
+ rubocop
shotgun
sidekiq
spec
@@ -51,12 +55,16 @@ done
## Functions
bundle_install() {
- if _bundler-installed && _within-bundled-project; then
+ if ! _bundler-installed; then
+ echo "Bundler is not installed"
+ elif ! _within-bundled-project; then
+ echo "Can't 'bundle install' outside a bundled project"
+ else
local bundler_version=`bundle version | cut -d' ' -f3`
if [[ $bundler_version > '1.4.0' || $bundler_version = '1.4.0' ]]; then
- if [[ "$OSTYPE" = darwin* ]]
+ if [[ "$OSTYPE" = (darwin|freebsd)* ]]
then
- local cores_num="$(sysctl hw.ncpu | awk '{print $2}')"
+ local cores_num="$(sysctl -n hw.ncpu)"
else
local cores_num="$(nproc)"
fi
@@ -64,8 +72,6 @@ bundle_install() {
else
bundle install $@
fi
- else
- echo "Can't 'bundle install' outside a bundled project"
fi
}
@@ -76,7 +82,7 @@ _bundler-installed() {
_within-bundled-project() {
local check_dir="$PWD"
while [ "$check_dir" != "/" ]; do
- [ -f "$check_dir/Gemfile" ] && return
+ [ -f "$check_dir/Gemfile" -o -f "$check_dir/gems.rb" ] && return
check_dir="$(dirname $check_dir)"
done
false
@@ -89,7 +95,7 @@ _binstubbed() {
_run-with-bundler() {
if _bundler-installed && _within-bundled-project; then
if _binstubbed $1; then
- ./bin/$@
+ ./bin/${^^@}
else
bundle exec $@
fi