capriza-aws 0.0.14 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/capriza-aws.rb CHANGED
@@ -3,6 +3,7 @@ require 'rubygems'
3
3
  require 'yaml'
4
4
  require 'json'
5
5
  require 'aws-sdk'
6
+ require 'find'
6
7
 
7
8
  module Capriza
8
9
  module Aws
@@ -83,25 +84,24 @@ module Capriza
83
84
  end
84
85
 
85
86
  end
86
- class S3upload
87
- def initialize(bucket, folder_name, config, make_public = false)
88
- S3connect.new(config)
89
- s3 = AWS::S3.new()
90
87
 
91
- b = s3.buckets[bucket]
92
88
 
93
- Dir.foreach(folder_name) do |item|
94
- next if item == '.' or item == '..'
89
+ class S3Upload
95
90
 
96
- basename = File.basename(item)
97
- o = b.objects[basename]
98
- o.write(:file => item)
99
- o.acl = :public_read if make_public
100
- puts item
91
+ def initialize(options = {})
92
+ AWS.config(options[:config])
93
+ @s3 = AWS::S3.new()
94
+ @options = options
95
+ end
101
96
 
102
- end
97
+ def upload
98
+ Find.find(@options[:dir]).each { |file| @s3.buckets[@options[:bucket]].objects[file].write(File.read(file), @options[:file_options] || {} ) unless File.directory?(file) }
99
+ end
103
100
 
101
+ def delete
102
+ @s3.buckets[@options[:bucket]].objects.with_prefix(@options[:dir] + '/').delete_all
104
103
  end
104
+
105
105
  end
106
106
 
107
107
  end
@@ -1,5 +1,5 @@
1
1
  module Capriza
2
2
  module Aws
3
- VERSION = "0.0.14"
3
+ VERSION = "0.0.15"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capriza-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-13 00:00:00.000000000 Z
12
+ date: 2013-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -67,3 +67,4 @@ signing_key:
67
67
  specification_version: 3
68
68
  summary: AWS Helper Files
69
69
  test_files: []
70
+ has_rdoc: