Permalink
Browse files

Merge pull request #17 from johnbintz/master

Fix resolving of Rails constant so it plays nice with Guard::Rails
  • Loading branch information...
2 parents ef0d920 + 7319bc6 commit 814bf003661d8e0384cf8dc058a820379b36643f @dnagir committed Nov 19, 2011
Showing with 6 additions and 6 deletions.
  1. +4 −4 lib/guard/rails-assets/rails_runner.rb
  2. +2 −2 spec/guard/rails-assets/cli_runner_spec.rb
@@ -40,12 +40,12 @@ def clean
Rake::Task["tmp:cache:clear"].execute
# copy from the "assets:clean" Rake task
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
end
def precompile
- config = Rails.application.config
+ config = ::Rails.application.config
unless config.assets.enabled
warn "Cannot precompile assets if sprockets is disabled. Enabling it."
config.assets.enabled = true
@@ -61,8 +61,8 @@ def precompile
config.assets.digest = digest
config.assets.digests = {}
- env = Rails.application.assets
- target = File.join(Rails.public_path, config.assets.prefix)
+ env = ::Rails.application.assets
+ target = File.join(::Rails.public_path, config.assets.prefix)
compiler = Sprockets::StaticCompiler.new(env,
target,
config.assets.precompile,
@@ -4,15 +4,15 @@
it 'should run the command' do
subject.stub(:system)
- subject.should_receive(:system).with("RAILS_ENV=test bundle exec rake assets:clean assets:precompile")
+ subject.should_receive(:system).with("bundle exec rake assets:clean assets:precompile RAILS_ENV=test")
subject.compile_assets
end
context 'with production environment' do
subject { Guard::RailsAssets::CliRunner.new(:rails_env => :production) }
it 'should run the command' do
subject.stub(:system)
- subject.should_receive(:system).with("RAILS_ENV=production bundle exec rake assets:clean assets:precompile")
+ subject.should_receive(:system).with("bundle exec rake assets:clean assets:precompile RAILS_ENV=production")
subject.compile_assets
end
end

0 comments on commit 814bf00

Please sign in to comment.