hawx / guard-sass

Guard::Sass automatically rebuilds sass files when modified (like sass --watch)
MIT License
88 stars 35 forks source link

Support for :cache_path setting #49

Closed LimeBlast closed 10 years ago

LimeBlast commented 10 years ago

I'm running guard-sass (via https://github.com/JeffreyWay/Laravel-Guard) inside a Vagrant virtual machine.

Upon running, I'm getting the error message complaining that the cache file was busy.

After a bit of research, I've found that this is possibly due to the .sass-cache folder being a vagrant-shared folder (http://stackoverflow.com/a/19312073/1049688) and that if I use the :cache_path setting, I can set this to be outside the shared folder (hopefully solving my problem).

As such, I've tried setting this using the following line in my Guardfile:

guard :sass, :input => 'app/assets/sass', :output => 'public/css', :cache_location => '/tmp/sass-cache'

But it doesn't appear to work, as I'm still getting the same error message.

So, long story short (too late), would it be possible for :cache_path to be supported by guard-sass? Thank you

(here is the error message)

Guard::Sass failed to achieve its <run_all>, exception was:
> [#7FC61DBC75ED] Errno::ETXTBSY: Text file busy - (/srv/www/unknowntales.net/.sass-cache/6e3c5f8cf77d32b4cd007275a86be6298688ecf7/foundation.scssc20131121-30292-1ku8cn, ./.sass-cache/6e3c5f8cf77d32b4cd007275a86be6298688ecf7/foundation.scssc)
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/util.rb:886:in `rename'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/util.rb:886:in `atomic_create_and_write_file'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/cache_stores/filesystem.rb:39:in `_store'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/cache_stores/base.rb:51:in `store'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/cache_stores/chain.rb:19:in `block in store'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/cache_stores/chain.rb:19:in `each'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/cache_stores/chain.rb:19:in `store'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/engine.rb:353:in `_to_tree'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/engine.rb:315:in `_render'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/engine.rb:262:in `render'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass/runner.rb:87:in `compile'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass/runner.rb:51:in `block (2 levels) in compile_files'
> [#7FC61DBC75ED] /usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass/runner.rb:50:in `block in compile_files'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass/runner.rb:47:in `each'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass/runner.rb:47:in `compile_files'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass/runner.rb:23:in `run'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass.rb:147:in `run_on_changes'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-sass-1.3.2/lib/guard/sass.rb:99:in `run_all'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:99:in `block in run_supervised_task'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:97:in `catch'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:97:in `run_supervised_task'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:54:in `block (2 levels) in run'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:175:in `block (3 levels) in scoped_guards'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:173:in `each'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:173:in `block (2 levels) in scoped_guards'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:172:in `catch'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:172:in `block in scoped_guards'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:170:in `each'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:170:in `scoped_guards'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:53:in `block in run'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/lumberjack-1.0.4/lib/lumberjack.rb:31:in `unit_of_work'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/runner.rb:52:in `run'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard.rb:261:in `block in run_all'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard.rb:387:in `block in within_preserved_state'
> [#7FC61DBC75ED] <internal:prelude>:10:in `synchronize'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard.rb:384:in `within_preserved_state'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard.rb:258:in `run_all'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/commands/all.rb:23:in `process'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:579:in `call'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:453:in `call_with_hooks'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:426:in `call_safely'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:368:in `process_line'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command_set.rb:350:in `process_line'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:445:in `process_command'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:426:in `retrieve_line'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:301:in `block in r'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:298:in `loop'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:298:in `r'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:276:in `re'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:254:in `rep'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:234:in `block (3 levels) in repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:232:in `loop'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:232:in `block (2 levels) in repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:231:in `catch'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:231:in `block in repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:230:in `catch'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:230:in `repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_class.rb:246:in `run_command'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/interactor.rb:145:in `block in create_run_all_command'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:492:in `instance_exec'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:492:in `call'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:453:in `call_with_hooks'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:426:in `call_safely'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command.rb:368:in `process_line'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/command_set.rb:350:in `process_line'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:445:in `process_command'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:426:in `retrieve_line'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:301:in `block in r'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:298:in `loop'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:298:in `r'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:276:in `re'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:254:in `rep'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:234:in `block (3 levels) in repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:232:in `loop'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:232:in `block (2 levels) in repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:231:in `catch'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:231:in `block in repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:230:in `catch'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_instance.rb:230:in `repl'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/pry-0.9.12.3/lib/pry/pry_class.rb:170:in `start'
> [#7FC61DBC75ED] /usr/lib/ruby/gems/1.9.1/gems/guard-1.8.3/lib/guard/interactor.rb:248:in `block in start'
andreasbittner commented 10 years ago

@LimeBlast I ran into the same problem while working with a vagrant shared folder to a windows host. Have you found a workaround to get it to work?

LimeBlast commented 10 years ago

@abnoreality Alas, not yet. As I don't need to do any front end work on this for a couple of months, I've simply disabled sass generation for the moment.

I'm giving some serious though to jumping ship and going over to Grunt...

andreasbittner commented 10 years ago

@LimeBlast I now moved over to generating on the host system through the mounted drive. That works at the moment, but I still hope for a real solution to this.

Have the same problem in another project with Grunt using Compass. No avoiding the problem, it seems.

LimeBlast commented 10 years ago

If the author of this plugin added support for :cache_path (possibly with a little effort as just forwarding the setting onto sass - although nothing nothing about Ruby, I'd not want to suggest that it's 'easy'), it would fix it.

hawx commented 10 years ago

Finally got round to adding this (v1.4.0). You can now just pass any sass option in, so setting :cache_location like you had in that example right at the top now works.

LimeBlast commented 10 years ago

Thank you @hawx, that is awesome. I'll give it a try as soon as I'm able to :)

LimeBlast commented 10 years ago

Yup, this works perfectly, thank you again :)