Skip to content

Commit

Permalink
Add remove_existing_files method
Browse files Browse the repository at this point in the history
  • Loading branch information
toshimaru committed Nov 12, 2023
1 parent b1ac767 commit 38c66e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 38c66e4

Please sign in to comment.