ndbroadbent / turbo-sprockets-rails3

Speeds up your Rails 3 assets:precompile by only recompiling changed files, and only compiling once to generate all assets
MIT License
975 stars 78 forks source link

No such file or directory - tmp/cache/assets/ #16

Closed shaicoleman closed 11 years ago

shaicoleman commented 11 years ago

I'm getting the following error with 0.1.15:

bundle exec rake --trace assets:precompile RAILS_ENV=staging
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby /usr/local/rvm/gems/ruby-1.9.2-p0/bin/rake assets:precompile:all RAILS_ENV=staging RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Invoke assets:cache:clean (first_time)
** Invoke tmp:create (first_time)
** Execute tmp:create
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
Connecting to database specified by database.yml
** Execute assets:cache:clean
rake aborted!
No such file or directory - /myproject/tmp/cache/assets/
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.8/lib/active_support/cache/file_store.rb:26:in `open'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.8/lib/active_support/cache/file_store.rb:26:in `entries'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.8/lib/active_support/cache/file_store.rb:26:in `clear'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:88:in `clear'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/turbo-sprockets-rails3-0.1.15/lib/turbo-sprockets/tasks/assets.rake:120:in `block (3 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile:all => assets:cache:clean
rake aborted!
Command failed with status (1): [/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/...]
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/turbo-sprockets-rails3-0.1.15/lib/turbo-sprockets/tasks/assets.rake:23:in `ruby_rake_task'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/turbo-sprockets-rails3-0.1.15/lib/turbo-sprockets/tasks/assets.rake:32:in `invoke_or_reboot_rake_task'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/turbo-sprockets-rails3-0.1.15/lib/turbo-sprockets/tasks/assets.rake:40:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p0/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p0/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile    
ndbroadbent commented 11 years ago

This is a really strange error that I've never seen before. Does it work normally if you run mkdir -p tmp/cache/assets first?

shaicoleman commented 11 years ago

It deletes the tmp/cache/assets directory if it exists, and thus fails regardless if the directory exists or not.

ryana commented 11 years ago

I'm seeing something that I think is related. It seems whenever the asset compilation kicks off, the directories in my tmp dir get un-symlinked and made into real directories. The impact for me is that my socket is missing because it is at tmp/sockets/sockets/unicorn.rb instead of tmp/sockets/unicorn.rb

I'll dig in a little more and report back.

ryana commented 11 years ago

My guess is it's this line in turbo-sprockets/tasks/assets.rake:

119 task :clean => ['tmp:create', "assets:environment"] do

And as soon as I find tmp:create, I'm guessing it blows away tmp/ before creating...

ryana commented 11 years ago

Bingo.

https://github.com/rails/rails/blob/master/railties/lib/rails/tasks/tmp.rake

It's clearing everything and re-creating. I'll work on a patch.

ryana commented 11 years ago

https://github.com/ndbroadbent/turbo-sprockets-rails3/pull/19

ndbroadbent commented 11 years ago

@shaicoleman, I've just pushed version 0.1.16 with @ryana's patch. Please test it out and let me know if it solves your problem too! Thanks

shaicoleman commented 11 years ago

Works for me now.