Class: Dependabot::Nuget::FileUpdater
- Inherits:
-
FileUpdaters::Base
- Object
- FileUpdaters::Base
- Dependabot::Nuget::FileUpdater
- Extended by:
- T::Sig
- Defined in:
- lib/dependabot/nuget/file_updater.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.updated_files_regex ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/dependabot/nuget/file_updater.rb', line 20 def self.updated_files_regex [ %r{^[^/]*\.([a-z]{2})?proj$}, /^packages\.config$/i, /^global\.json$/i, /^dotnet-tools\.json$/i, /^Directory\.Build\.props$/i, /^Directory\.Build\.targets$/i, /^Packages\.props$/i ] end |
Instance Method Details
#updated_dependency_files ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/dependabot/nuget/file_updater.rb', line 33 def updated_dependency_files base_dir = "/" SharedHelpers.in_a_temporary_repo_directory(base_dir, repo_contents_path) do dependencies.each do |dependency| try_update_projects(dependency) || try_update_json(dependency) end updated_files = dependency_files.filter_map do |f| updated_content = File.read(dependency_file_path(f)) next if updated_content == f.content normalized_content = normalize_content(f, updated_content) next if normalized_content == f.content next if only_deleted_lines?(f.content, normalized_content) puts "The contents of file [#{f.name}] were updated." updated_file(file: f, content: normalized_content) end updated_files end end |