content_caching 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1679fedaa5b108b96b43f10266fee6f6eba073fb
4
- data.tar.gz: 8e60f670e6594729e3480ca7835ab85ad1ab26a8
3
+ metadata.gz: a36bd6b06053f12e231871a8c057559441c3f3e4
4
+ data.tar.gz: c685675c7ec7574ba9de79f29904049d69955715
5
5
  SHA512:
6
- metadata.gz: 8b66af44f6a4b91c63138533e4eeccf49d936f38741ed76795a79133e875a0641a195384f2cb0570c61149b47aa25eb069c193da777042b80888d5007b9cbe85
7
- data.tar.gz: d6c2b251a47b19e563f34e10a54b78cd4fca0771aa901ce56e24492b402d90ea48c4196692b9f3a5a83d70c3f7d149d5ec8469f1d44dea76f9437fa747ed0604
6
+ metadata.gz: b2dd9092d8e7743c54cfbae415bb32bb314a082561a55d67586abcb47b14149d5d9009eb7d9aef2f1404e20992c423e11cc8122bf486218aa0783f0b5ea64703
7
+ data.tar.gz: a5bc7d09c79ef0b887f11226e965a5b104ac27dbb29e3951d9eb1aa065a1eb6bcb8a781cb5ec56190e3118902f36fad98ccc33935d9a79236dba0645b2c14bd9
@@ -0,0 +1 @@
1
+ 2.2.3
@@ -1,8 +1,7 @@
1
1
  language: ruby
2
2
  script: bundle exec rspec
3
3
  rvm:
4
- - 2.0.0
5
- - 2.1.0
4
+ - 2.2.3
6
5
  - ruby-head
7
6
  matrix:
8
7
  allow_failures:
@@ -1,3 +1,14 @@
1
+ ### VERSION 0.2.0
2
+
3
+ * Enhancements
4
+ * Switch AWS library to the official one.
5
+
6
+ ### VERSION 0.1.1
7
+
8
+ * Enhancements
9
+ * Travis CI files
10
+ * Update bundler version
11
+
1
12
  ### VERSION 0.1.0
2
13
 
3
14
  * bug fix
@@ -0,0 +1 @@
1
+ # Upgrading
@@ -15,12 +15,13 @@ Gem::Specification.new do |spec|
15
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
16
  spec.require_paths = ['lib']
17
17
 
18
- spec.add_development_dependency 'bundler', '> 1.3'
19
- spec.add_development_dependency 'rake', '~> 10.3'
20
- spec.add_development_dependency 'rspec', '~> 2.14'
21
- spec.add_development_dependency 'webmock', '~> 1.18'
18
+ spec.add_development_dependency 'bundler', '> 1.0'
19
+ spec.add_development_dependency 'rake', '~> 10.4'
20
+ spec.add_development_dependency 'rspec', '~> 3.3'
21
+ spec.add_development_dependency 'webmock', '~> 1.21'
22
22
  spec.add_development_dependency 'vcr', '~> 2.9'
23
23
  spec.add_development_dependency 'right_http_connection', '~> 1.4'
24
24
 
25
- spec.add_dependency 'aws', '~> 2.10'
25
+ spec.add_dependency 'aws-sdk-resources', '~> 2.1'
26
+ spec.add_dependency 'retryable_block', '0.0.1'
26
27
  end
@@ -1,8 +1,9 @@
1
- require 'aws'
1
+ require 'aws-sdk-resources' # This lib is accessible through ::Aws...
2
2
 
3
3
  module ContentCaching
4
4
  module Adapter
5
5
  class Aws
6
+ include RetryableBlock
6
7
 
7
8
  T_1_DAY = 86400.freeze
8
9
 
@@ -13,39 +14,36 @@ module ContentCaching
13
14
  end
14
15
 
15
16
  def store document_path, content
16
- retry_3_times do
17
+ retryable(3) do
17
18
  content.rewind if content.respond_to?(:rewind)
