Class: Shenzhen::Plugins::S3::Client
- Inherits:
-
Object
- Object
- Shenzhen::Plugins::S3::Client
- Defined in:
- lib/shenzhen/plugins/s3.rb
Instance Method Summary collapse
-
#initialize(access_key_id, secret_access_key, region) ⇒ Client
constructor
A new instance of Client.
- #upload_build(ipa, options) ⇒ Object
Constructor Details
#initialize(access_key_id, secret_access_key, region) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 |
# File 'lib/shenzhen/plugins/s3.rb', line 6 def initialize(access_key_id, secret_access_key, region) @s3 = AWS::S3.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key, :region => region) end |
Instance Method Details
#upload_build(ipa, options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/shenzhen/plugins/s3.rb', line 12 def upload_build(ipa, ) path = (ipa, [:path]) if [:path] @s3.buckets.create([:bucket]) if [:create] bucket = @s3.buckets[[:bucket]] uploaded_urls = [] files = [] files << ipa files << [:dsym] if [:dsym] files.each do |file| basename = File.basename(file) key = path ? File.join(path, basename) : basename File.open(file) do |descriptor| obj = bucket.objects.create(key, descriptor, :acl => [:acl]) uploaded_urls << obj.public_url.to_s end end uploaded_urls end |