2013-09-18 3 views
1

я это в моих application.js:Рельсы трубопровода активов не включая файлы

//= require jquery 
//= require jquery_ujs 
//= require prettyprint 
//= require_tree . 

И это моя конфигурация для производства:

# Disable Rails's static asset server (Apache or nginx will already do this) 
    config.serve_static_assets = false 

    # Compress JavaScripts and CSS 
    config.assets.compress = true 

    # Don't fallback to assets pipeline if a precompiled asset is missed 
    config.assets.compile = false 

    # Generate digests for assets URLs 
    config.assets.digest = true 

Когда я нажимаю на Heroku, я получаю:

-----> Writing config/database.yml to read from DATABASE_URL 
-----> Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_6a112dd5-b53f-4798-94d6-22ecc2b1edc4/Rakefile:7) 
     DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_6a112dd5-b53f-4798-94d6-22ecc2b1edc4/Rakefile:7) 
     DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_6a112dd5-b53f-4798-94d6-22ecc2b1edc4/Rakefile:7) 
     DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /tmp/build_6a112dd5-b53f-4798-94d6-22ecc2b1edc4/Rakefile:7) 
     Asset precompilation completed (3.37s) 
-----> WARNINGS: 
     Injecting plugin 'rails_log_stdout' 
     Injecting plugin 'rails3_serve_static_assets' 
     Add 'rails_12factor' gem to your Gemfile to skip plugin injection 
     You have not declared a Ruby version in your Gemfile. 
     To set your Ruby version add this line to your Gemfile: 
     ruby '2.0.0' 
     # See https://devcenter.heroku.com/articles/ruby-versions for more information." 

Но когда я перехожу к своему application.js в heroku, файл пуст.

Update

Может быть, я не ставил это мой вопрос, но Heroku сейчас нужно:

gem 'rails_12factor', group: :production 

в Gemfile. Я в комплекте. Пока не работает.

Что мне не хватает?

+0

Что вы подразумеваете под словом «когда я иду на свое приложение.js in heroku»? –

+0

, когда я посещаю 'http: // myherokuapp.com/assets/application.js', ссылка примечания не является реальной. – juanpastas

+0

Я вижу, вы можете сначала прочитать это, чтобы понять, как работает конвейер активов http://guides.rubyonrails.org/asset_pipeline.html –

ответ

0

Вы предварительно скомпилировали свои активы: rake assets:precompile в вашем приглашении cmd перед развертыванием?

+1

нет, мне это не нужно, поскольку Heroku делает это на удаленном сервере – juanpastas

+0

no it dosnt ... обычно вы используете такие инструменты, как capistrano, чтобы сделать это перед развертыванием, если вы не используете что-то вроде capistrano вы должны прекомпилировать их вручную ... –

+0

heroku делает, см. журнал, который я вставил. – juanpastas

0

Попробуйте заменить следующее:

Bundler.require(*Rails.groups(:assets => %w(development test))) 

по

Bundler.require(:default, :assets, Rails.env) 

в файле application.rb.

Он должен выглядеть следующим образом:

if defined?(Bundler) 
    # If you precompile assets before deploying to production, use this line 
    # Bundler.require(*Rails.groups(:assets => %w(development test))) 
    # If you want your assets lazily compiled in production, use this line 
    Bundler.require(:default, :assets, Rails.env) 
end 
+0

То же самое, 'application.js' пуст в Heroku. – juanpastas

0

Либо использовать Ruby, 1.9.3 в производстве или обновить версию Rails для 3.2.14 или выше.

Старые версии Rails не очень хорошо работают с Ruby 2.0. В частности, звездочки ломаются: https://github.com/sstephenson/sprockets/issues/352

В будущем вы должны подумать о блокировке своей версии Ruby в своем Gemfile, чтобы получить тот же опыт в разработке и производстве. В вашем Gemfile добавьте:

ruby "2.0.0" 
+0

Я обязательно попробую это ... спасибо. – juanpastas

+0

Это работало для вас? – Schneems

+0

Я еще не тестировал, надеюсь, у меня есть время для этого позже. – juanpastas

Смежные вопросы