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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9e1fdb837aadd4f68c6b431f858af556763245cd499784a2b6d7453eee291957
4
- data.tar.gz: 23d5687325c98ad9d94e3fee7686ee56425b04a36439c15095bffaa90a7c542e
3
+ metadata.gz: 6e7583b02a46f3c1ebe6b13e2f4515dc3bca69f39f3c1dd5dfe0d5da90275ccd
4
+ data.tar.gz: f6a63720e101adf4128724f8979046e23b4e5a531160b78b53155aa3966f2683
5
5
  SHA512:
6
- metadata.gz: 6b63446c9d98c4326659aedde00298054e4a2a13b131ff8851ea1b44451b8abe19362c3ce88b52c95294ee044612fadf318767fea0a8da455c683de838e16339
7
- data.tar.gz: 3429d1913791f116ef6643490101820a17d697a3d17c6d08fe990f2c0e0158849db2d33b899a44370be07630969fd1e4ce872081fdef036bb638926fb94d0d42
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.6)
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.207.0)
57
- aws-sdk-core (3.65.1)
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.24.0)
63
- aws-sdk-core (~> 3, >= 3.61.1)
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.48.0)
66
- aws-sdk-core (~> 3, >= 3.61.1)
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.66.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.2.2)
110
+ mime-types (3.3)
111
111
  mime-types-data (~> 3.2015)
112
- mime-types-data (3.2019.0331)
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.13.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.6)
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.207.0)
64
- aws-sdk-core (3.65.1)
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.24.0)
70
- aws-sdk-core (~> 3, >= 3.61.1)
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.48.0)
73
- aws-sdk-core (~> 3, >= 3.61.1)
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.66.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.2.2)
119
+ mime-types (3.3)
120
120
  mime-types-data (~> 3.2015)
121
- mime-types-data (3.2019.0331)
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.13.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.6)
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.207.0)
77
- aws-sdk-core (3.65.1)
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.24.0)
83
- aws-sdk-core (~> 3, >= 3.61.1)
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.48.0)
86
- aws-sdk-core (~> 3, >= 3.61.1)
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.66.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.2.2)
132
+ mime-types (3.3)
133
133
  mime-types-data (~> 3.2015)
134
- mime-types-data (3.2019.0331)
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.13.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.6)
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.207.0)
77
- aws-sdk-core (3.65.1)
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.24.0)
83
- aws-sdk-core (~> 3, >= 3.61.1)
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.48.0)
86
- aws-sdk-core (~> 3, >= 3.61.1)
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.66.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.2.2)
132
+ mime-types (3.3)
133
133
  mime-types-data (~> 3.2015)
134
- mime-types-data (3.2019.0331)
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.13.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', nil, nil, nil, nil)
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
- @directory ||= connection.directories.get(@directory_path)
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
@@ -191,7 +191,9 @@ gmt-1: &gmt-1
191
191
  gmt-0: &gmt-0
192
192
  GMT_M0000:
193
193
  - 'Etc/GMT+0'
194
+ - 'Etc/GMT-0'
194
195
  - 'GMT-0'
196
+ - 'GMT+0'
195
197
  GMT_M0000+1:
196
198
  - 'Casablanca'
197
199
  - 'Casablanca GMT-0'
@@ -1,3 +1,3 @@
1
1
  module TpCommon
2
- VERSION = "0.4.6"
2
+ VERSION = "0.4.7"
3
3
  end
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.6
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-09-04 00:00:00.000000000 Z
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