Skip to content

Commit

Permalink
Merge pull request #17 from johnbintz/master
Browse files Browse the repository at this point in the history
Fix resolving of Rails constant so it plays nice with Guard::Rails
  • Loading branch information
dnagir committed Nov 19, 2011
2 parents ef0d920 + 7319bc6 commit 814bf00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/guard/rails-assets/rails_runner.rb
Expand Up @@ -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
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions spec/guard/rails-assets/cli_runner_spec.rb
Expand Up @@ -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
Expand Down

0 comments on commit 814bf00

Please sign in to comment.