Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Bundler.require not loading .gemspec dependencies #2018

@jch

Description

@jch

I'm not sure if this is intentional behavior, but from this documentation, I expected that Bundler.require :default would also require the runtime dependencies specified in .gemspec. I've created a demo gem showing this.

# gemspec
Gem::Specification.new do |gem|
  # snip
  gem.add_dependency 'rack'
end
# Gemfile
source 'https://rubygems.org'

# Specify your gem's dependencies in bundler-issue.gemspec
gemspec
# test.rb
require 'bundler'
Bundler.require :default  # <-- I expected this to load dependencies in from the gemspec

puts "Dependency loaded: " + defined?(Rack).inspect

If I explicitly require rack, it works as expected, and Gemfile.lock lists rack as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions