Skip to content

Commit

Permalink
Allow overriding gems for bleeding edge
Browse files Browse the repository at this point in the history
Something breaks, I make a PR, the PR sits for a while.

Overrides can look like this: `{"webmock":{"github":"https://github.com/bblimke/webmock/pull/xxx"}}`
  • Loading branch information
Earlopain committed Nov 16, 2024
1 parent 626e399 commit 605b419
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/bleeding_edge.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require "bundler"
require "json"

remote = "https://rubygems.org"
fetcher = Bundler::Fetcher.new(Bundler::Source::Rubygems::Remote.new(remote))
Expand All @@ -16,17 +17,18 @@
"nokogiri", # Unknown, mini_portile2 is not found during the build. Maybe platform-related.
"mini_portile2",
].freeze
OVERRIDES = JSON.parse(ENV.fetch("GEM_OVERRIDES", "{}"))

stubs.each do |stub|
url = stub.metadata["source_code_uri"] || stub.homepage
matched = url[%r{https?://git(?:hub|lab)\.com/[^\/]*/[^\/]*}]
next if FULL_SKIP.include?(stub.name)

lines << if matched && !NO_GIT.include?(stub.name) # rubocop:disable Rails/NegateInclude
"gem #{stub.name.inspect}, git: #{matched.inspect}, submodules: true"
else
"gem #{stub.name.inspect}"
end
extra = {}
extra = { git: matched, submodules: true } if matched && !NO_GIT.include?(stub.name) # rubocop:disable Rails/NegateInclude
extra = OVERRIDES[stub.name] if OVERRIDES.key?(stub.name)

lines << "gem #{stub.name.inspect}, #{extra.inspect}"
end

File.write("Gemfile", lines.join("\n"))
2 changes: 2 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
uses: ruby/setup-ruby@v1
- if: env.BLEEDING_EDGE == 'true'
name: Use git gem sources
env:
GEM_OVERRIDES: ${{ vars.GEM_OVERRIDES }}
# https://github.com/rubygems/rubygems/issues/8238
run: ruby .github/bleeding_edge.rb && bundle lock --update && cat Gemfile.lock

Expand Down

0 comments on commit 605b419

Please sign in to comment.