ImageScience 在更新到 Rails 3 时中断 [英] ImageScience breaks on update to Rails 3

查看:45
本文介绍了ImageScience 在更新到 Rails 3 时中断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作(并且运行良好)ImageScience 安装,它对图像的各种尺寸做了一些简单的调整,然后将它们复制到不同的目录.一切都非常简单.这个小而简单的例程是在一个耙子任务中.更新到 Rails 3 后,这个 rake 任务仍然可以工作(它也会执行一些 AR 插入和音频编码),但是 image_science 需要失败并显示这样的消息,

I had a working (and working well) ImageScience install, that did some simple resizing to various dimensions of images, and then copying them to different directories. All very simple. This small and simple routine was in a rake task. Upon update to Rails 3, this rake task will still work (it does some AR inserts and audio encoding as well), but the image_science require fails with a message like this,

要求/home//.ruby_inline/Inline_ImageScience_cdab.so 失败"

"require on /home//.ruby_inline/Inline_ImageScience_cdab.so failed"

我已经排除了安装 duff ImageScience 的可能性,因为我可以进入 IRB 并对 ImageScience 进行一些简单的调用并制作缩略图.如果我注释掉任何提及需要image_science"或 ImageScience 例程的内容,则 rake 任务的其余部分会像以前一样正常工作.

I've ruled out a duff ImageScience install, as I can go into IRB and do some simple calls to ImageScience and make thumbnails. The remainder of the rake task works as well as it did before if I comment out any mention of requiring 'image_science' or the ImageScience routine.

rake 失败时的输出是这样的,

the output from rake on failure is this,

/var/lib/gems/1.8/gems/RubyInline-3.8.6/lib/inline.rb:513:in `load'
/var/lib/gems/1.8/gems/RubyInline-3.8.6/lib/inline.rb:829:in `inline'
/var/lib/gems/1.8/gems/image_science-1.2.1/lib/image_science.rb:90
...
<active_support complaints >
...
/home/<user>/RailsApps/marlow/lib/tasks/flac_import.rake:2
...
<rails complaints>
...
/home/<user>/RailsApps/marlow/Rakefile:7
...
<standard complaints to end>

rails 应用程序根目录中的 Rakefile 是一个标准的 Rails 3 Rakefile,就像这样,

the Rakefile in the rails app root is a stock and standard Rails 3 Rakefile, like this,

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

Marlow::Application.load_tasks

最后一行是第 7 行.

the last line is line 7.

我有点不明白是什么破坏了它,而 Google 似乎没有脱落任何东西.有谁知道为什么 RubyInline 会抱怨?或者为什么这个曾经有效的 Rake 任务突然对 ImageScience 的调用方式感到不满?操作系统是 Ubuntu 10.10,但在 Rails 3 升级之前一切正常.

I'm kind of stumped as to what's breaking it, and Google doesn't seem to shed anything. Does anyone know why RubyInline is complaining? Or why this once working Rake task is suddenly unhappy how ImageScience is being called? OS is Ubuntu 10.10, but it was all working prior to the Rails 3 upgrade.

提前致谢

推荐答案

这似乎是问题所在,但我通过阅读 carlhuda 问题 431

This does seem to be the problem, but there is a simpler fix I found from perusing the comments at carlhuda issues 431

我遇到了同样的问题,它对我有用.只需将 require 方法更改为 Kernel.require.

I had the same problem and it worked for me. Simply change the require method to be Kernel.require.

此后,您的代码无需使用 require image_science 语句.

After that there's no need to pepper your code with require image_science statements.

这篇关于ImageScience 在更新到 Rails 3 时中断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