@@ -439,9 +439,19 @@ def rb_files_in dir
439439 end
440440 end
441441
442+ # for installation of bundler as default gems
442443 def template_files
443444 Dir . chdir "bundler/lib" do
444- Dir [ File . join ( 'bundler' , 'templates' , '**' , '*' ) ] . select { |f | !File . directory? ( f ) }
445+ ( Dir [ File . join ( 'bundler' , 'templates' , '**' , '*' ) ] + Dir [ File . join ( 'bundler' , 'templates' , '**' , '.*' ) ] ) .
446+ select { |f | !File . directory? ( f ) }
447+ end
448+ end
449+
450+ # for cleanup old bundler files
451+ def template_files_in dir
452+ Dir . chdir dir do
453+ ( Dir [ File . join ( 'templates' , '**' , '*' ) ] + Dir [ File . join ( 'templates' , '**' , '.*' ) ] ) .
454+ select { |f | !File . directory? ( f ) }
445455 end
446456 end
447457
@@ -482,10 +492,10 @@ def remove_old_lib_files lib_dir
482492 lib_dirs [ File . join ( lib_dir , 'bundler' ) ] = 'bundler/lib/bundler' if Gem ::USE_BUNDLER_FOR_GEMDEPS
483493 lib_dirs . each do |old_lib_dir , new_lib_dir |
484494 lib_files = rb_files_in ( new_lib_dir )
485- lib_files . concat ( template_files ) if new_lib_dir =~ /bundler/
495+ lib_files . concat ( template_files_in ( new_lib_dir ) ) if new_lib_dir =~ /bundler/
486496
487497 old_lib_files = rb_files_in ( old_lib_dir )
488- old_lib_files . concat ( template_files ) if old_lib_dir =~ /bundler/
498+ old_lib_files . concat ( template_files_in ( old_lib_dir ) ) if old_lib_dir =~ /bundler/
489499
490500 to_remove = old_lib_files - lib_files
491501
0 commit comments