scope the Rails reference so Guard::Rails is not used instead of actual Rails

This commit is contained in:
John Bintz 2011-11-18 10:05:59 -05:00
parent ef0d9209db
commit e329b100f3

View File

@ -40,12 +40,12 @@ module Guard
Rake::Task["tmp:cache:clear"].execute Rake::Task["tmp:cache:clear"].execute
# copy from the "assets:clean" Rake task # copy from the "assets:clean" Rake task
config = ::Rails.application.config config = ::Rails.application.config
public_asset_path = File.join(Rails.public_path, config.assets.prefix) public_asset_path = File.join(::Rails.public_path, config.assets.prefix)
rm_rf public_asset_path, :secure => true rm_rf public_asset_path, :secure => true
end end
def precompile def precompile
config = Rails.application.config config = ::Rails.application.config
unless config.assets.enabled unless config.assets.enabled
warn "Cannot precompile assets if sprockets is disabled. Enabling it." warn "Cannot precompile assets if sprockets is disabled. Enabling it."
config.assets.enabled = true config.assets.enabled = true
@ -61,8 +61,8 @@ module Guard
config.assets.digest = digest config.assets.digest = digest
config.assets.digests = {} config.assets.digests = {}
env = Rails.application.assets env = ::Rails.application.assets
target = File.join(Rails.public_path, config.assets.prefix) target = File.join(::Rails.public_path, config.assets.prefix)
compiler = Sprockets::StaticCompiler.new(env, compiler = Sprockets::StaticCompiler.new(env,
target, target,
config.assets.precompile, config.assets.precompile,