'需要'rmagick'和'需要RMagick'之间的区别(Mac vs Debian) [英] Difference between 'require 'rmagick' and 'require RMagick' (Mac vs Debian)

查看:139
本文介绍了'需要'rmagick'和'需要RMagick'之间的区别(Mac vs Debian)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mac Pro Lion来开发ImageMagick Q16,RVM和ruby 1.8.7



我可以在IRB中使用以下内容:



在rmagick一词的不同大写上注意



  require'rubygems '
=> true
require'rmagick'
=> true
需要RMagick
LoadError:没有这样的文件加载 - RMmagick

在我的Debian Squeeze 6.0生产服务器上使用ImageMagick Q16,RVM和ruby 1.8.7



我可以在IRB中使用以下内容:

  require'rubygems'
=> true
require'rmagick'
LoadError:没有这样的文件加载 - rmagick
需要'RMagick'
=> true

'gem list'显示在两个操作系统的小写。

  rmagick(2.13.1)

我想知道这个问题的根源?



如果宝石的大小写(如宝石列表中所示)不等于 require'some_gem'

解决方案

这个的根本原因是默认情况下,Mac OS X上的文件系统不区分大小写。您可以快速测试以确认是否需要在命令行中。

  touch testcase 
touch Testcase
ls

如果你只看到一个testcase文件,那么你可能在一个不区分大小写的fs。或者,您可以执行以下操作:

  diskutil info / 

在结果中,如果您看到

 文件系统个性:日志HFS + 

而不是

 文件系统个性:区分大小写日志HFS +。 

那么你的大小写不敏感。如果你不那么敏感,那么这就允许你离开,要求RMagick或rmagick或任何其他大写字母模式。作为
Cameron指出您的包含大写的lib文件参见: https://github.com/rmagick/rmagick/blob/master/lib/RMagick.rb 这意味着当您使用区分大小写的fs时,您将不得不

  require'RMagick'

as

  require'rmagick'

寻找一个不存在的文件。



我看到很多问题,特别是如果你的git repo有两个文件相同名称和不同的情况在同一个文件夹(对我来说,这导致git总是报告未提交的更改)。为了我的价值,我使用磁盘实用程序来创建我安装并用于开发的区分大小写的磁盘映像。这样我就可以将默认的情况下的fs保留到位,并避免这样的麻烦问题。


I'm using a Mac pro Lion for development with ImageMagick Q16, RVM and ruby 1.8.7

I can use the following in IRB:

Take note on the different caps in the word 'rmagick'

require 'rubygems'
=> true 
require 'rmagick'
=> true 
require 'RMagick'
LoadError: no such file to load -- RMmagick

On my Debian Squeeze 6.0 production server with ImageMagick Q16, RVM and ruby 1.8.7

I can use the following in IRB:

require 'rubygems'
=> true 
require 'rmagick'
LoadError: no such file to load -- rmagick 
require 'RMagick'
=> true

'gem list' shows on both OS's in lowercase.

rmagick (2.13.1)

I would like to know the root of this problem?

Should the capitalisation of the gems (as shown in the gem list) not be the same as in the require 'some_gem'

解决方案

The root cause of this it that the filesystem on Mac OS X is case insensitive by default. You can do a quick test to confirm this if you want on the command line.

touch testcase
touch Testcase
ls

If you only see only one testcase file then your probably on a case insensitive fs. Alternatively you can do something like:

diskutil info /

In the result if you see

File System Personality: Journaled HFS+ 

and not

File System Personality: Case-sensitive Journaled HFS+.

then your case insensitive. If your insensitive then that is what allows you to get away with requiring 'RMagick' or 'rmagick' or any other capitalization pattern. As Cameron points out the lib file that your including is capitalized see: https://github.com/rmagick/rmagick/blob/master/lib/RMagick.rb This means that when you are on a case sensitive fs you will have to

require 'RMagick'

as

require 'rmagick'

looks for a file that does not exist.

I have seen a lot of issues with this especially if your git repo has two files with the same name and different cases in the same folder (for me this results in git always reporting uncommitted changes). For what its worth I used disk utility to create case sensitive disk image that I mount and use for development. That way I can leave the default case insensitive fs in place and avoid annoying issues like this.

这篇关于'需要'rmagick'和'需要RMagick'之间的区别(Mac vs Debian)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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