Skip to content

Instantly share code, notes, and snippets.

@kschiess
Created October 26, 2011 11:48
Show Gist options
  • Save kschiess/1316118 to your computer and use it in GitHub Desktop.
Save kschiess/1316118 to your computer and use it in GitHub Desktop.
How to prevent rake from polluting global namespace
class Module
def with_rake_pollution_prevention_append_features(klass)
unless caller.first.match(/rake/) && self.name == "Rake::DeprecatedObjectDSL"
without_rake_pollution_prevention_append_features(klass)
end
end
alias without_rake_pollution_prevention_append_features append_features
alias append_features with_rake_pollution_prevention_append_features
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment