Class: Xcode::Deploy::S3
- Inherits:
-
Object
- Object
- Xcode::Deploy::S3
- Defined in:
- lib/xcode/deploy/s3.rb
Instance Method Summary collapse
- #bucket ⇒ Object
- #deploy ⇒ Object
-
#initialize(builder, options) ⇒ S3
constructor
A new instance of S3.
- #upload(path) ⇒ Object
Constructor Details
#initialize(builder, options) ⇒ S3
Returns a new instance of S3.
7 8 9 10 |
# File 'lib/xcode/deploy/s3.rb', line 7 def initialize(builder, ) @builder = builder @options = end |
Instance Method Details
#bucket ⇒ Object
12 13 14 15 16 17 |
# File 'lib/xcode/deploy/s3.rb', line 12 def bucket return @bucket unless @bucket.nil? s3 = AWS::S3.new @options @bucket = s3.buckets.create(@options[:bucket]) rescue s3.buckets[@options[:bucket]] @bucket end |
#deploy ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/xcode/deploy/s3.rb', line 26 def deploy remote_ipa = upload @builder.ipa_path base_url = remote_ipa.public_url(:secure => false).to_s.split("/")[0..-2].join("/") WebAssets.generate @builder, base_url do |dir| Dir["#{dir}/*"].each do |path| upload path end end end |
#upload(path) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/xcode/deploy/s3.rb', line 19 def upload(path) obj_path = File.join(@options[:dir]||'', File.basename(path)) puts "Uploading #{path} => #{bucket.name}/#{obj_path}" bucket.objects[obj_path]. write(File.open(path), :acl => :public_read) end |