simple-s3 1.0.13 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
1
  .DS_Store
2
+ *.gem
data/README.md CHANGED
@@ -4,7 +4,14 @@ A super simple uploader for S3 using Ruby.
4
4
 
5
5
  ## Installation
6
6
 
7
- Install as a gem using `gem install simple-s3`.
7
+ Install as a gem using `gem install simple-s3` or place a `Gemfile` within your website directory with the following info:
8
+
9
+ ```gemfile
10
+ source :rubygems
11
+ gem "simple-s3"
12
+ ```
13
+
14
+ Then run `bundle install` or `rvmsudo bundle install` if you're using **RVM**.
8
15
 
9
16
  ## Usage
10
17
 
data/bin/simple-s3 CHANGED
File without changes
data/lib/simple-s3.rb CHANGED
@@ -5,6 +5,7 @@ require 'digest/md5'
5
5
  require 'digest/sha1'
6
6
  require 'net/https'
7
7
  require 'base64'
8
+ puts "doing it"
8
9
 
9
10
  %w{simple-s3 version}.each do |file|
10
11
  require File.dirname(__FILE__) + "/simple-s3/#{file}"
@@ -25,6 +25,10 @@ class SimpleS3
25
25
  self.config['s3_bucket']
26
26
  end
27
27
 
28
+ def self.s3_endpoint
29
+ self.config['s3_endpoint']
30
+ end
31
+
28
32
  def self.cloudfront_distribution_id
29
33
  self.config['cloudfront_distribution_id']
30
34
  end
@@ -34,16 +38,10 @@ class SimpleS3
34
38
  self.invalidate!
35
39
  end
36
40
 
37
- def self.upload!
38
- bucket = self.s3_bucket
39
- raise 'Simple-S3: Bucket not defined' if bucket.length == 0
40
-
41
- exclude = config['exclude_files'] || []
41
+ def self.get_files(config)
42
+ exclude = config['exclude_files'] || []
42
43
  exclude |= self.default_exclude_files
43
- inc = config['include_files'] || './**/*'
44
- metadata = config['metadata'] || {}
45
- metadata[:access] ||= 'public-read'
46
-
44
+ inc = config['include_files'] || './**/*'
47
45
  inc = [inc] unless inc.is_a?(Array)
48
46
 
49
47
  files = []
@@ -61,6 +59,23 @@ class SimpleS3
61
59
  end
62
60
  end
63
61
 
62
+ files
63
+ end
64
+
65
+ def self.upload!
66
+ bucket = self.s3_bucket
67
+ raise 'Simple-S3: Bucket not defined' if bucket.length == 0
68
+
69
+ metadata = config['metadata'] || {}
70
+ metadata[:access] ||= 'public-read'
71
+
72
+ endpoint = self.s3_endpoint.to_s
73
+ if endpoint.length > 0
74
+ AWS::S3::DEFAULT_HOST.replace(endpoint)
75
+ end
76
+
77
+ files = self.get_files(config)
78
+
64
79
  raise 'Simple-S3: No files found' if files.length == 0
65
80
 
66
81
  AWS::S3::Base.establish_connection!(
@@ -1,3 +1,3 @@
1
1
  class SimpleS3
2
- VERSION = "1.0.13"
2
+ VERSION = "1.0.16"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 13
9
- version: 1.0.13
8
+ - 16
9
+ version: 1.0.16
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matias Niemela
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-10-29 00:00:00 -04:00
17
+ date: 2012-12-30 00:00:00 -05:00
18
18
  default_executable: simple-s3
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -45,7 +45,6 @@ files:
45
45
  - lib/simple-s3.rb
46
46
  - lib/simple-s3/simple-s3.rb
47
47
  - lib/simple-s3/version.rb
48
- - simple-s3.gem
49
48
  - simple-s3.gemspec
50
49
  has_rdoc: true
51
50
  homepage: https://github.com/yearofmoo/simple-s3
data/simple-s3.gem DELETED
Binary file