Sha256: 5e26fa0ffe27acdd948e8f462d57802063557693820ac2cea91ace423930197c

Contents?: true

Size: 926 Bytes

Versions: 2

Compression:

Stored size: 926 Bytes

Contents

# S3 (http://amazon.rubyforge.org/)
UTILITY_BELT_IRB_STARTUP_PROCS[:define_s3_convenience_methods] = lambda do
  %w{aws/s3 cgi}.each {|lib| require lib}
  def aws_upload(bucket,filename)
    AWS::S3::Base.establish_connection!(:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'], 
                                        :secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY'])
    AWS::S3::S3Object.store(filename, open(filename), bucket, :access => :public_read)
    url = "http://s3.amazonaws.com/#{bucket}/#{filename}".gsub(/ /, "%20")
    MacClipboard.write(url) if :macosx == Platform::IMPL
    url
  end
end

# a quick note: the "google" command uses CGI.escape, but the URLs produced by CGI.escape
# don't seem to succeed here, in practice. this may differ by OS and/or browser. Let me
# know if you see something weird -- the Utility Belt mailing list is here:
#
# http://rubyforge.org/mailman/listinfo/utilitybelt-tinkering

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
utility_belt-1.0.6 lib/amazon_upload_shortcut.rb
utility_belt-1.0.5 lib/amazon_upload_shortcut.rb