thoughtbot / cocaine

A small library for doing (command) lines.
https://robots.thoughtbot.com
Other
785 stars 55 forks source link

cocaine adds [0] at the end of the command #84

Closed casertap closed 9 years ago

casertap commented 9 years ago

I'm using paperclip 4.2.1, cocaine 0.5.7 I get this command executed:

[INFO ] Command :: PATH=/usr/local/bin/ffmpeg:$PATH; file -b --mime '/var/folders/43/t8s11k6d145c4wtwfpnbxh640000gn/T/56cf3d660d43b439e0cc2106d426e71320150410-32412-eq25u1.png'
[INFO ] Command :: PATH=/usr/local/bin/ffmpeg:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/43/t8s11k6d145c4wtwfpnbxh640000gn/T/56cf3d660d43b439e0cc2106d426e71320150410-32412-qpsg0.png[0]' 2>/dev/null
[INFO ] [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
[INFO ] Command :: PATH=/usr/local/bin/ffmpeg:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/43/t8s11k6d145c4wtwfpnbxh640000gn/T/56cf3d660d43b439e0cc2106d426e71320150410-32412-qpsg0.png[0]' 2>/dev/null
[INFO ] [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
[INFO ] Command :: PATH=/usr/local/bin/ffmpeg:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/43/t8s11k6d145c4wtwfpnbxh640000gn/T/56cf3d660d43b439e0cc2106d426e71320150410-32412-qpsg0.png[0]' 2>/dev/null
[INFO ] [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
#<Paperclip::Attachment:0x007fda88fde4f8 @name=:profile_picture, @instance=#<User id: nil, email: "32d24291254fb931d035651123b0191d@club.com", encrypted_password: "$2a$10$...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: nil, updated_at: nil, firstname: "Golf", lastname: nil, profile_picture_file_name: "Capture_d’écran_2014-03-13_à_16.42.58.png", profile_picture_content_type: "image/png", profile_picture_file_size: 14077, profile_picture_updated_at: "2015-04-10 08:12:35", cover_picture_file_name: nil, cover_picture_content_type: nil, cover_picture_file_size: nil, cover_picture_updated_at: nil, provider: nil, uid: nil, username: nil, oauth_token: nil, oauth_secret: nil, oauth_expires_at: nil, city: nil, country_id: nil, from_country_id: nil, club_id: 12643, handicap: nil, work: nil, admin: false, points: 0, latitude: nil, longitude: nil, job: nil, sex: nil, authentication_token: nil, enable_notifications: true, agency_id: nil, birthdate: nil, notification_token: nil, mixpanel_distinct_id: nil, slug: nil, is_club: true>, @options={:convert_options=>{}, :default_style=>:original, :default_url=>"/:attachment/:style/missing.png", :escape_url=>true, :restricted_characters=>/[&$+,\/:;=?@<>\[\]\{\}\|\\\^~%# ]/, :filename_cleaner=>nil, :hash_data=>":class/:attachment/:id/:style/:updated_at", :hash_digest=>"SHA1", :interpolator=>Paperclip::Interpolations, :only_process=>[], :path=>":rails_root/public:url", :preserve_files=>false, :processors=>[:thumbnail], :source_file_options=>{}, :storage=>:filesystem, :styles=>{:thumb=>"50x50#", :fit=>"250x250#", :resized=>"600x600>"}, :url=>"/system/:class/:attachment/:id_partition/:style/:filename", :url_generator=>Paperclip::UrlGenerator, :use_default_time_zone=>true, :use_timestamp=>true, :whiny=>true, :validate_media_type=>true, :check_validity_before_processing=>true}, @post_processing=true, @queued_for_delete=[], @queued_for_write={:original=>Paperclip::AttachmentAdapter: Capture_d’écran_2014-03-13_à_16.42.58.png}, @errors={:processing=>["Paperclip::Errors::NotIdentifiedByImageMagickError", "Paperclip::Errors::NotIdentifiedByImageMagickError", "Paperclip::Errors::NotIdentifiedByImageMagickError"]}, @dirty=true, @interpolator=Paperclip::Interpolations, @url_generator=#<Paperclip::UrlGenerator:0x007fda88fde318 @attachment=#<Paperclip::Attachment:0x007fda88fde4f8 ...>, @attachment_options={:convert_options=>{}, :default_style=>:original, :default_url=>"/:attachment/:style/missing.png", :escape_url=>true, :restricted_characters=>/[&$+,\/:;=?@<>\[\]\{\}\|\\\^~%# ]/, :filename_cleaner=>nil, :hash_data=>":class/:attachment/:id/:style/:updated_at", :hash_digest=>"SHA1", :interpolator=>Paperclip::Interpolations, :only_process=>[], :path=>":rails_root/public:url", :preserve_files=>false, :processors=>[:thumbnail], :source_file_options=>{}, :storage=>:filesystem, :styles=>{:thumb=>"50x50#", :fit=>"250x250#", :resized=>"600x600>"}, :url=>"/system/:class/:attachment/:id_partition/:style/:filename", :url_generator=>Paperclip::UrlGenerator, :use_default_time_zone=>true, :use_timestamp=>true, :whiny=>true, :validate_media_type=>true, :check_validity_before_processing=>true}>, @source_file_options={}, @whiny=true, @normalized_styles={:thumb=>#<Paperclip::Style:0x007fda81732dd8 @name=:thumb, @attachment=#<Paperclip::Attachment:0x007fda88fde4f8 ...>, @geometry="50x50#", @format=nil, @other_args={}>, :fit=>#<Paperclip::Style:0x007fda81732c20 @name=:fit, @attachment=#<Paperclip::Attachment:0x007fda88fde4f8 ...>, @geometry="250x250#", @format=nil, @other_args={}>, :resized=>#<Paperclip::Style:0x007fda81732b08 @name=:resized, @attachment=#<Paperclip::Attachment:0x007fda88fde4f8 ...>, @geometry="600x600>", @format=nil, @other_args={}>}, @file=Paperclip::AttachmentAdapter: Capture_d’écran_2014-03-13_à_16.42.58.png>

You can see the [0] at the end of: 56cf3d660d43b439e0cc2106d426e71320150410-32412-qpsg0.png[0]

I think that is the cause of the following error:

ActiveRecord::RecordInvalid - Validation failed: Profile picture Paperclip::Errors::NotIdentifiedByImageMagickError, Profile picture Paperclip::Errors::NotIdentifiedByImageMagickError, Profile picture Paperclip::Errors::NotIdentifiedByImageMagickError:
  activerecord (4.1.9) lib/active_record/validations.rb:57:in `save!'
jyurek commented 9 years ago

This is actually a paperclip option for dealing with animated GIFs. If you don't want animation, set animated: false in the options you use when creating the attachment. See https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/thumbnail.rb#L79 for the implementation of this.