Permalink
Browse files

Add content type support and bump version to 1.0.1.

  • Loading branch information...
1 parent 3fb0a65 commit 8125f1e115b23d17894f25e341db1f6a29f7254a @samuelkadolph committed Aug 26, 2011
Showing with 7 additions and 3 deletions.
  1. +4 −1 lib/s3cmd.rb
  2. +1 −1 lib/s3cmd/version.rb
  3. +2 −1 s3cmd.gemspec
View
@@ -1,5 +1,6 @@
require "rubygems"
require "aws"
+require "mime/types"
require "proxifier/env"
require "thor"
@@ -30,9 +31,11 @@ def get(bucket, 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
View
@@ -1,3 +1,3 @@
module S3Cmd
- VERSION = "1.0.0"
+ VERSION = "1.0.1"
end
View
@@ -19,6 +19,7 @@ DESC
s.executables = ["s3cmd"]
s.add_dependency "aws", "~> 2.5.6"
- s.add_dependency "proxifier"
+ s.add_dependency "mime-types", "~> 1.16"
+ s.add_dependency "proxifier", "~> 1.0.2"
s.add_dependency "thor", "~> 0.14.6"
end

0 comments on commit 8125f1e

Please sign in to comment.