-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #392 from github/reload-bundler-runtime
Remove more custom bundler logic and reload the bundler runtime for each app
- Loading branch information
Showing
3 changed files
with
81 additions
and
157 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
module Licensed | ||
module Bundler | ||
module DefinitionExtensions | ||
attr_accessor :force_exclude_groups | ||
|
||
# Override specs to avoid logic that would raise Gem::NotFound | ||
# which is handled in this ./missing_specification.rb, and to not add | ||
# bundler as a dependency if it's not a user-requested gem. | ||
# | ||
# Newer versions of Bundler have changed the implementation of specs_for | ||
# as well which no longer calls this function. Overriding this function | ||
# gives a stable access point for licensed | ||
def specs | ||
@specs ||= begin | ||
specs = resolve.materialize(requested_dependencies) | ||
|
||
all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies)) | ||
if all_dependencies.any? { |d| d.name == "bundler" } && !specs["bundler"].any? | ||
bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", ::Bundler::VERSION)).last | ||
specs["bundler"] = bundler | ||
end | ||
|
||
specs | ||
end | ||
end | ||
|
||
# Override requested_groups to also exclude any groups that are | ||
# in the "bundler.without" section of the licensed configuration file. | ||
def requested_groups | ||
super - Array(force_exclude_groups) | ||
end | ||
end | ||
end | ||
end |
This file contains 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