2
我寫了一個代碼來上傳s3上的文件,並且它與Ruby一起工作正常。aws/s3寶石與Jruby不兼容
我試圖運行使用JRuby相同的代碼,但我的代碼被上傳功能
步驟,我跟着
- 安裝寶石卡之前: - 的JRuby -S創業板安裝AWS-S3
- 我的代碼
require 'aws/s3' local_file = ARGV[0] bucket = ARGV[1] AWS::S3::Base.establish_connection!( access_key_id: 'put_access_key', secret_access_key: 'put_secret_access_key') base_name = File.basename(local_file) AWS::S3::S3Object.store( base_name, File.open(local_file), bucket, access: :public_read) puts 'Uploaded!' url = s3_obj.url_for( "#{local_file}", "#{bucket}", authenticated: false) puts "#{url}"
- 冉文件中像這樣 JRuby的file_name.rb upload_file_name.html鬥
嘗試AWS-SDK寶石檢查了這一點[鏈接](https://gist.github.com/IndianGuru/1194616) –