关于CI的Rails资产预编译问题

时间:2014-10-11 04:37:41

标签: ruby-on-rails gem continuous-integration jasmine sprockets

Rails 4.1.6,Ruby 2.1。我们使用CircleCI,到目前为止它一直很好用。在开发方面,我们的应用程序运行良好,但今天在CircleCI上出现了一个问题,我不知道如何解决问题。有人可以帮忙吗?

昨天我更新了我们的宝石,但直到今天我们都没有遇到任何问题(可能还有一些缓存?)。我一次又一次地重建了构建版本(同时选择了清除缓存的选项,但仍然没有成功),错误仍然存​​在。

我相信所有的测试都通过了,但这里是错误开始的地方:

I, [2014-10-11T04:14:07.529348 #9596]  INFO -- : Writing /home/ubuntu/my-app-name/public/assets/jasmine/grunt/templates/SpecRunner-af60bb7e74338e42129e060a5ef78fcc.html
rake aborted!
NameError: undefined local variable or method `jasmine_version' for #<#<Class:0x00000002b8b1e8>:0x0000000d8e6540>
  (in /home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/rails-assets-jasmine-2.0.0/app/assets/templates/jasmine/src/templates/example_project_jasmine_tags.html.erb)
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/rails-assets-jasmine-2.0.0/app/assets/templates/jasmine/src/templates/example_project_jasmine_tags.html.erb:1:in `block in singleton class'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/rails-assets-jasmine-2.0.0/app/assets/templates/jasmine/src/templates/example_project_jasmine_tags.html.erb:-5:in `instance_eval'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/rails-assets-jasmine-2.0.0/app/assets/templates/jasmine/src/templates/example_project_jasmine_tags.html.erb:-5:in `singleton class'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/rails-assets-jasmine-2.0.0/app/assets/templates/jasmine/src/templates/example_project_jasmine_tags.html.erb:-7:in `__tilt_5657380'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `call'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:170:in `evaluate'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/processed_asset.rb:12:in `initialize'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `new'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `block in build_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:395:in `circular_call_protection'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:373:in `build_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `new'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/non-stupid-digest-assets-1.0.4/lib/non-stupid-digest-assets.rb:31:in `compile_with_non_digest'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.1.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/home/ubuntu/my-app-name/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.1.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace) bundle exec rake assets:precompile returned exit code 1bundle exec rake assets:precompile returned exit code 1bundle exec rake assets:precompile returned exit code 1bundle exec rake assets:precompile returned exit code 1

2 个答案:

答案 0 :(得分:0)

我不确定这里发生了什么,但可能是由于你的Gemfile中有错误的gem组。尝试从:development:test等任何群组中取出茉莉花宝石,并将其与所有环境所需的宝石放在一起。

答案 1 :(得分:0)

我认为这可能是更新宝石的问题。我们做了宝石更新,Jasmine Core的版本固定为2.0.0,而Jasmine的版本从2.0.2更新到2.0.3。当然,我确实更新了许多其他宝石,我浏览了Gemfile并删除了一些版本规范。

此外,在我们的circle.yml文件中,我们的pre任务包括:

bundle exec rake assets:clobber
bundle exec rake tmp:clear
bundle exec rake assets:precompile

这些最初是因为我们遇到的一些早期问题而添加的。我删除了这些。

我也猜测CircleCI正在使用缓存的宝石,所以问题没有立即出现。

无论如何,这似乎解决了这个问题。