2012-10-24 18 views
11

Ich habe gerade von einem Büroklammerschienen-Plugin auf eine Büroklammer Juwel umgeschaltet. Das Projekt ist eine Rails 2.3 Anwendung und ich benutze Büroklammer 2.7.2 gem.Büroklammer Datei nicht gefunden Fehler

Ich erhalte die folgenden ungeradeen Fehler:

identify: unable to open image `file': No such file or directory @ error/blob.c/OpenBlob/2617. 
identify: no decode delegate for this image format `file' @ error/constitute.c/ReadImage/544. 

Scheint, wie Büroklammer für eine Datei mit dem Namen ‚Datei‘ aus, aber ich bin nicht sicher, warum. Ich habe den Code, den wir vorher hatten, nicht geändert. Es hat funktioniert, ich habe nur auf eine neuere Version upgegradet und ein Juwel über ein Plugin benutzt.

Irgendwelche Ideen?

aktualisiert

Es ist ein Fehler in Büroklammer zu sein, wo es nicht um den Inhalt des Befehls richtig funktioniert analysieren. Ich grub tief in die Büroklammer Quelle zu finden:

def run(cmd, arguments = "", local_options = {}) 
    if options[:image_magick_path] 
    Paperclip.log("[DEPRECATION] :image_magick_path is deprecated and will be removed. Use :command_path instead") 
    end 
    command_path = options[:command_path] || options[:image_magick_path] 
    Cocaine::CommandLine.path = [Cocaine::CommandLine.path, command_path].flatten.compact.uniq 
    local_options = local_options.merge(:logger => logger) if logging? && (options[:log_command] || local_options[:log_command]) 

    Cocaine::CommandLine.new(cmd, arguments, local_options).run 
end 

und

# Uses ImageMagick to determing the dimensions of a file, passed in as either a 
# File or path. 
# NOTE: (race cond) Do not reassign the 'file' variable inside this method as it is likely to be 
# a Tempfile object, which would be eligible for file deletion when no longer referenced. 
def self.from_file file 
    file_path = file.respond_to?(:path) ? file.path : file 
    raise(Paperclip::NotIdentifiedByImageMagickError.new("Cannot find the geometry of a file with a blank name")) if file_path.blank? 
    geometry = begin 
       Paperclip.run("identify", "-format %wx%h :file", :file => "#{file_path}[0]") 
      rescue Cocaine::ExitStatusError 
       "" 
      rescue Cocaine::CommandNotFoundError => e 
       raise Paperclip::CommandNotFoundError.new("Could not run the `identify` command. Please install ImageMagick.") 
      end 
    parse(geometry) || 
    raise(NotIdentifiedByImageMagickError.new("#{file_path} is not recognized by the 'identify' command.")) 
end 

Der Paperclip.run Befehl schlägt fehl, die ersetzt werden: Datei-Platzhalter aus irgendeinem Grund. Ich überprüfte dies durch die folgende auf der Kommandozeile ausgeführt wird:

identify :file 

Affe Patchen den Ersatz von Hand Ausbeuten andere Fehler, bei denen eine ähnliche Sache passiert.

Antwort

23

Ok, ich habe es gelöst.

Es war ein Problem mit Kokain. Es scheint, dass Büroklammer eine Abhängigkeit von Kokain hat, die nur besagt, dass es Cociane> 0,02 sein muss. Die neueste Version von Cocaine 0.4.2 (zum Zeitpunkt der Erstellung) hat eine neue API, die nicht abwärtskompatibel ist. Sie müssen auf Kokain 0.3.2 herabstufen.

Einfach gesagt dies in Ihrem Gemfile vor Büroklammer:

gem "cocaine", "0.3.2" 
+2

Mann, können Sie den Tag für mich gerettet :) – emilsw

+7

Anstatt Kokain in Ihrem gemfile angeben, können Sie Ihre Büroklammer Version 2.7.4 stoßen zu beheben Das auch. – Peter

+0

super Kerl ,! :) – user566245