簡體   English   中英

JRuby on Rails資產:預編譯什么都不做

[英]JRuby on Rails assets:precompile does nothing

我在JRuby中有一個rails應用程序,當我運行rake assets:precomile它只創建一個帶有以下內容的文件/public/assets/manifest.yml

--- {}
...

所有的asstes都沒有得到預編譯,但是當我嘗試跟蹤時,我沒有收到任何錯誤:

tbraun@tbraun-DEBIAN:~/Dokumente/Entwicklung/RubyOnRails/Passbildkartei$ rake assets:precompile --trace
** Invoke environment (first_time)
** Execute environment
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/tbraun/.rvm/rubies/jruby-1.6.7.2/bin/jruby /home/tbraun/.rvm/gems/jruby-1.6.7.2/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke environment (first_time)
** Execute environment
** 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 
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke environment (first_time)
** Execute environment
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment 
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest

但是我的資產目錄中有一些圖像,javascripts和樣式表,我不知道我能做些什么來解決這個問題。

我的JRuby版本是:

jruby 1.6.7.2 (ruby-1.9.2-p312) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [linux-amd64-java]

這就是我正在使用的寶石:

source 'https://rubygems.org'

gem 'rails', '3.2.3'
gem "haml", "~> 3.1.4"
gem "paperclip", "~> 3.0"
gem "will_paginate", "~> 3.0.3"
gem "devise", "~> 2.1.2"
gem "devise_ldap_authenticatable", "~> 0.6.1"

gem 'activerecord-jdbcsqlite3-adapter'
gem 'activerecord-jdbcmysql-adapter'

gem 'jruby-openssl'
gem 'json'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  gem 'therubyrhino'

  gem 'uglifier', '>= 1.0.3'
  gem "haml-rails", "~> 0.3.4"

  gem "warbler", "~> 1.3.5"
end

gem 'jquery-rails'

有誰知道如何解決這個問題?

我自己發現了這個問題。 導致assets:precomiledevise寶石assets:precomile失敗,因為它需要訪問數據庫。 但我的生產數據庫只能通過VPN訪問。 所以你只需要確保在預先發布asstes時使用devise時可以訪問db。

實際上,您可以通過添加來避免這種情況

config.assets.initialize_on_precompile = false

到你的application.rb

有同樣的問題。 再次devise寶石。 使用heroku所以我的配置文件中沒有有效的生產數據庫信息。 將我的開發配置復制到config / database.yml中的生產部分,只是為了使它工作。 可能有一個更簡單的方法...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM