tp_common 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/gemfiles/rails_4.gemfile.lock +12 -12
- data/gemfiles/rails_5.gemfile.lock +12 -12
- data/gemfiles/rails_6.gemfile.lock +12 -12
- data/gemfiles/rails_latest.gemfile.lock +12 -12
- data/lib/tp_common/file_storage.rb +2 -7
- data/lib/tp_common/file_storage/base.rb +5 -8
- data/lib/tp_common/file_storage/configuration.rb +45 -0
- data/lib/tp_common/timezones/config/reversed.yml +2 -0
- data/lib/tp_common/version.rb +1 -1
- metadata +3 -3
- data/lib/tp_common/file_storage/fog_connection.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e7583b02a46f3c1ebe6b13e2f4515dc3bca69f39f3c1dd5dfe0d5da90275ccd
|
4
|
+
data.tar.gz: f6a63720e101adf4128724f8979046e23b4e5a531160b78b53155aa3966f2683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5214d078dff3b4695967a3c85cbd8bfb72efde26ce3741facc1960ec888d5bd36e0e2b054519d75217cd05f87f3967f33edf1427b04b81fa3266bfb55febaaa3
|
7
|
+
data.tar.gz: 8d50cb60c7ec1507e44ef82e7ccaa32d077b38df90ab298d8b3871fa1c9ee4f6b54540d6e2f23cc0c7f6bcda9078943e415e6283c7a0e4128ec324f8663cc5cc
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
tp_common (0.4.
|
4
|
+
tp_common (0.4.7)
|
5
5
|
activesupport (>= 4.2.0, < 7.0)
|
6
6
|
aws-sdk-s3 (~> 1.19)
|
7
7
|
fog-aws (~> 2.0)
|
@@ -53,17 +53,17 @@ GEM
|
|
53
53
|
thor (>= 0.14.0)
|
54
54
|
arel (6.0.4)
|
55
55
|
aws-eventstream (1.0.3)
|
56
|
-
aws-partitions (1.
|
57
|
-
aws-sdk-core (3.
|
56
|
+
aws-partitions (1.256.0)
|
57
|
+
aws-sdk-core (3.86.0)
|
58
58
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
59
|
-
aws-partitions (~> 1.0)
|
59
|
+
aws-partitions (~> 1, >= 1.239.0)
|
60
60
|
aws-sigv4 (~> 1.1)
|
61
61
|
jmespath (~> 1.0)
|
62
|
-
aws-sdk-kms (1.
|
63
|
-
aws-sdk-core (~> 3, >= 3.
|
62
|
+
aws-sdk-kms (1.27.0)
|
63
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
64
64
|
aws-sigv4 (~> 1.1)
|
65
|
-
aws-sdk-s3 (1.
|
66
|
-
aws-sdk-core (~> 3, >= 3.
|
65
|
+
aws-sdk-s3 (1.59.0)
|
66
|
+
aws-sdk-core (~> 3, >= 3.83.0)
|
67
67
|
aws-sdk-kms (~> 1)
|
68
68
|
aws-sigv4 (~> 1.1)
|
69
69
|
aws-sigv4 (1.1.0)
|
@@ -77,7 +77,7 @@ GEM
|
|
77
77
|
crass (1.0.4)
|
78
78
|
diff-lcs (1.3)
|
79
79
|
erubis (2.7.0)
|
80
|
-
excon (0.
|
80
|
+
excon (0.71.0)
|
81
81
|
fog-aws (2.0.1)
|
82
82
|
fog-core (~> 1.38)
|
83
83
|
fog-json (~> 1.0)
|
@@ -107,13 +107,13 @@ GEM
|
|
107
107
|
mail (2.7.1)
|
108
108
|
mini_mime (>= 0.1.1)
|
109
109
|
method_source (0.9.2)
|
110
|
-
mime-types (3.
|
110
|
+
mime-types (3.3)
|
111
111
|
mime-types-data (~> 3.2015)
|
112
|
-
mime-types-data (3.2019.
|
112
|
+
mime-types-data (3.2019.1009)
|
113
113
|
mini_mime (1.0.1)
|
114
114
|
mini_portile2 (2.4.0)
|
115
115
|
minitest (5.11.3)
|
116
|
-
multi_json (1.
|
116
|
+
multi_json (1.14.1)
|
117
117
|
nokogiri (1.10.1)
|
118
118
|
mini_portile2 (~> 2.4.0)
|
119
119
|
pry (0.12.2)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
tp_common (0.4.
|
4
|
+
tp_common (0.4.7)
|
5
5
|
activesupport (>= 4.2.0, < 7.0)
|
6
6
|
aws-sdk-s3 (~> 1.19)
|
7
7
|
fog-aws (~> 2.0)
|
@@ -60,17 +60,17 @@ GEM
|
|
60
60
|
thor (>= 0.14.0)
|
61
61
|
arel (9.0.0)
|
62
62
|
aws-eventstream (1.0.3)
|
63
|
-
aws-partitions (1.
|
64
|
-
aws-sdk-core (3.
|
63
|
+
aws-partitions (1.256.0)
|
64
|
+
aws-sdk-core (3.86.0)
|
65
65
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
66
|
-
aws-partitions (~> 1.0)
|
66
|
+
aws-partitions (~> 1, >= 1.239.0)
|
67
67
|
aws-sigv4 (~> 1.1)
|
68
68
|
jmespath (~> 1.0)
|
69
|
-
aws-sdk-kms (1.
|
70
|
-
aws-sdk-core (~> 3, >= 3.
|
69
|
+
aws-sdk-kms (1.27.0)
|
70
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
71
71
|
aws-sigv4 (~> 1.1)
|
72
|
-
aws-sdk-s3 (1.
|
73
|
-
aws-sdk-core (~> 3, >= 3.
|
72
|
+
aws-sdk-s3 (1.59.0)
|
73
|
+
aws-sdk-core (~> 3, >= 3.83.0)
|
74
74
|
aws-sdk-kms (~> 1)
|
75
75
|
aws-sigv4 (~> 1.1)
|
76
76
|
aws-sigv4 (1.1.0)
|
@@ -84,7 +84,7 @@ GEM
|
|
84
84
|
crass (1.0.4)
|
85
85
|
diff-lcs (1.3)
|
86
86
|
erubi (1.8.0)
|
87
|
-
excon (0.
|
87
|
+
excon (0.71.0)
|
88
88
|
fog-aws (2.0.1)
|
89
89
|
fog-core (~> 1.38)
|
90
90
|
fog-json (~> 1.0)
|
@@ -116,14 +116,14 @@ GEM
|
|
116
116
|
marcel (0.3.3)
|
117
117
|
mimemagic (~> 0.3.2)
|
118
118
|
method_source (0.9.2)
|
119
|
-
mime-types (3.
|
119
|
+
mime-types (3.3)
|
120
120
|
mime-types-data (~> 3.2015)
|
121
|
-
mime-types-data (3.2019.
|
121
|
+
mime-types-data (3.2019.1009)
|
122
122
|
mimemagic (0.3.3)
|
123
123
|
mini_mime (1.0.1)
|
124
124
|
mini_portile2 (2.4.0)
|
125
125
|
minitest (5.11.3)
|
126
|
-
multi_json (1.
|
126
|
+
multi_json (1.14.1)
|
127
127
|
nio4r (2.3.1)
|
128
128
|
nokogiri (1.10.1)
|
129
129
|
mini_portile2 (~> 2.4.0)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
tp_common (0.4.
|
4
|
+
tp_common (0.4.7)
|
5
5
|
activesupport (>= 4.2.0, < 7.0)
|
6
6
|
aws-sdk-s3 (~> 1.19)
|
7
7
|
fog-aws (~> 2.0)
|
@@ -73,17 +73,17 @@ GEM
|
|
73
73
|
rake
|
74
74
|
thor (>= 0.14.0)
|
75
75
|
aws-eventstream (1.0.3)
|
76
|
-
aws-partitions (1.
|
77
|
-
aws-sdk-core (3.
|
76
|
+
aws-partitions (1.256.0)
|
77
|
+
aws-sdk-core (3.86.0)
|
78
78
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
79
|
-
aws-partitions (~> 1.0)
|
79
|
+
aws-partitions (~> 1, >= 1.239.0)
|
80
80
|
aws-sigv4 (~> 1.1)
|
81
81
|
jmespath (~> 1.0)
|
82
|
-
aws-sdk-kms (1.
|
83
|
-
aws-sdk-core (~> 3, >= 3.
|
82
|
+
aws-sdk-kms (1.27.0)
|
83
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
84
84
|
aws-sigv4 (~> 1.1)
|
85
|
-
aws-sdk-s3 (1.
|
86
|
-
aws-sdk-core (~> 3, >= 3.
|
85
|
+
aws-sdk-s3 (1.59.0)
|
86
|
+
aws-sdk-core (~> 3, >= 3.83.0)
|
87
87
|
aws-sdk-kms (~> 1)
|
88
88
|
aws-sigv4 (~> 1.1)
|
89
89
|
aws-sigv4 (1.1.0)
|
@@ -97,7 +97,7 @@ GEM
|
|
97
97
|
crass (1.0.4)
|
98
98
|
diff-lcs (1.3)
|
99
99
|
erubi (1.8.0)
|
100
|
-
excon (0.
|
100
|
+
excon (0.71.0)
|
101
101
|
fog-aws (2.0.1)
|
102
102
|
fog-core (~> 1.38)
|
103
103
|
fog-json (~> 1.0)
|
@@ -129,14 +129,14 @@ GEM
|
|
129
129
|
marcel (0.3.3)
|
130
130
|
mimemagic (~> 0.3.2)
|
131
131
|
method_source (0.9.2)
|
132
|
-
mime-types (3.
|
132
|
+
mime-types (3.3)
|
133
133
|
mime-types-data (~> 3.2015)
|
134
|
-
mime-types-data (3.2019.
|
134
|
+
mime-types-data (3.2019.1009)
|
135
135
|
mimemagic (0.3.3)
|
136
136
|
mini_mime (1.0.2)
|
137
137
|
mini_portile2 (2.4.0)
|
138
138
|
minitest (5.11.3)
|
139
|
-
multi_json (1.
|
139
|
+
multi_json (1.14.1)
|
140
140
|
nio4r (2.5.1)
|
141
141
|
nokogiri (1.10.4)
|
142
142
|
mini_portile2 (~> 2.4.0)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
tp_common (0.4.
|
4
|
+
tp_common (0.4.7)
|
5
5
|
activesupport (>= 4.2.0, < 7.0)
|
6
6
|
aws-sdk-s3 (~> 1.19)
|
7
7
|
fog-aws (~> 2.0)
|
@@ -73,17 +73,17 @@ GEM
|
|
73
73
|
rake
|
74
74
|
thor (>= 0.14.0)
|
75
75
|
aws-eventstream (1.0.3)
|
76
|
-
aws-partitions (1.
|
77
|
-
aws-sdk-core (3.
|
76
|
+
aws-partitions (1.256.0)
|
77
|
+
aws-sdk-core (3.86.0)
|
78
78
|
aws-eventstream (~> 1.0, >= 1.0.2)
|
79
|
-
aws-partitions (~> 1.0)
|
79
|
+
aws-partitions (~> 1, >= 1.239.0)
|
80
80
|
aws-sigv4 (~> 1.1)
|
81
81
|
jmespath (~> 1.0)
|
82
|
-
aws-sdk-kms (1.
|
83
|
-
aws-sdk-core (~> 3, >= 3.
|
82
|
+
aws-sdk-kms (1.27.0)
|
83
|
+
aws-sdk-core (~> 3, >= 3.71.0)
|
84
84
|
aws-sigv4 (~> 1.1)
|
85
|
-
aws-sdk-s3 (1.
|
86
|
-
aws-sdk-core (~> 3, >= 3.
|
85
|
+
aws-sdk-s3 (1.59.0)
|
86
|
+
aws-sdk-core (~> 3, >= 3.83.0)
|
87
87
|
aws-sdk-kms (~> 1)
|
88
88
|
aws-sigv4 (~> 1.1)
|
89
89
|
aws-sigv4 (1.1.0)
|
@@ -97,7 +97,7 @@ GEM
|
|
97
97
|
crass (1.0.4)
|
98
98
|
diff-lcs (1.3)
|
99
99
|
erubi (1.8.0)
|
100
|
-
excon (0.
|
100
|
+
excon (0.71.0)
|
101
101
|
fog-aws (2.0.1)
|
102
102
|
fog-core (~> 1.38)
|
103
103
|
fog-json (~> 1.0)
|
@@ -129,14 +129,14 @@ GEM
|
|
129
129
|
marcel (0.3.3)
|
130
130
|
mimemagic (~> 0.3.2)
|
131
131
|
method_source (0.9.2)
|
132
|
-
mime-types (3.
|
132
|
+
mime-types (3.3)
|
133
133
|
mime-types-data (~> 3.2015)
|
134
|
-
mime-types-data (3.2019.
|
134
|
+
mime-types-data (3.2019.1009)
|
135
135
|
mimemagic (0.3.3)
|
136
136
|
mini_mime (1.0.2)
|
137
137
|
mini_portile2 (2.4.0)
|
138
138
|
minitest (5.11.3)
|
139
|
-
multi_json (1.
|
139
|
+
multi_json (1.14.1)
|
140
140
|
nio4r (2.5.1)
|
141
141
|
nokogiri (1.10.4)
|
142
142
|
mini_portile2 (~> 2.4.0)
|
@@ -1,15 +1,10 @@
|
|
1
1
|
require 'aws-sdk-s3'
|
2
|
+
require 'tp_common/file_storage/configuration'
|
2
3
|
|
3
4
|
module TpCommon
|
4
5
|
module FileStorage
|
5
|
-
Configuration = Struct.new(:aws_region,
|
6
|
-
:aws_key_id,
|
7
|
-
:aws_secret_key,
|
8
|
-
:key_prefix,
|
9
|
-
:default_bucket)
|
10
|
-
|
11
6
|
def self.configure
|
12
|
-
@configuration = Configuration.new('us-east-1'
|
7
|
+
@configuration = TpCommon::FileStorage::Configuration.new('us-east-1')
|
13
8
|
|
14
9
|
yield(@configuration)
|
15
10
|
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'fog/aws'
|
2
|
-
require 'tp_common/file_storage/fog_connection'
|
3
2
|
require 'tp_common/file_storage/key_protector'
|
4
3
|
|
5
4
|
module TpCommon
|
@@ -8,7 +7,6 @@ module TpCommon
|
|
8
7
|
class Base
|
9
8
|
MAX_RETRIES = 3
|
10
9
|
|
11
|
-
include TpCommon::FileStorage::FogConnection
|
12
10
|
include TpCommon::FileStorage::KeyProtector
|
13
11
|
|
14
12
|
def initialize(directory_path = nil)
|
@@ -17,14 +15,13 @@ module TpCommon
|
|
17
15
|
|
18
16
|
private
|
19
17
|
|
20
|
-
# Connection to S3, config in initializer
|
21
|
-
def connection
|
22
|
-
@connection ||= create_connection
|
23
|
-
end
|
24
|
-
|
25
18
|
# Fog directory to bucket config in constructor
|
26
19
|
def directory
|
27
|
-
|
20
|
+
FileStorage.configuration.get_directory(@directory_path)
|
21
|
+
end
|
22
|
+
|
23
|
+
def connection
|
24
|
+
FileStorage.configuration.connection
|
28
25
|
end
|
29
26
|
end
|
30
27
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'aws-sdk-s3'
|
2
|
+
require 'fog/aws'
|
3
|
+
|
4
|
+
module TpCommon
|
5
|
+
module FileStorage
|
6
|
+
class Configuration
|
7
|
+
def initialize(aws_region,
|
8
|
+
aws_key_id = nil,
|
9
|
+
aws_secret_key = nil,
|
10
|
+
key_prefix = nil,
|
11
|
+
default_bucket = nil)
|
12
|
+
|
13
|
+
@aws_region = aws_region
|
14
|
+
@aws_key_id = aws_key_id
|
15
|
+
@aws_secret_key = aws_secret_key
|
16
|
+
@key_prefix = key_prefix
|
17
|
+
@default_bucket = default_bucket
|
18
|
+
end
|
19
|
+
|
20
|
+
attr_accessor :aws_region,
|
21
|
+
:aws_key_id,
|
22
|
+
:aws_secret_key,
|
23
|
+
:key_prefix,
|
24
|
+
:default_bucket
|
25
|
+
|
26
|
+
def connection
|
27
|
+
@connection ||= Fog::Storage.new(provider: 'AWS',
|
28
|
+
aws_access_key_id: aws_key_id,
|
29
|
+
aws_secret_access_key: aws_secret_key)
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_directory(directory_path)
|
33
|
+
cached_directories[directory_path.to_sym]
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def cached_directories
|
39
|
+
@cached_directories ||= Hash.new do |hash, key|
|
40
|
+
hash[key] = connection.directories.get(key.to_s)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/lib/tp_common/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tp_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TINYpulse Devops
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -236,11 +236,11 @@ files:
|
|
236
236
|
- lib/tp_common/file_storage.rb
|
237
237
|
- lib/tp_common/file_storage/base.rb
|
238
238
|
- lib/tp_common/file_storage/cleaners/cleaner.rb
|
239
|
+
- lib/tp_common/file_storage/configuration.rb
|
239
240
|
- lib/tp_common/file_storage/direct_uploaders/public.rb
|
240
241
|
- lib/tp_common/file_storage/downloaders/private.rb
|
241
242
|
- lib/tp_common/file_storage/errors/failed_to_download.rb
|
242
243
|
- lib/tp_common/file_storage/errors/file_not_found.rb
|
243
|
-
- lib/tp_common/file_storage/fog_connection.rb
|
244
244
|
- lib/tp_common/file_storage/key_protector.rb
|
245
245
|
- lib/tp_common/file_storage/uploaders/private.rb
|
246
246
|
- lib/tp_common/file_storage/uploaders/public.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'fog/aws'
|
2
|
-
|
3
|
-
module TpCommon
|
4
|
-
module FileStorage
|
5
|
-
# Provide default connection to file storage service
|
6
|
-
#
|
7
|
-
module FogConnection
|
8
|
-
|
9
|
-
private
|
10
|
-
|
11
|
-
def create_connection
|
12
|
-
Fog::Storage.new(provider: 'AWS',
|
13
|
-
aws_access_key_id: FileStorage.configuration.aws_key_id,
|
14
|
-
aws_secret_access_key: FileStorage.configuration.aws_secret_key)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|