Skip to content

Commit

Permalink
fix: Include specs in overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Nov 13, 2023
1 parent 262f858 commit cc17809
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions bin/overrides
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,14 @@ require 'bundler'
def list_gem_files
decidims = Bundler.load.specs.select { |dep| dep.name.include?("decidim") }
decidims.map do |spec|
Dir.glob("#{spec.full_gem_path}/{app,lib}/**/*").select { |file| File.file?(file) }
Dir.glob("#{spec.full_gem_path}/{app,lib,spec}/**/*").select { |file| File.file?(file) }
end.flatten
end

def current_files
Dir.glob("{app,lib}/**/*").select { |file| File.file?(file) }.flatten
Dir.glob("{app,lib,spec}/**/*").select { |file| File.file?(file) }.flatten
end

def find_overrides(app_path, gem_files)
overrides = []

Dir.glob("#{app_path}/**/*").each do |file|
next unless File.file?(file)

relative_path = Pathname.new(file).relative_path_from(Pathname.new(app_path)).to_s
gem_files.each do |gem_file|
if gem_file.end_with?(relative_path)
overrides << { app_file: file, gem_file: gem_file }
break
end
end
end

overrides
end


overrides = {}
current_files.each do |file|
list_gem_files.each do |gem_file|
Expand Down

0 comments on commit cc17809

Please sign in to comment.