18
- s3_interface.put self.options[:directory], document_path,
19
- (content.respond_to?(:read) ? content.read : content)
19
+ bucket.put_object key: document_path,
20
+ body: (content.respond_to?(:read) ? content.read : content)
20
21
  end
21
22
  end
22
23
 
23
24
  def url document_path
24
- s3_interface.get_link self.options[:directory], document_path, T_1_DAY
25
+ bucket.object(document_path).presigned_url :get, expires_in: T_1_DAY
25
26
  end
26
27
 
27
28
  def delete document_path
28
- retry_3_times do
29
- s3_interface.delete self.options[:directory], document_path
29
+ retryable(3) do
30
+ bucket.object(document_path).delete
30
31
  end
31
32
  end
32
33
 
33
34
  private
34
35
 
35
- def s3_interface
36
- @s3_interface ||= ::Aws::S3Interface.new self.options[:aws_access_key_id],
37
- self.options[:aws_secret_access_key]
36
+ def bucket
37
+ ::Aws::S3::Resource.new(
38
+ credentials: aws_credentials,
39
+ region: self.options[:region]
40
+ ).bucket self.options[:directory]
38
41
  end
39
42
 
40
- def retry_3_times
41
- tries = 0
42
- begin
43
- yield
44
- rescue
45
- (tries += 1) <3 ? retry : raise
46
- end
43
+ def aws_credentials
44
+ :: Aws::Credentials.new self.options[:aws_access_key_id],
45
+ self.options[:aws_secret_access_key]
47
46
  end
48
-
49
47
  end
50
48
  end
51
49
  end
@@ -28,7 +28,6 @@ module ContentCaching
28
28
  def adapter
29
29
  @adapter ||= Aws::new(@options)
30
30
  end
31
-
32
31
  end
33
32
  end
34
33
  end
@@ -37,7 +37,6 @@ module ContentCaching
37
37
  def adapter
38
38
  @adapter ||= Fs::new
39
39
  end
40
-
41
40
  end
42
41
  end
43
42
  end
@@ -1,3 +1,3 @@
1
1
  module ContentCaching
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
@@ -94,6 +94,5 @@ module ContentCaching
94
94
  end
95
95
  end
96
96
  end
97
-
98
97
  end
99
98
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: content_caching
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel AZEMAR
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-23 00:00:00.000000000 Z
11
+ date: 2015-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - ">"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '1.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.3'
33
+ version: '10.4'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.3'
40
+ version: '10.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.14'
47
+ version: '3.3'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.14'
54
+ version: '3.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.18'
61
+ version: '1.21'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.18'
68
+ version: '1.21'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: vcr
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -95,19 +95,33 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.4'
97
97
  - !ruby/object:Gem::Dependency
98
- name: aws
98
+ name: aws-sdk-resources
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '2.10'
103
+ version: '2.1'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '2.10'
110
+ version: '2.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: retryable_block
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 0.0.1
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 0.0.1
111
125
  description: Library for help and speed up views render manipulation based on aws
112
126
  and local storage
113
127
  email:
@@ -119,12 +133,14 @@ files:
119
133
  - ".coveralls.yml"
120
134
  - ".gitignore"
121
135
  - ".rspec"
136
+ - ".ruby-version"
122
137
  - ".travis.yml"
123
138
  - CHANGELOG.md
124
139
  - Gemfile
125
140
  - LICENSE.txt
126
141
  - README.md
127
142
  - Rakefile
143
+ - UPGRADE.md
128
144
  - content_caching.gemspec
129
145
  - lib/content_caching.rb
130
146
  - lib/content_caching/adapters/abstract.rb
@@ -163,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
179
  version: '0'
164
180
  requirements: []
165
181
  rubyforge_project:
166
- rubygems_version: 2.4.2
182
+ rubygems_version: 2.4.5.1
167
183
  signing_key:
168
184
  specification_version: 4
169
185
  summary: Library for help and speed up views render manipulation