lib/s3cmd.rb in s3cmd-1.0.0 vs lib/s3cmd.rb in s3cmd-1.0.1

- old
+ new

@@ -1,7 +1,8 @@ require "rubygems" require "aws" +require "mime/types" require "proxifier/env" require "thor" module S3Cmd require "s3cmd/version" @@ -28,12 +29,14 @@ bucket = s3.bucket(bucket) $stdout << bucket.get(key) end desc "put bucket key file", "puts a file for the key in the bucket" + method_option :type, :desc => "override the content type of the file", :type => :string def put(bucket, key, file) bucket = s3.bucket(bucket) - File.open(file, "r") { |f| bucket.put(key, f) } + type = options[:type] || MIME::Types.of(file).first.to_s + File.open(file, "r") { |f| bucket.put(key, f, {}, nil, { "content-type" => type }) } end private def s3 @s3 ||= begin