jimweirich/rake — Issue #81: Rake as a library: REDUCE_COMPAT is unsuitable
Author: kschiess
Created: 2011-10-26 08:14:15+00:00
State: open

To be able to specify which version of rake I use, rake figures as 'gem "rake"' in my Gemfile. That means that rake is part of my applications environment (which is useful when using app-related classes in the Rakefile as well).

With rake, I inherit 'dsl_definition.rb' and the line

include Rake::DeprecatedObjectDSL unless defined? Rake::REDUCE_COMPAT

To avoid getting rake methods in my objects I would have to

module Rake
REDUCE_COMPAT = true
end

before any kind of bundler setup. This can be done, but will be real hard in the case of 'bundler exec X'. The '--reduce-compat' switch doesn't help at all.

The same kind of objection applies to any kind of usage of rake as library. The bad thing here is really the namespace pollution that rake does, be it conditionally or unconditionally. #63 doesn't solve the problem at all.

The default should be not to pollute global namespace, with the exception being the pollution, not the other way around. I realize this may break stuff, but we can safely assume that people can control their gem versions by now...