Search code examples
rubyrubygemsbundler

Single file from gem missing after bundle install, included when using gem install


I run into a weird issue I currently cant' explain: I'm building a gem and push it to a private gem repository. When installing the gem from said repository with gem install my-gem everything works as expected. However when I include this gem in a Gemfile and run bundle install, the gem installs, BUT one file is missing, and I'm a bit at loss as to what I'm missing to see.

Structure of the gem:

my-gem
├── my-gem.gemspec
├── lib
│   ├── my-gem.rb   <== this one is simply missing after bundle install
│   ├── my-gem
│   │   ├── stuff_for_my_gem
        ├──  ...

Solution

  • So the root cause of the issue was the existence of the vendor/cache from bundler, which included a version of the gem with some faulty namings. As the gem version was not bumped while troubleshooting the issue, bundler always used the cached version.

    Even though the gem was uninstalled from the system completely, it was still available in the local vendor/cache. Upon bundle install in that folder, bundler realized it had that gem available and used it from the cache. That's also why the issue didn't appear with gem install, since with that the vendor/cache created by bundle gets ignored.