Instead of doing an `rm -rf`, rely on `rake assets:clean`, which already obeys the setting. Unfortunately, the call to figure out the count of assets compiled would still need to have a directory specified. Thus, it's been removed. Less information, but the compilation still works fine.
This commit is contained in:
parent
13d954d6bc
commit
8424beee1e
@ -26,12 +26,9 @@ module Guard
|
|||||||
|
|
||||||
def compile_assets
|
def compile_assets
|
||||||
puts 'Compiling rails assets'
|
puts 'Compiling rails assets'
|
||||||
result = system "rm -rf public/assets && bundle exec rake assets:precompile"
|
result = system "bundle exec rake assets:clean assets:precompile"
|
||||||
if result
|
if result
|
||||||
tree = `tree public/assets`
|
Notifier::notify 'Assets compiled'
|
||||||
puts tree
|
|
||||||
summary = tree.split("\n").last
|
|
||||||
Notifier::notify summary, :title => 'Assets compiled'
|
|
||||||
else
|
else
|
||||||
Notifier::notify 'see the details in the terminal', :title => "Can't compile assets", :image => :failed
|
Notifier::notify 'see the details in the terminal', :title => "Can't compile assets", :image => :failed
|
||||||
end
|
end
|
||||||
|
@ -28,13 +28,12 @@ describe Guard::RailsAssets do
|
|||||||
|
|
||||||
describe 'asset compilation using CLI' do
|
describe 'asset compilation using CLI' do
|
||||||
def stub_system_with result
|
def stub_system_with result
|
||||||
subject.should_receive(:system).with("rm -rf public/assets && bundle exec rake assets:precompile").and_return result
|
subject.should_receive(:system).with("bundle exec rake assets:clean assets:precompile").and_return result
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should notify on success' do
|
it 'should notify on success' do
|
||||||
stub_system_with true
|
stub_system_with true
|
||||||
subject.should_receive(:`).with('tree public/assets').and_return "a\nb\n1 directory, 2 files"
|
Guard::Notifier.should_receive(:notify).with('Assets compiled')
|
||||||
Guard::Notifier.should_receive(:notify).with('1 directory, 2 files', :title => 'Assets compiled')
|
|
||||||
subject.compile_assets
|
subject.compile_assets
|
||||||
end
|
end
|
||||||
it 'should notify on failure' do
|
it 'should notify on failure' do
|
||||||
@ -44,8 +43,4 @@ describe Guard::RailsAssets do
|
|||||||
subject.compile_assets
|
subject.compile_assets
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'custom assets prefix' do
|
|
||||||
it 'should use given prefix'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user