Skip to content

Instantly share code, notes, and snippets.

@chrisk
Created August 10, 2010 18:55
Show Gist options
  • Save chrisk/517775 to your computer and use it in GitHub Desktop.
Save chrisk/517775 to your computer and use it in GitHub Desktop.
Rails initializer to remove old submodules
# Git doesn't remove submodules from your working tree when you pull. This Rails
# initializer will take care of it for you, so developers don't have to do
# anything.
paths = %w(vendor/gems/first_gem-1.0.0
vendor/gems/another_gem-1.0.0)
paths.each do |path|
dir = Rails.root.join(path)
if File.directory?(dir)
puts "Automatically deleting #{dir.sub(Rails.root.to_s + '/', '')}, since it's an old submodule that we removed"
FileUtils.rm_rf dir
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment