2012-07-14 42 views
1

我在JRuby中的Rails應用程序,當我運行rake assets:precomile它僅創建一個文件/public/assets/manifest.yml與此內容:的JRuby on Rails的資產:預編譯什麼也不做

--- {} 
... 

的asstes沒有獲得預編譯的,但我不得到任何錯誤,當我嘗試跟蹤此:

[email protected]:~/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 

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

我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' 

有沒有人一個想法如何解決這個問題?

回答

1

其實,你可以通過添加

config.assets.initialize_on_precompile避免這種= FALSE

要在application.rb中

+0

謝謝,我認爲這是更好的解決方案。 – tbraun89 2012-07-15 11:49:26

1

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

1

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