- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.8k
          Fix some invalid options to gem DSL not getting reported as invalid
          #8480
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            deivid-rodriguez
  merged 2 commits into
  master
from
deivid-rodriguez/fix-type-and-gemfile-option-validation
  
      
      
   
  Feb 12, 2025 
      
    
                
     Merged
            
            
  
    Fix some invalid options to gem DSL not getting reported as invalid
  
  #8480
              
                    deivid-rodriguez
  merged 2 commits into
  master
from
deivid-rodriguez/fix-type-and-gemfile-option-validation
  
      
      
   
  Feb 12, 2025 
              
            
      
        
          +111
        
        
          −86
        
        
          
        
      
    
  
Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    d16e1af    to
    aaa40f5      
    Compare
  
    This feature is not really deprecated, it's removed.
aaa40f5    to
    5b6077a      
    Compare
  
    
    
  deivid-rodriguez 
      added a commit
      that referenced
      this pull request
    
      Feb 17, 2025 
    
    
      
  
    
      
    
  
…gemfile-option-validation Fix some invalid options to `gem` DSL not getting reported as invalid (cherry picked from commit 95f58b9)
    
  ccutrer 
      added a commit
        to ccutrer/rubygems
      that referenced
      this pull request
    
      Apr 9, 2025 
    
    
      
  
    
      
    
  
Since ruby#8480, we can't use the undocumented "type" option, but the add_dependency helper was added that lets us easily validate first, then add our custom options, then directly add the now custom dependency. This conveniently simplifies the Plugin version of the DSL, because `plugin` no longer flows through `gem`, so it doesn't need to special case it.
    
  myronmarston 
      pushed a commit
        to block/elasticgraph
      that referenced
      this pull request
    
      Jul 8, 2025 
    
    
      
  
    
      
    
  
The new version of bundler includes some internal refactorings that broke our monorepo setup. To stay compatible, I've had to rework our `gem` override to instead override `add_dependency`. I believe this is the root of the problem I reported to dependabot: dependabot/dependabot-core#12426 The latest dependabot uses Bundler 2.6.9, and this was causing the issues reported in that ticket since our `gem` override was no longer effective. The specific bundler change prompting this is this PR: ruby/rubygems#8480 In that PR, the `gemspec` method was refactored to no longer call `gem`. Instead, it calls a new `add_dependency` method.
    
  myronmarston 
      pushed a commit
        to block/elasticgraph
      that referenced
      this pull request
    
      Jul 8, 2025 
    
    
      
  
    
      
    
  
Dependabot is currently broken for ElasticGraph: dependabot/dependabot-core#12426 Troubleshooting points to a root cause of Bundler 2.6.9 (used by the latest dependabot) having some subtle changes to how gemspecs are handled. Specifically, this PR: ruby/rubygems#8480 In that PR, the `gemspec` method was refactored to no longer call `gem`. Previously, our `Gemfile` set up depended on this. However, it was quite complicated in order to support the root `Gemfile` getting symlinkd into each gem subdirectory. I've simplified things here: - `Gemfile-shared` now contains all dependencies that are not declared in the gemspecs. - `Gemfile` is now greatly simplified--it just evals `Gemfile-shared` and delcares a dependency on each ElasticGraph gem. - `config/Gemfile-for-gem` contains a more complex gemfile, which gets symlinked into each ElasticGraph gem. This new simpler setup should fix the issues we're having with dependabot.
    
  myronmarston 
      pushed a commit
        to block/elasticgraph
      that referenced
      this pull request
    
      Jul 8, 2025 
    
    
      
  
    
      
    
  
Dependabot is currently broken for ElasticGraph: dependabot/dependabot-core#12426 Troubleshooting points to a root cause of Bundler 2.6.9 (used by the latest dependabot) having some subtle changes to how gemspecs are handled. Specifically, this PR: ruby/rubygems#8480 In that PR, the `gemspec` method was refactored to no longer call `gem`. Previously, our `Gemfile` set up depended on this. However, it was quite complicated in order to support the root `Gemfile` getting symlinkd into each gem subdirectory. I've simplified things here: - `Gemfile-shared` now contains all dependencies that are not declared in the gemspecs. - `Gemfile` is now greatly simplified--it just evals `Gemfile-shared` and delcares a dependency on each ElasticGraph gem. - `config/Gemfile-for-gem` contains a more complex gemfile, which gets symlinked into each ElasticGraph gem. - I've removed the last few gemspec developemnt dependencies for non-ElasticGraph gems--we handle this through the development dependencies in `Gemfile-shared` instead. (`rack-test` was missing from the `Gemfile` before!) This new simpler setup should fix the issues we're having with dependabot.
    
  myronmarston 
      pushed a commit
        to block/elasticgraph
      that referenced
      this pull request
    
      Jul 8, 2025 
    
    
      
  
    
      
    
  
