simple-s3 1.0.17 → 1.0.18

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,6 +29,10 @@ class SimpleS3
29
29
  self.config['s3_bucket_endpoint']
30
30
  end
31
31
 
32
+ def self.s3_server
33
+ self.config['s3_server']
34
+ end
35
+
32
36
  def self.cloudfront_distribution_id
33
37
  self.config['cloudfront_distribution_id']
34
38
  end
@@ -69,20 +73,26 @@ class SimpleS3
69
73
  metadata = config['metadata'] || {}
70
74
  metadata[:access] ||= 'public-read'
71
75
 
72
- endpoint = self.s3_bucket_endpoint.to_s
73
- if endpoint.length > 0
74
- puts "Simple-S3: Changing the bucket endpoint to: '#{endpoint}'"
75
- AWS::S3::DEFAULT_HOST.replace(endpoint)
76
- end
77
-
78
76
  files = self.get_files(config)
79
77
 
80
78
  raise 'Simple-S3: No files found' if files.length == 0
81
79
 
82
- AWS::S3::Base.establish_connection!(
80
+ s3_options = {
83
81
  :access_key_id => self.s3_access_key,
84
82
  :secret_access_key => self.s3_secret_key
85
- )
83
+ }
84
+
85
+ endpoint = self.s3_bucket_endpoint.to_s
86
+ if endpoint.length > 0
87
+ puts "Simple-S3: Changing the bucket endpoint to: '#{endpoint}'"
88
+ s3_options[:server] = endpoint
89
+ end
90
+
91
+ begin
92
+ AWS::S3::Base.establish_connection!(s3_options)
93
+ rescue Exception => e
94
+ raise 'Simple-S3: Unable to establish connection to AWS (this may because of an invalid bucket name)'
95
+ end
86
96
 
87
97
  files.each do |file|
88
98
  path = File.expand_path(file)
@@ -1,3 +1,3 @@
1
1
  class SimpleS3
2
- VERSION = "1.0.17"
2
+ VERSION = "1.0.18"
3
3
  end
data/make_gem.sh ADDED
@@ -0,0 +1,4 @@
1
+ rm ./*.gem
2
+ gem build simple-s3.gemspec
3
+ mv ./simple-s3*.gem ./simple-s3.gem
4
+ gem push simple-s3.gem
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 17
9
- version: 1.0.17
8
+ - 18
9
+ version: 1.0.18
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matias Niemela
@@ -45,6 +45,7 @@ files:
45
45
  - lib/simple-s3.rb
46
46
  - lib/simple-s3/simple-s3.rb
47
47
  - lib/simple-s3/version.rb
48
+ - make_gem.sh
48
49
  - simple-s3.gemspec
49
50
  has_rdoc: true
50
51
  homepage: https://github.com/yearofmoo/simple-s3