-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Skip bundler self-checksum for unreleased bundlers #9501
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -103,7 +103,7 @@ def add_section(name, value) | |||||||||||||||||||||||
| end | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def bundler_checksum | ||||||||||||||||||||||||
| return [] if Bundler.gem_version.to_s.end_with?(".dev") | ||||||||||||||||||||||||
| return [] unless released_bundler? | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| bundler_spec = definition.sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last | ||||||||||||||||||||||||
| return [] unless File.exist?(bundler_spec.cache_file) | ||||||||||||||||||||||||
|
|
@@ -115,5 +115,11 @@ def bundler_checksum | |||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| [definition.sources.metadata_source.checksum_store.to_lock(bundler_spec)] | ||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| def released_bundler? | ||||||||||||||||||||||||
| return false if Bundler.gem_version.prerelease? | ||||||||||||||||||||||||
| # Released gem specs live under .../specifications/; source checkouts don't. | ||||||||||||||||||||||||
| Gem.loaded_specs["bundler"]&.loaded_from.to_s.include?("/specifications/") | ||||||||||||||||||||||||
| end | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| # Released gem specs live under .../specifications/; source checkouts don't. | |
| Gem.loaded_specs["bundler"]&.loaded_from.to_s.include?("/specifications/") | |
| end | |
| # Released gem specs live under a "specifications" directory; source checkouts don't. | |
| path_components(Gem.loaded_specs["bundler"]&.loaded_from).include?("specifications") | |
| end | |
| def path_components(path) | |
| separators = [File::SEPARATOR, File::ALT_SEPARATOR].compact.uniq | |
| path.to_s.split(Regexp.union(separators)) | |
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
released_bundler?relies onloaded_from.to_s.include?("/specifications/"), which is not portable to Windows paths ("\specifications\") and is also a brittle substring check. Consider determining whether the bundler spec is installed by comparingFile.dirname(loaded_from)againstGem::Specification.dirsandGem.default_specifications_dir(or otherwise normalizing separators and doing an anchored path check).