Dependabot is currently broken for ElasticGraph: dependabot/dependabot-core#12426 Troubleshooting points to a root cause of Bundler 2.6.9 (used by the latest dependabot) having some subtle changes to how gemspecs are handled. Specifically, this PR: ruby/rubygems#8480 In that PR, the `gemspec` method was refactored to no longer call `gem`. Previously, our `Gemfile` set up depended on this. However, it was quite complicated in order to support the root `Gemfile` getting symlinkd into each gem subdirectory. I've simplified things here: - `Gemfile-shared` now contains all dependencies that are not declared in the gemspecs. - `Gemfile` is now greatly simplified--it just evals `Gemfile-shared` and declares a dependency on each ElasticGraph gem. - `config/Gemfile-for-gem` contains a more complex gemfile, which gets symlinked into each ElasticGraph gem. - I've removed the last few gemspec developemnt dependencies for non-ElasticGraph gems--we handle this through the development dependencies in `Gemfile-shared` instead. (`rack-test` was missing from the `Gemfile` before!) This new simpler setup should fix the issues we're having with dependabot.
    
  myronmarston 
      pushed a commit
        to block/elasticgraph
      that referenced
      this pull request
    
      Jul 8, 2025 
    
    
      
  
    
      
    
  
Dependabot is currently broken for ElasticGraph: dependabot/dependabot-core#12426 Troubleshooting points to a root cause of Bundler 2.6.9 (used by the latest dependabot) having some subtle changes to how gemspecs are handled. Specifically, this PR: ruby/rubygems#8480 In that PR, the `gemspec` method was refactored to no longer call `gem`. Previously, our `Gemfile` set up depended on this. However, it was quite complicated in order to support the root `Gemfile` getting symlinkd into each gem subdirectory. I've simplified things here: - `Gemfile-shared` now contains all dependencies that are not declared in the gemspecs. - `Gemfile` is now greatly simplified--it just evals `Gemfile-shared` and declares a dependency on each ElasticGraph gem. - `config/Gemfile-for-gem` contains a more complex gemfile, which gets symlinked into each ElasticGraph gem. - I've removed the last few gemspec developemnt dependencies for non-ElasticGraph gems--we handle this through the development dependencies in `Gemfile-shared` instead. (`rack-test` was missing from the `Gemfile` before!) This new simpler setup should fix the issues we're having with dependabot.
    
  myronmarston 
      pushed a commit
        to block/elasticgraph
      that referenced
      this pull request
    
      Jul 8, 2025 
    
    
      
  
    
      
    
  
Dependabot is currently broken for ElasticGraph: dependabot/dependabot-core#12426 Troubleshooting points to a root cause of Bundler 2.6.9 (used by the latest dependabot) having some subtle changes to how gemspecs are handled. Specifically, this PR: ruby/rubygems#8480 In that PR, the `gemspec` method was refactored to no longer call `gem`. Previously, our `Gemfile` set up depended on this. However, it was quite complicated in order to support the root `Gemfile` getting symlinkd into each gem subdirectory. I've simplified things here: - `Gemfile-shared` now contains all dependencies that are not declared in the gemspecs. - `Gemfile` is now greatly simplified--it just evals `Gemfile-shared` and declares a dependency on each ElasticGraph gem. - `config/Gemfile-for-gem` contains a more complex gemfile, which gets symlinked into each ElasticGraph gem. - I've removed the last few unnecesary gemspec developemnt dependencies for non-ElasticGraph gems--we handle this through the development dependencies in `Gemfile-shared` instead. (`rack-test` was missing from the `Gemfile` before!) This new simpler setup should fix the issues we're having with dependabot.
    
  myronmarston 
      pushed a commit
        to block/elasticgraph
      that referenced
      this pull request
    
      Jul 8, 2025 
    
    
      
  
    
      
    
  
Dependabot is currently broken for ElasticGraph: dependabot/dependabot-core#12426 Troubleshooting points to a root cause of Bundler 2.6.9 (used by the latest dependabot) having some subtle changes to how gemspecs are handled. Specifically, this PR: ruby/rubygems#8480 In that PR, the `gemspec` method was refactored to no longer call `gem`. Previously, our `Gemfile` set up depended on this. However, it was quite complicated in order to support the root `Gemfile` getting symlinkd into each gem subdirectory. I've simplified things here: - `Gemfile-shared` now contains all dependencies that are not declared in the gemspecs. - `Gemfile` is now greatly simplified--it just evals `Gemfile-shared` and declares a dependency on each ElasticGraph gem. - `config/Gemfile-for-gem` contains a more complex gemfile, which gets symlinked into each ElasticGraph gem. - I've removed the last few unnecesary gemspec developemnt dependencies for non-ElasticGraph gems--we handle this through the development dependencies in `Gemfile-shared` instead. (`rack-test` was missing from the `Gemfile` before!) This new simpler setup should fix the issues we're having with dependabot.
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
What was the end-user or developer problem that led to this PR?
I found this while working on something else.
typeandgemfileare internally handled as valid options for thegemDSL, but it was only due to an implementation detail, they are not should not be exposed to end users.What is your fix for the problem, implemented in this PR?
My fix is to refactor the way we handle the
gemspecDSL to skip option validation (since we're passing known options. That way, we can stop consideringgemfileandtypeas valid and give better errors if they are ever used for whatever reason.Make sure the following tasks are checked