Skip to content

Commit

Permalink
Merge pull request #135 from Homebrew/avoid_sync_multiple_gemfile_rub…
Browse files Browse the repository at this point in the history
…y_versions
  • Loading branch information
MikeMcQuaid committed Jun 14, 2024
2 parents f14cd34 + 5006141 commit ba20a31
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/actions/sync/shared-config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def git(*args)
docs_workflow_yaml = ".github/workflows/docs.yml"
vale_ini = ".vale.ini"

target_gemfile_lock = target_directory_path/"Gemfile.lock"

homebrew_docs = homebrew_repository_path/docs
homebrew_ruby_version =
(homebrew_repository_path/"Library/Homebrew/vendor/portable-ruby-version").read
Expand All @@ -52,7 +54,7 @@ def git(*args)
dependabot_config_yaml["updates"].select! do |update|
case update["package-ecosystem"]
when "bundler"
(target_directory_path/"Gemfile.lock").exist?
target_gemfile_lock.exist?
when "npm"
(target_directory_path/"package.json").exist?
when "docker"
Expand Down Expand Up @@ -128,7 +130,13 @@ def git(*args)
next if target_docs_path.to_s.include?("vendor")

target_docs_path.dirname.mkpath
FileUtils.cp docs_path, target_docs_path

if [ruby_version, "Gemfile", "Gemfile.lock"].include?(docs_path_basename) &&
(target_path/docs_path_basename).exist?
FileUtils.rm target_docs_path
else
FileUtils.cp docs_path, target_docs_path
end
end
when docs_workflow_yaml
next if custom_docs_repos.include?(repository_name)
Expand Down Expand Up @@ -180,7 +188,7 @@ def git(*args)
#
# rubocop:disable Homebrew/NegateInclude
# We don't have Homebrew exclude? method here.
if !custom_ruby_version_repos.include?(repository_name) && (target_directory_path/"Gemfile.lock").exist?
if !custom_ruby_version_repos.include?(repository_name) && target_gemfile_lock.exist?
Dir.chdir target_directory_path do
require "bundler"
bundler_version = Bundler::Definition.build(homebrew_gemfile, homebrew_gemfile_lock, false)
Expand Down

0 comments on commit ba20a31

Please sign in to comment.