Rbenv 没有为本地 gem 创建 shim

Rbenv is not creating shim for local gem

我已经通过 bundler

创建了 gem
bundle gem mygem
  Creating gem 'mygem'...
  ...

rake build
  mygem 0.1.0 built to pkg/mygem-0.1.0.gem.

rake install:local
  mygem 0.1.0 built to pkg/mygem-0.1.0.gem.
  mygem (0.1.0) installed.

gem list mygem
  *** LOCAL GEMS ***
  mygem (0.1.0)

gem which mygem
  /Users/megas/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0/gems/mygem-0.1.0/lib/mygem.rb

rbenv rehash

which mygem
  mygem not found

rbenv shims | grep mygem #=> empty

如您所见,mygem 已安装,但 rbenv 没有为其创建 shim。

我在这里错过了什么?

gem env                                                                                                                                                    RubyGems Environment:
  - RUBYGEMS VERSION: 2.7.4
  - RUBY VERSION: 2.5.0 (2017-12-25 patchlevel 0) [x86_64-darwin17]
  - INSTALLATION DIRECTORY: /Users/megas/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
  - USER INSTALLATION DIRECTORY: /Users/megas/.gem/ruby/2.5.0
  - RUBY EXECUTABLE: /Users/megas/.rbenv/versions/2.5.0/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/megas/.rbenv/versions/2.5.0/bin
  - SPEC CACHE DIRECTORY: /Users/megas/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/megas/.rbenv/versions/2.5.0/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-17
  - GEM PATHS:
     - /Users/megas/.rbenv/versions/2.5.0/lib/ruby/gems/2.5.0
     - /Users/megas/.gem/ruby/2.5.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://rubygems.org"]
     - :benchmark => false
     - "gem" => "--no-rdoc --no-ri"
  - REMOTE SOURCES:
     - http://rubygems.org
  - SHELL PATH:
     - /Users/megas/.rbenv/versions/2.5.0/bin
     - /usr/local/Cellar/rbenv/1.1.1/libexec
     - /Users/megas/.rbenv/shims
     - /Users/megas/.cargo/bin
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /opt/X11/bin
     - /Users/megas/.yadr/bin
     - /Users/megas/.yadr/bin/yadr
     - /usr/local/opt/fzf/bin

需要使用 exe 选项创建 gem。

bundle gem mygem --exe