Skip to content

Instantly share code, notes, and snippets.

@chrisk
Created August 10, 2010 18:55

Revisions

  1. chrisk created this gist Aug 10, 2010.
    14 changes: 14 additions & 0 deletions remove_old_submodules.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    # 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