Manifest.yml empty - ruby-on-rails

Whenever I run rake assets:precompile, I get a manifest.yml file that looks like:
--- {}
Something must be going wrong. Here is my output for rake assets:precompile --trace:
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/user/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /Users/user/.rvm/gems/ruby-1.9.3-p194#global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
Can someone help?? Thanks!
UPDATE:
Feel free to look at my code at www.github.com/sambaek/novulty

When I run rake assets:precompile for your application I get the following output
➜ novulty git:(master) ✗ rake assets:precompile
/Users/deefour/.rbenv/versions/1.9.3-p125/bin/ruby /Users/deefour/.rbenv/versions/1.9.3-p125/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
rake aborted!
Undefined variable: "$baseLineHeight".
(in /Users/deefour/.rbenv/versions/1.9.3-p125/gemsets/novulty/gems/bootstrap-sass-2.1.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/Users/deefour/.rbenv/versions/1.9.3-p125/...]
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
rake assets:precompile 12.50s user 1.21s system 99% cpu 13.744 total
I'm not sure what your intention is, but you have
app/asssets/bootstrap.min.css being included in app/assets/application.css
gem 'bootstrap-sass' in your Gemfile which appears to cause bootstrap-sass-2.1.0.1/vendor/assets/stylesheets/bootstrap/_accordion.scss (among other files) to be added to your pipeline even though they're not included in require lines in app/assets/application.css
It seems like you have the bootstrap gem included to use it's Javascript plugins, but are trying to omit the SASS files in favor of the hard-coded, minified CSS file?
In any event, the error I get says that the $baseLineHeight SASS variable is not defined for a line in that gem file's asset - an asset you otherwise appear to ignore (from the best I can tell).
I then did the following
Commented out the bootstrap-sass gem in your Gemfile
#gem 'bootstrap-sass'
Ran bundle
Ran rake assets:clean
Removed the following require lines from your app/assets/application.js because they were coming from the bootstrap-sass gem I removed in 1. above
//= require bootstrap-transition
//= require bootstrap-button
//= require bootstrap-carousel
//= require bootstrap-collapse
//= require bootstrap-tab
Ran rake assets:precompile
This results in the following public/assets/manifest.yml.
https://gist.github.com/d29f70b047c7b0606263
I think you need to either of the following
Use the bootstrap-sass gem as intended. Include the SASS files in your app/assets/application.css (doing this it a bit outside the scope of this question)
Get rid of the bootstrap-sass gem as I have above, and include the necessary Javascript files as assets in your vendor/assets/javascripts directory (which is where app/assets/stylesheets/bootstrap.min.css belongs too - vendor/assets/stylesheets)

Related

spree 2.0.3 heroku error precompiling assets "Error: Out of stack space"

