diff --git a/Rakefile b/Rakefile index 6cea33fa55..3aedf2799b 100644 --- a/Rakefile +++ b/Rakefile @@ -77,6 +77,7 @@ end def generate_src(target_version:) copy_sources = Dir.glob('rails/doc/rdoc/*').reject { |path| path.end_with?('panel', 'js', 'created.rid') } target_dir = target_version == default_rails_version ? SOURCE_DIR : "#{SOURCE_DIR}/#{target_version}" + remove_existing_files(target_dir) cp_r copy_sources, target_dir cd target_dir do @@ -92,3 +93,10 @@ def generate_src(target_version:) File.write('navigation.html', content) end end + +EXISTING_DIRS = %w[classes files].freeze +def remove_existing_files(target_dir) + EXISTING_DIRS.each do |dir| + rm_rf "#{target_dir}/#{dir}" + end +end