2012-07-14 43 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中的生产部分,以使其工作。有可能是一个更简单的方法...