Class: S3::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ios3/s3.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_key_id, secret_access_key, region) ⇒ Client

Returns a new instance of Client.



28
29
30
31
32
# File 'lib/ios3/s3.rb', line 28

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



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ios3/s3.rb', line 34

def upload_build(ipa, options)
  # path = expand_path_with_substitutions_from_ipa_plist(ipa, options[:path]) if options[:path]

  # @s3.buckets.create(options[:bucket]) if options[:create]

  bucket = @s3.buckets[options[:bucket]]

  files = []
  files << ipa
  # files << options[:dsym] if options[:dsym]
  files.each do |file|
    basename = File.basename(file)
    key = path ? File.join(path, basename) : basename
    File.open(file) do |descriptor|
      bucket.objects.create(key, descriptor, :acl => options[:acl])
    end
  end
end