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 +4 -4
- data/.ruby-version +1 -0
- data/.travis.yml +1 -2
- data/CHANGELOG.md +11 -0
- data/UPGRADE.md +1 -0
- data/content_caching.gemspec +6 -5
- data/lib/content_caching/adapters/aws.rb +16 -18
- data/lib/content_caching/adapters/aws_adapter.rb +0 -1
- data/lib/content_caching/adapters/fs_adapter.rb +0 -1
- data/lib/content_caching/version.rb +1 -1
- data/spec/content_caching_spec.rb +0 -1
- metadata +30 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a36bd6b06053f12e231871a8c057559441c3f3e4
|
4
|
+
data.tar.gz: c685675c7ec7574ba9de79f29904049d69955715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2dd9092d8e7743c54cfbae415bb32bb314a082561a55d67586abcb47b14149d5d9009eb7d9aef2f1404e20992c423e11cc8122bf486218aa0783f0b5ea64703
|
7
|
+
data.tar.gz: a5bc7d09c79ef0b887f11226e965a5b104ac27dbb29e3951d9eb1aa065a1eb6bcb8a781cb5ec56190e3118902f36fad98ccc33935d9a79236dba0645b2c14bd9
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.3
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/UPGRADE.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Upgrading
|
data/content_caching.gemspec
CHANGED
@@ -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.
|
19
|
-
spec.add_development_dependency 'rake', '~> 10.
|
20
|
-
spec.add_development_dependency 'rspec', '~>
|
21
|
-
spec.add_development_dependency 'webmock', '~> 1.
|
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.
|
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
|
-
|
17
|
+
retryable(3) do
|
17
18
|
content.rewind if content.respond_to?(:rewind)
|
18
|
-
|
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
|
-
|
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
|
-
|
29
|
-
|
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
|
36
|
-
|
37
|
-
|
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
|
41
|
-
|
42
|
-
|
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
|
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.
|
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:
|
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.
|
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.
|
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.
|
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.
|
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: '
|
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: '
|
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.
|
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.
|
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.
|
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.
|
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.
|
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
|