6

由于我安装了 rmagick gem,因此在每个 rails 或 rake 命令之后都会收到以下警告列表:

/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:44: warning: already initialized constant PercentGeometry
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:45: warning: already initialized constant AspectGeometry
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:46: warning: already initialized constant LessGeometry
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:47: warning: already initialized constant GreaterGeometry
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:48: warning: already initialized constant AreaGeometry
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:49: warning: already initialized constant MinimumGeometry
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:52: warning: already initialized constant FLAGS
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:53: warning: already initialized constant RFLAGS
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:92: warning: already initialized constant W
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:93: warning: already initialized constant H
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:94: warning: already initialized constant X
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:95: warning: already initialized constant Y
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:96: warning: already initialized constant RE
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:147: warning: already initialized constant ALIGN_TYPE_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:152: warning: already initialized constant ANCHOR_TYPE_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:157: warning: already initialized constant DECORATION_TYPE_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:163: warning: already initialized constant FONT_WEIGHT_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:170: warning: already initialized constant GRAVITY_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:181: warning: already initialized constant PAINT_METHOD_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:188: warning: already initialized constant STRETCH_TYPE_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:200: warning: already initialized constant STYLE_TYPE_NAMES
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:673: warning: already initialized constant Model_Version
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:674: warning: already initialized constant Destination
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:675: warning: already initialized constant File_Format
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:676: warning: already initialized constant File_Format_Version
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:677: warning: already initialized constant Service_Identifier
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:678: warning: already initialized constant Envelope_Number
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:679: warning: already initialized constant Product_ID
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:680: warning: already initialized constant Envelope_Priority
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:681: warning: already initialized constant Date_Sent
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:682: warning: already initialized constant Time_Sent
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:683: warning: already initialized constant Coded_Character_Set
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:684: warning: already initialized constant UNO
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:685: warning: already initialized constant Unique_Name_of_Object
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:686: warning: already initialized constant ARM_Identifier
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:687: warning: already initialized constant ARM_Version
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:691: warning: already initialized constant Record_Version
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:692: warning: already initialized constant Object_Type_Reference
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:693: warning: already initialized constant Object_Name
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:694: warning: already initialized constant Title
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:695: warning: already initialized constant Edit_Status
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:696: warning: already initialized constant Editorial_Update
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:697: warning: already initialized constant Urgency
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:698: warning: already initialized constant Subject_Reference
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:699: warning: already initialized constant Category
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:700: warning: already initialized constant Supplemental_Category
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:701: warning: already initialized constant Fixture_Identifier
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:702: warning: already initialized constant Keywords
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:703: warning: already initialized constant Content_Location_Code
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:704: warning: already initialized constant Content_Location_Name
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:705: warning: already initialized constant Release_Date
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:706: warning: already initialized constant Release_Time
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:707: warning: already initialized constant Expiration_Date
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:708: warning: already initialized constant Expiration_Time
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:709: warning: already initialized constant Special_Instructions
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:710: warning: already initialized constant Action_Advised
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:711: warning: already initialized constant Reference_Service
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:712: warning: already initialized constant Reference_Date
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:713: warning: already initialized constant Reference_Number
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:714: warning: already initialized constant Date_Created
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:715: warning: already initialized constant Time_Created
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:716: warning: already initialized constant Digital_Creation_Date
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:717: warning: already initialized constant Digital_Creation_Time
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:718: warning: already initialized constant Originating_Program
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:719: warning: already initialized constant Program_Version
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:720: warning: already initialized constant Object_Cycle
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:721: warning: already initialized constant By_Line
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:722: warning: already initialized constant Author
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:723: warning: already initialized constant By_Line_Title
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:724: warning: already initialized constant Author_Position
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:725: warning: already initialized constant City
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:726: warning: already initialized constant Sub_Location
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:727: warning: already initialized constant Province
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:728: warning: already initialized constant State
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:729: warning: already initialized constant Country_Primary_Location_Code
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:730: warning: already initialized constant Country_Primary_Location_Name
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:731: warning: already initialized constant Original_Transmission_Reference
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:732: warning: already initialized constant Headline
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:733: warning: already initialized constant Credit
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:734: warning: already initialized constant Source
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:735: warning: already initialized constant Copyright_Notice
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:736: warning: already initialized constant Contact
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:737: warning: already initialized constant Abstract
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:738: warning: already initialized constant Caption
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:739: warning: already initialized constant Editor
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:740: warning: already initialized constant Caption_Writer
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:741: warning: already initialized constant Rasterized_Caption
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:742: warning: already initialized constant Image_Type
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:743: warning: already initialized constant Image_Orientation
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:744: warning: already initialized constant Language_Identifier
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:745: warning: already initialized constant Audio_Type
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:746: warning: already initialized constant Audio_Sampling_Rate
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:747: warning: already initialized constant Audio_Sampling_Resolution
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:748: warning: already initialized constant Audio_Duration
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:749: warning: already initialized constant Audio_Outcue
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:750: warning: already initialized constant ObjectData_Preview_File_Format
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:751: warning: already initialized constant ObjectData_Preview_File_Format_Version
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:752: warning: already initialized constant ObjectData_Preview_Data
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:756: warning: already initialized constant Size_Mode
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:757: warning: already initialized constant Max_Subfile_Size
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:758: warning: already initialized constant ObjectData_Size_Announced
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:759: warning: already initialized constant Maximum_ObjectData_Size
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:763: warning: already initialized constant Subfile
/Users/joel/.rvm/gems/ruby-1.9.2-p290/gems/rmagick-2.13.1/lib/RMagick.rb:767: warning: already initialized constant Confirmed_ObjectData_Size

有这方面的线索吗?

更新

我的宝石文件:

 gem "rmagick", "~> 2.13.1"
 gem 'link_thumbnailer'
4

2 回答 2

28

rmagick您可以将Gemfile相应的行替换为:

gem 'rmagick', require: false
于 2014-04-03T15:49:12.577 回答
5

重新初始化常量的原因很可能是因为rmagickgem 被加载了两次:一次是link_thumbnailer(在您的 Gemfile 中)的依赖项,一次是因为您将 'rmagick' 明确列为 Gemfile 要求。

尝试rmagick从您的 Gemfile 中删除该条目,只要您正在使用它就会被加载link_thumbnailer

于 2012-12-11T23:15:52.870 回答