I'm trying to get a basic spree application working on Heroku. I'm following http://railsapps.github.io/rails-heroku-tutorial.html and the spree heroku guide.
I have edited config/application.rb to include config.assets.initialize_on_precompile = false
Then, because I need to precompile before I push to Heroku, I get stuck here:
D:\code\foo>rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
d:/RailsInstaller/Ruby1.9.3/bin/ruby.exe d:/RailsInstaller/Ruby1.9.3/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Error: Out of stack space
(in D:/code/foo/app/assets/javascripts/admin/all.js)
d:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/execjs-.4.0/lib/execjs/external_runtime.rb:68:in `extract_result'
...much more...
The all.js asset is unchanged from the original installation:
Running
rake assets:clean
before the precompile fixed this for somebody else, but not for me.
Browsing around it looks like this might be a windows specific issue? If it matters I used railsinstaller and I'm running Windows 7 on fairly new laptop.
Then, because I need to precompile before I push to Heroku
This is false. By default, Heroku's Cedar stack compiles your assets during slug compilation when you push to Heroku.
For more information see: https://devcenter.heroku.com/articles/rails-asset-pipeline

rails heroku giving me We're sorry something went wrong error, gmaps4rails.css isn't compiled

I checked my heroku logs and the only thing that I can see that's giving me errors is
2013-07-04T21:32:14.887388+00:00 app[web.1]: ActionView::Template::Error (gmaps4rails.css isn't precompiled):
and then a few lines down I get
2013-07-04T21:32:14.888116+00:00 app[web.1]: Completed 500 Internal Server Error in 767ms
I'm not sure what is causing the error but maybe if I fix this issue, I can test to see if I'm still getting the error. In my confi/application.rb file I have this:
config.assets.initialize_on_precompile = false
config.assets.precompile += %w( gmaps4rails.css )
config.assets.compile = true
I'm not sure what is causing the error.
Also, I've tried restarting my heroku server, using heroku rake db:migrate and still getting the same errors.
Thanks
EDIT:
Added output from rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/andrewliu/.rvm/rubies/ruby-1.9.3-p392/bin/ruby /Users/andrewliu/.rvm/gems/ruby-1.9.3-p392#global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
Given the comments above I think you should
Remove this line from enviroment
config.assets.precompile += %w( gmaps4rails.css )
Remove this line from layout
<%= stylesheet_link_tag 'gmaps4rails' %>
Check if in applications.css you have this file included explicitly or require_tree .
because if you have gmaps4rails.css in app/assets/stylesheets then it should be precompiled with other assets.
EDIT: Explanation
What was the problem really? Two things.
First you ask Rails to add a file to asset compilation, but you should only do it if file is outside app/assets directory (ex. in gem)
Second, in layout you wanted to add a stylesheet link to this file but it was not compiled separately but as a part of application.css

Why are my Rails assets getting precompiled twice?

I've noticed my assets seem to get compiled twice, which considerably slows down my deployment, as this step is the most time consuming part:
~/projects/rewportal(mapwidget ✔) rake assets:precompile
/home/ruy/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /home/ruy/.rvm/gems/ruby-1.9.3-p194#rewportal/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
AssetSync: using /home/ruy/projects/rewportal/config/initializers/asset_sync.rb
AssetSync: using /home/ruy/projects/rewportal/config/initializers/asset_sync.rb
AssetSync: Syncing.
Using: Directory Search of /home/ruy/projects/rewportal/public/assets
Uploading: assets/application-5170f52c1dd49cb382d5135bee01d75e.js
[...]
Fetching files to flag for delete
Flagging 8 file(s) for deletion
Deleting: assets/active_admin-4ce46d089d4b0080e87c9abcb6fa6c97.css
[...]
AssetSync: Done.
It this normal?
When I precompile to other environments (non-production), I can see the detailed compilation of each asset twice:
~/projects/rewportal(mapwidget ✔) rake RAILS_ENV=qa assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/ruy/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /home/ruy/.rvm/gems/ruby-1.9.3-p194#rewportal/bin/rake assets:precompile:all RAILS_ENV=qa RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
AssetSync: using /home/ruy/projects/rewportal/config/initializers/asset_sync.rb
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
Compiled gmaps4rails/gmaps4rails.base.js (141ms) (pid 8480)
Compiled gmaps4rails/gmaps4rails.googlemaps.js (148ms) (pid 8480)
[...]
Compiled active_admin.css (1299ms) (pid 8480)
Compiled active_admin/print.css (113ms) (pid 8480)
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
AssetSync: using /home/ruy/projects/rewportal/config/initializers/asset_sync.rb
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
Compiled gmaps4rails/gmaps4rails.base.js (133ms) (pid 8480)
Compiled gmaps4rails/gmaps4rails.googlemaps.js (133ms) (pid 8480)
[...]
Compiled active_admin.css (1290ms) (pid 8480)
Compiled active_admin/print.css (116ms) (pid 8480)
AssetSync: Syncing.
Using: Directory Search of /home/ruy/projects/rewportal/public/assets
Uploading: assets/active_admin-d05b61ab8366b74eabc9074d3e60fe82.css.gz
[...]
Fetching files to flag for delete
Flagging 6 file(s) for deletion
Deleting: assets/active_admin-ec90e7d9a9f45f14d1387f58fa1452b4.css
[...]
AssetSync: Done.
My application.rb has the following:
config.assets.precompile += %w( active_admin/print.css active_admin.css active_admin.js admin.js admin.css html5shiv.js )
Ideas?
Rails 3 by default compiles once to generate fingerprinted assets, and once to generate non-fingerprinted assets (the fingerprinted ones have the MD5 hash in the filename).
You can use the turbo-sprockets-rails3 gem to create both from one compilation.
In Rails 4, this functionality was extracted into the sprockets-rails gem and the behavior was changed, so the double compilation does not happen in Rails 4.
Are you using capistrano? If so, you can try to compile your assets locally, and then upload to server, with a task like this
namespace :deploy do
namespace :assets do
desc "Precompile assets on local machine and upload them to the server."
task :precompile, roles: :web, except: {no_release: true} do
run_locally "bundle exec rake assets:precompile"
find_servers_for_task(current_task).each do |server|
run_locally "rsync -vr --exclude='.DS_Store' public/assets #{user}##{server.host}:#{shared_path}/"
end
end
end
end
I overwrite the deploy_all task inside deploy.rb to compile before uploading:
task :remake_all do
puts "precompiling assets"
res = `env rake assets:precompile:all RAILS_ENV=precompile RAILS_GROUPS=assets 2>&1`
$stderr.puts "assets res is: #{res}"
if res =~ /aborted|don't|invalid|segmentation|bug/i
puts "############ Unable to compile assets #########"
exit
end
end
I had issues with the development environment not compiling properly and the production environment needing access to mysql servers behind a firewall, so made a new environment called :precompile
The solution for me (Rails 3) was to run rake assets:precompile:primary instead of rake assets:precompile:all.

Rails 3.1 Assets Pipeline Precompile Error - couldn't find file 'jquery'

I'm upgrading a Rails 3.1 app to use the assets pipeline. I have included the 'jquery-rails' gem in my Gemfile and installed by running bundle install.
Using jquery-rails (1.0.19)
My application.js file in app/assets/javascripts directory looks like this:
// ...
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree .
...
When I run bundle exec rake assets:precompile I get the following error:
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/augus164/.rvm/rubies/ruby-1.9.3-p0/bin/ruby /Users/augus164/.rvm/gems/ruby-1.9.3-p0/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
couldn't find file 'jquery'
It's my understanding that by including jquery-rails gem I don't need to include the jquery library in my javascripts directory, or link to it from the google cdn. Anyone know what I'm missing?
If you are using rails 3.1 you do not need the gem. It is included by default with rails.

Rake tasks on Rails 3.1.3 - Application already initialized

I'm unable to get rake precompile tasks running with Rails 3.1.3. I get the following error:
$ rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/Users/tristankromer/.rvm/rubies/ruby-1.9.2-p290/bin/ruby /Users/tristankromer/.rvm/gems/ruby-1.9.2-p290#toomanyninjas/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
rake aborted!
Application has been already initialized.
/Users/tristankromer/.rvm/gems/ruby-1.9.2-p290#toomanyninjas/gems/railties-3.1.3/lib/rails/application.rb:95:in `initialize!'
Same thing happens when I used bundle exec or when I deploy to heroku cedar stack.
Not quite sure where to start on this one. Any ideas?
UPDATE: I'm having issues with every rake task:
rake aborted!
Application has been already initialized.
/Users/tristankromer/.rvm/gems/ruby-1.8.7-p249#joke-off/gems/railties-3.1.3/lib/rails/application.rb:95:in `initialize!'
Upgrading rake to 0.9.2.2 and using ruby 1.9.2-p290 seems to have fixed the issue.
I had this issue, I didn't want to upgrade ruby, and what ended up working for me was the renaming config.ru in RAILS_ROOT to config.ru.bak
http://code.google.com/p/phusion-passenger/issues/detail?id=109
I came across this after realizing I was having an issue getting Passenger to recognize the "RailsEnv" setting my my virtual hosts conf
I had this problem on Rails 3.2.6
The reason it was happening had to do with a path linked gem having a bundle folder. in my gemfile
like so:
gem 'some-gem', :path => "vendor/some-gem"
In order to fix the issue I just moved the bundle folder out of the path linked gem.
mv vendor/some-gem/bundle ~
Once the bundle file was gone it worked perfectly

Resources