tp_common 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/gemfiles/rails_4.gemfile.lock +42 -1
- data/gemfiles/rails_5.gemfile.lock +42 -1
- data/lib/tp_common.rb +1 -0
- data/lib/tp_common/file_storage.rb +38 -0
- data/lib/tp_common/file_storage/base.rb +40 -0
- data/lib/tp_common/file_storage/cleaners/cleaner.rb +16 -0
- data/lib/tp_common/file_storage/direct_uploaders/public.rb +49 -0
- data/lib/tp_common/file_storage/downloaders/private.rb +31 -0
- data/lib/tp_common/file_storage/errors/failed_to_download.rb +8 -0
- data/lib/tp_common/file_storage/errors/file_not_found.rb +8 -0
- data/lib/tp_common/file_storage/fog_connection.rb +18 -0
- data/lib/tp_common/file_storage/key_protector.rb +25 -0
- data/lib/tp_common/file_storage/uploaders/private.rb +39 -0
- data/lib/tp_common/file_storage/uploaders/public.rb +36 -0
- data/lib/tp_common/timezones/config.rb +3 -2
- data/lib/tp_common/version.rb +1 -1
- data/tp_common.gemspec +5 -0
- metadata +72 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ffe086d077ec950e5eb7cab45373b4ad12efc85a827016a53356aab033e3182
|
4
|
+
data.tar.gz: be6fffbe4ae86f5162c7e77ec893c9d68ec71d0d17b172d7061a9dace8d09763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97786a1e6a6ea34a257d966dbaee0b51c4fb2f96b7afdfdcc064abeb0f62bbd8453dbfaeb0cb4b051b477ed35f3ec743b7474feb038d87d06b454464b5389e36
|
7
|
+
data.tar.gz: 2bd58921e8e8cc436d3434367ec7b73743d40640a2bd8e6fb585419ecbdc3714db152a20a8a94a999ed4762e4a8232d56bb11f3ac2f65270f57df45721ddf370
|
data/README.md
CHANGED
@@ -5,6 +5,12 @@
|
|
5
5
|
|
6
6
|
This gem contains common libraries which shared between projects used in TINYpulse.
|
7
7
|
|
8
|
+
Currently, we have:
|
9
|
+
|
10
|
+
1. Timezone helpers
|
11
|
+
2. Asset loader
|
12
|
+
3. File storage
|
13
|
+
|
8
14
|
## Rails versions
|
9
15
|
|
10
16
|
From v0.2.0 `tp_common` support only rails > 4. Mostly on ActiveSupport DateTime functions and `Rails.config_for` method.
|
@@ -1,8 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
tp_common (0.
|
4
|
+
tp_common (0.4.0)
|
5
5
|
activesupport (>= 4.2.0, <= 5.2)
|
6
|
+
aws-sdk-s3 (~> 1.19)
|
7
|
+
fog-aws (~> 2.0)
|
8
|
+
mime-types (~> 3.2)
|
6
9
|
tzinfo (~> 1.2, >= 1.2.0)
|
7
10
|
|
8
11
|
GEM
|
@@ -47,6 +50,21 @@ GEM
|
|
47
50
|
rake
|
48
51
|
thor (>= 0.14.0)
|
49
52
|
arel (6.0.4)
|
53
|
+
aws-eventstream (1.0.1)
|
54
|
+
aws-partitions (1.111.0)
|
55
|
+
aws-sdk-core (3.38.0)
|
56
|
+
aws-eventstream (~> 1.0)
|
57
|
+
aws-partitions (~> 1.0)
|
58
|
+
aws-sigv4 (~> 1.0)
|
59
|
+
jmespath (~> 1.0)
|
60
|
+
aws-sdk-kms (1.11.0)
|
61
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
62
|
+
aws-sigv4 (~> 1.0)
|
63
|
+
aws-sdk-s3 (1.23.1)
|
64
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
65
|
+
aws-sdk-kms (~> 1)
|
66
|
+
aws-sigv4 (~> 1.0)
|
67
|
+
aws-sigv4 (1.0.3)
|
50
68
|
builder (3.2.3)
|
51
69
|
byebug (9.1.0)
|
52
70
|
coderay (1.1.2)
|
@@ -54,19 +72,42 @@ GEM
|
|
54
72
|
crass (1.0.3)
|
55
73
|
diff-lcs (1.3)
|
56
74
|
erubis (2.7.0)
|
75
|
+
excon (0.62.0)
|
76
|
+
fog-aws (2.0.1)
|
77
|
+
fog-core (~> 1.38)
|
78
|
+
fog-json (~> 1.0)
|
79
|
+
fog-xml (~> 0.1)
|
80
|
+
ipaddress (~> 0.8)
|
81
|
+
fog-core (1.45.0)
|
82
|
+
builder
|
83
|
+
excon (~> 0.58)
|
84
|
+
formatador (~> 0.2)
|
85
|
+
fog-json (1.2.0)
|
86
|
+
fog-core
|
87
|
+
multi_json (~> 1.10)
|
88
|
+
fog-xml (0.1.3)
|
89
|
+
fog-core
|
90
|
+
nokogiri (>= 1.5.11, < 2.0.0)
|
91
|
+
formatador (0.2.5)
|
57
92
|
globalid (0.4.1)
|
58
93
|
activesupport (>= 4.2.0)
|
59
94
|
i18n (0.9.1)
|
60
95
|
concurrent-ruby (~> 1.0)
|
96
|
+
ipaddress (0.8.3)
|
97
|
+
jmespath (1.4.0)
|
61
98
|
loofah (2.1.1)
|
62
99
|
crass (~> 1.0.2)
|
63
100
|
nokogiri (>= 1.5.9)
|
64
101
|
mail (2.7.0)
|
65
102
|
mini_mime (>= 0.1.1)
|
66
103
|
method_source (0.9.0)
|
104
|
+
mime-types (3.2.2)
|
105
|
+
mime-types-data (~> 3.2015)
|
106
|
+
mime-types-data (3.2018.0812)
|
67
107
|
mini_mime (1.0.0)
|
68
108
|
mini_portile2 (2.3.0)
|
69
109
|
minitest (5.11.1)
|
110
|
+
multi_json (1.13.1)
|
70
111
|
nokogiri (1.8.1)
|
71
112
|
mini_portile2 (~> 2.3.0)
|
72
113
|
pry (0.11.3)
|
@@ -1,8 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
tp_common (0.
|
4
|
+
tp_common (0.4.0)
|
5
5
|
activesupport (>= 4.2.0, <= 5.2)
|
6
|
+
aws-sdk-s3 (~> 1.19)
|
7
|
+
fog-aws (~> 2.0)
|
8
|
+
mime-types (~> 3.2)
|
6
9
|
tzinfo (~> 1.2, >= 1.2.0)
|
7
10
|
|
8
11
|
GEM
|
@@ -50,6 +53,21 @@ GEM
|
|
50
53
|
rake
|
51
54
|
thor (>= 0.14.0)
|
52
55
|
arel (7.1.4)
|
56
|
+
aws-eventstream (1.0.1)
|
57
|
+
aws-partitions (1.111.0)
|
58
|
+
aws-sdk-core (3.38.0)
|
59
|
+
aws-eventstream (~> 1.0)
|
60
|
+
aws-partitions (~> 1.0)
|
61
|
+
aws-sigv4 (~> 1.0)
|
62
|
+
jmespath (~> 1.0)
|
63
|
+
aws-sdk-kms (1.11.0)
|
64
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
65
|
+
aws-sigv4 (~> 1.0)
|
66
|
+
aws-sdk-s3 (1.23.1)
|
67
|
+
aws-sdk-core (~> 3, >= 3.26.0)
|
68
|
+
aws-sdk-kms (~> 1)
|
69
|
+
aws-sigv4 (~> 1.0)
|
70
|
+
aws-sigv4 (1.0.3)
|
53
71
|
builder (3.2.3)
|
54
72
|
byebug (9.1.0)
|
55
73
|
coderay (1.1.2)
|
@@ -57,19 +75,42 @@ GEM
|
|
57
75
|
crass (1.0.3)
|
58
76
|
diff-lcs (1.3)
|
59
77
|
erubis (2.7.0)
|
78
|
+
excon (0.62.0)
|
79
|
+
fog-aws (2.0.1)
|
80
|
+
fog-core (~> 1.38)
|
81
|
+
fog-json (~> 1.0)
|
82
|
+
fog-xml (~> 0.1)
|
83
|
+
ipaddress (~> 0.8)
|
84
|
+
fog-core (1.45.0)
|
85
|
+
builder
|
86
|
+
excon (~> 0.58)
|
87
|
+
formatador (~> 0.2)
|
88
|
+
fog-json (1.2.0)
|
89
|
+
fog-core
|
90
|
+
multi_json (~> 1.10)
|
91
|
+
fog-xml (0.1.3)
|
92
|
+
fog-core
|
93
|
+
nokogiri (>= 1.5.11, < 2.0.0)
|
94
|
+
formatador (0.2.5)
|
60
95
|
globalid (0.4.1)
|
61
96
|
activesupport (>= 4.2.0)
|
62
97
|
i18n (0.9.1)
|
63
98
|
concurrent-ruby (~> 1.0)
|
99
|
+
ipaddress (0.8.3)
|
100
|
+
jmespath (1.4.0)
|
64
101
|
loofah (2.1.1)
|
65
102
|
crass (~> 1.0.2)
|
66
103
|
nokogiri (>= 1.5.9)
|
67
104
|
mail (2.7.0)
|
68
105
|
mini_mime (>= 0.1.1)
|
69
106
|
method_source (0.9.0)
|
107
|
+
mime-types (3.2.2)
|
108
|
+
mime-types-data (~> 3.2015)
|
109
|
+
mime-types-data (3.2018.0812)
|
70
110
|
mini_mime (1.0.0)
|
71
111
|
mini_portile2 (2.3.0)
|
72
112
|
minitest (5.11.1)
|
113
|
+
multi_json (1.13.1)
|
73
114
|
nio4r (2.2.0)
|
74
115
|
nokogiri (1.8.1)
|
75
116
|
mini_portile2 (~> 2.3.0)
|
data/lib/tp_common.rb
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'aws-sdk-s3'
|
2
|
+
|
3
|
+
module TpCommon
|
4
|
+
module FileStorage
|
5
|
+
Configuration = Struct.new(:aws_region,
|
6
|
+
:aws_key_id,
|
7
|
+
:aws_secret_key,
|
8
|
+
:key_prefix,
|
9
|
+
:default_bucket)
|
10
|
+
|
11
|
+
def self.configure
|
12
|
+
@configuration = Configuration.new('us-east-1', nil, nil, nil, nil)
|
13
|
+
|
14
|
+
yield(@configuration)
|
15
|
+
|
16
|
+
Aws.config.update({
|
17
|
+
region: @configuration.aws_region,
|
18
|
+
credentials: Aws::Credentials.new(
|
19
|
+
@configuration.aws_key_id,
|
20
|
+
@configuration.aws_secret_key)
|
21
|
+
})
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.key_prefix
|
25
|
+
raise ::StandardError.new('FileStorage is not config yet.') unless defined?(@configuration)
|
26
|
+
|
27
|
+
@configuration.key_prefix
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.configuration
|
31
|
+
raise ::StandardError.new('FileStorage is not config yet.') unless defined?(@configuration)
|
32
|
+
|
33
|
+
@configuration
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
require 'tp_common/file_storage/base'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'fog/aws'
|
2
|
+
require 'tp_common/file_storage/fog_connection'
|
3
|
+
require 'tp_common/file_storage/key_protector'
|
4
|
+
|
5
|
+
module TpCommon
|
6
|
+
module FileStorage
|
7
|
+
# Prepare connection, key protector, consts for working wilt s3 files
|
8
|
+
class Base
|
9
|
+
MAX_RETRIES = 3
|
10
|
+
|
11
|
+
include TpCommon::FileStorage::FogConnection
|
12
|
+
include TpCommon::FileStorage::KeyProtector
|
13
|
+
|
14
|
+
def initialize(directory_path = nil)
|
15
|
+
@directory_path = directory_path || TpCommon::FileStorage.configuration.default_bucket
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
# Connection to S3, config in initializer
|
21
|
+
def connection
|
22
|
+
@connection ||= create_connection
|
23
|
+
end
|
24
|
+
|
25
|
+
# Fog directory to bucket config in constructor
|
26
|
+
def directory
|
27
|
+
@directory ||= connection.directories.get(@directory_path)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
require 'tp_common/file_storage/errors/failed_to_download'
|
34
|
+
require 'tp_common/file_storage/errors/file_not_found'
|
35
|
+
|
36
|
+
require 'tp_common/file_storage/cleaners/cleaner'
|
37
|
+
require 'tp_common/file_storage/direct_uploaders/public'
|
38
|
+
require 'tp_common/file_storage/downloaders/private'
|
39
|
+
require 'tp_common/file_storage/uploaders/private'
|
40
|
+
require 'tp_common/file_storage/uploaders/public'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module TpCommon
|
2
|
+
module FileStorage
|
3
|
+
module Cleaners
|
4
|
+
# Delete files on file storage service.
|
5
|
+
# Please handle with care
|
6
|
+
#
|
7
|
+
class Cleaner < FileStorage::Base
|
8
|
+
# Expect an array of file key to delete.
|
9
|
+
#
|
10
|
+
def clean(files)
|
11
|
+
connection.delete_multiple_objects(@directory_path, files.map{|file_key| mask_key(file_key) })
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module TpCommon
|
2
|
+
module FileStorage
|
3
|
+
module DirectUploaders
|
4
|
+
# Prepare a presigned url to upload diectly to storage service
|
5
|
+
# Use in case content to upload is outside of system/server,
|
6
|
+
# we shoud use this to avoid delay because of content stream over our server
|
7
|
+
#
|
8
|
+
class Public < FileStorage::Base
|
9
|
+
def initialize(bucket_name = nil)
|
10
|
+
@bucket_name = bucket_name || TpCommon::FileStorage.configuration.default_bucket
|
11
|
+
@bucket = Aws::S3::Bucket.new(name: @bucket_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Presigned POST url, use for form POST with data. Use when file name isn't decided yet
|
15
|
+
# Request body is form data
|
16
|
+
# Return a hash
|
17
|
+
#
|
18
|
+
def presigned_post(file_key)
|
19
|
+
s3_direct_post = @bucket.presigned_post(key: mask_key(file_key),
|
20
|
+
success_action_status: '201',
|
21
|
+
acl: 'public-read')
|
22
|
+
{
|
23
|
+
host: URI(s3_direct_post.url).host,
|
24
|
+
bucket: @bucket_name,
|
25
|
+
url: "#{s3_direct_post.url}/",
|
26
|
+
form_data: s3_direct_post.fields
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Presigned PUT url, use for PUT file to storage service.
|
31
|
+
# File name must be matched, and request body is file content
|
32
|
+
# Return a hash
|
33
|
+
#
|
34
|
+
def presigned_put(file_key, mime_type, expires_in = 900)
|
35
|
+
@bucket.object(mask_key(file_key)).presigned_url(:put,
|
36
|
+
content_type: mime_type,
|
37
|
+
acl: 'public-read',
|
38
|
+
expires_in: expires_in)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Public URL from key for uploaded file
|
42
|
+
#
|
43
|
+
def url(file_key)
|
44
|
+
@bucket.object(mask_key(file_key))&.public_url(path_style: true)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module TpCommon
|
2
|
+
module FileStorage
|
3
|
+
module Downloaders
|
4
|
+
# Pull and read a files from storage service.
|
5
|
+
# Included retry mechanism.
|
6
|
+
#
|
7
|
+
class Private < FileStorage::Base
|
8
|
+
# Pull a file with provided key.
|
9
|
+
# Return a Fog file object https://www.rubydoc.info/github/fog/fog-aws/Fog/Storage/AWS/File
|
10
|
+
#
|
11
|
+
def download(file_key)
|
12
|
+
retried_count = 0
|
13
|
+
begin
|
14
|
+
directory.files.get(mask_key(file_key)).tap do |file|
|
15
|
+
raise FileStorage::Errors::FileNotFound.new("Could not find file: #{file_key}") unless file
|
16
|
+
end
|
17
|
+
rescue ::Fog::Errors::Error => error
|
18
|
+
retried_count += 1
|
19
|
+
retry if retried_count < MAX_RETRIES
|
20
|
+
raise FileStorage::Errors::FailedToDownload.new("Failed to download file via fog: #{error.message}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Same as #download but return file content
|
25
|
+
def read(file_key)
|
26
|
+
download(mask_key(file_key)).body
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
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
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module TpCommon
|
2
|
+
module FileStorage
|
3
|
+
# Provide mechanism to protect keys conflict using prefix
|
4
|
+
# This module supports using 1 bucket for multiple environment, just have different prefix key
|
5
|
+
# Although it's recommended in real usage, using in development env is recommended.
|
6
|
+
# To avoid issue local uploading works but trouble when work with S3
|
7
|
+
module KeyProtector
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
# Mask key with s3 dev prefix. !!! Make sure it's idempotent
|
12
|
+
#
|
13
|
+
def mask_key(key)
|
14
|
+
return key if !FileStorage.key_prefix
|
15
|
+
|
16
|
+
# Trim and remove redundant slash
|
17
|
+
key = key.gsub(/^\/*/, '').gsub(/\/*$/, '').gsub(/\/+/, '/')
|
18
|
+
regex = Regexp.new("^#{FileStorage.key_prefix}/")
|
19
|
+
return key if regex.match(key)
|
20
|
+
|
21
|
+
"#{FileStorage.key_prefix}/#{key}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module TpCommon
|
2
|
+
module FileStorage
|
3
|
+
module Uploaders
|
4
|
+
# Upload a content to file storage used for private purpose like user import. export files
|
5
|
+
# Use in case content to upload is inside of system/server
|
6
|
+
#
|
7
|
+
class Private < FileStorage::Base
|
8
|
+
# Upload content to file_key
|
9
|
+
#
|
10
|
+
def upload(file_key, content, content_type)
|
11
|
+
retry_count = 0
|
12
|
+
|
13
|
+
begin
|
14
|
+
directory.files.create(
|
15
|
+
'key' => mask_key(file_key),
|
16
|
+
"body" => content,
|
17
|
+
'public' => false,
|
18
|
+
'Content-Type' => content_type,
|
19
|
+
"Content-Disposition" => "attachment;filename=\"#{mask_key(file_key)}\""
|
20
|
+
)
|
21
|
+
rescue StandardError => e
|
22
|
+
retry_count += 1
|
23
|
+
retry if retry_count < MAX_RETRIES
|
24
|
+
raise e
|
25
|
+
end
|
26
|
+
|
27
|
+
mask_key(file_key)
|
28
|
+
end
|
29
|
+
# Get url from key of file #upload above to provide to outside.
|
30
|
+
# To get file content to use inside system, please use Downloaders::Private instead
|
31
|
+
# As private file, link has a ttl, default 1 week.
|
32
|
+
#
|
33
|
+
def url(file_key, link_ttl = 1.week.from_now)
|
34
|
+
directory.files.get_https_url(mask_key(file_key), link_ttl)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module TpCommon
|
2
|
+
module FileStorage
|
3
|
+
module Uploaders
|
4
|
+
# Upload a content to file storage used to public like avatar, logo
|
5
|
+
# Use in case content to upload is inside of system/server
|
6
|
+
#
|
7
|
+
class Public < FileStorage::Base
|
8
|
+
# Upload content to file_key
|
9
|
+
# Currently, _content_type is ignore but kept for compatible. Will be removed in next release
|
10
|
+
#
|
11
|
+
def upload(file_key, content, _content_type = nil)
|
12
|
+
retry_count = 0
|
13
|
+
|
14
|
+
begin
|
15
|
+
directory.files.create(
|
16
|
+
key: mask_key(file_key),
|
17
|
+
body: content,
|
18
|
+
public: true)
|
19
|
+
rescue StandardError => e
|
20
|
+
retry_count += 1
|
21
|
+
retry if retry_count < MAX_RETRIES
|
22
|
+
raise e
|
23
|
+
end
|
24
|
+
|
25
|
+
mask_key(file_key)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get public url from key of file #upload above
|
29
|
+
#
|
30
|
+
def url(file_key)
|
31
|
+
directory.files.get(mask_key(file_key))&.public_url
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -8,11 +8,12 @@ module TpCommon
|
|
8
8
|
if defined?(::Rails::Railtie)
|
9
9
|
begin
|
10
10
|
TpCommon::Timezones.const_set("LIST_ZONES", Rails.application.config_for(:timezones))
|
11
|
+
puts "[TpCommon::Timezones::Config] Message-3: Use custom timezones in project config/timezones.yml"
|
11
12
|
return
|
12
13
|
rescue NameError, NoMethodError
|
13
|
-
puts "
|
14
|
+
puts "[TpCommon::Timezones::Config] Message-1: Use default timezones in tp_common/timezones/config/timezones.yml"
|
14
15
|
rescue StandardError
|
15
|
-
puts "
|
16
|
+
puts "[TpCommon::Timezones::Config] Message-2: Use default timezones in tp_common/timezones/config/timezones.yml"
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
data/lib/tp_common/version.rb
CHANGED
data/tp_common.gemspec
CHANGED
@@ -37,4 +37,9 @@ Gem::Specification.new do |spec|
|
|
37
37
|
|
38
38
|
spec.add_runtime_dependency "tzinfo", '~> 1.2', '>= 1.2.0'
|
39
39
|
spec.add_runtime_dependency "activesupport", '<= 5.2', '>= 4.2.0'
|
40
|
+
spec.add_runtime_dependency 'fog-aws', '~> 2.0'
|
41
|
+
# fog-aws need a mime-type tool
|
42
|
+
spec.add_runtime_dependency 'mime-types', '~> 3.2'
|
43
|
+
|
44
|
+
spec.add_runtime_dependency 'aws-sdk-s3', '~> 1.19'
|
40
45
|
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
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TINYpulse Devops
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,62 +84,104 @@ dependencies:
|
|
84
84
|
name: appraisal
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.2'
|
90
87
|
- - ">="
|
91
88
|
- !ruby/object:Gem::Version
|
92
89
|
version: 2.2.0
|
90
|
+
- - "~>"
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '2.2'
|
93
93
|
type: :development
|
94
94
|
prerelease: false
|
95
95
|
version_requirements: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- - "~>"
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version: '2.2'
|
100
97
|
- - ">="
|
101
98
|
- !ruby/object:Gem::Version
|
102
99
|
version: 2.2.0
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '2.2'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: tzinfo
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "~>"
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '1.2'
|
110
107
|
- - ">="
|
111
108
|
- !ruby/object:Gem::Version
|
112
109
|
version: 1.2.0
|
110
|
+
- - "~>"
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '1.2'
|
113
113
|
type: :runtime
|
114
114
|
prerelease: false
|
115
115
|
version_requirements: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '1.2'
|
120
117
|
- - ">="
|
121
118
|
- !ruby/object:Gem::Version
|
122
119
|
version: 1.2.0
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: '1.2'
|
123
123
|
- !ruby/object:Gem::Dependency
|
124
124
|
name: activesupport
|
125
125
|
requirement: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
+
- - ">="
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 4.2.0
|
127
130
|
- - "<="
|
128
131
|
- !ruby/object:Gem::Version
|
129
132
|
version: '5.2'
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
130
137
|
- - ">="
|
131
138
|
- !ruby/object:Gem::Version
|
132
139
|
version: 4.2.0
|
140
|
+
- - "<="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '5.2'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: fog-aws
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '2.0'
|
133
150
|
type: :runtime
|
134
151
|
prerelease: false
|
135
152
|
version_requirements: !ruby/object:Gem::Requirement
|
136
153
|
requirements:
|
137
|
-
- - "
|
154
|
+
- - "~>"
|
138
155
|
- !ruby/object:Gem::Version
|
139
|
-
version: '
|
140
|
-
|
156
|
+
version: '2.0'
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: mime-types
|
159
|
+
requirement: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - "~>"
|
141
162
|
- !ruby/object:Gem::Version
|
142
|
-
version:
|
163
|
+
version: '3.2'
|
164
|
+
type: :runtime
|
165
|
+
prerelease: false
|
166
|
+
version_requirements: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - "~>"
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '3.2'
|
171
|
+
- !ruby/object:Gem::Dependency
|
172
|
+
name: aws-sdk-s3
|
173
|
+
requirement: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - "~>"
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '1.19'
|
178
|
+
type: :runtime
|
179
|
+
prerelease: false
|
180
|
+
version_requirements: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - "~>"
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '1.19'
|
143
185
|
description: Common libraries used for TINYpulse apps. i.e. Timezone, ...
|
144
186
|
email:
|
145
187
|
- devops@tinypulse.com
|
@@ -167,6 +209,17 @@ files:
|
|
167
209
|
- gemfiles/rails_5.gemfile.lock
|
168
210
|
- lib/tp_common.rb
|
169
211
|
- lib/tp_common/assets_loader.rb
|
212
|
+
- lib/tp_common/file_storage.rb
|
213
|
+
- lib/tp_common/file_storage/base.rb
|
214
|
+
- lib/tp_common/file_storage/cleaners/cleaner.rb
|
215
|
+
- lib/tp_common/file_storage/direct_uploaders/public.rb
|
216
|
+
- lib/tp_common/file_storage/downloaders/private.rb
|
217
|
+
- lib/tp_common/file_storage/errors/failed_to_download.rb
|
218
|
+
- lib/tp_common/file_storage/errors/file_not_found.rb
|
219
|
+
- lib/tp_common/file_storage/fog_connection.rb
|
220
|
+
- lib/tp_common/file_storage/key_protector.rb
|
221
|
+
- lib/tp_common/file_storage/uploaders/private.rb
|
222
|
+
- lib/tp_common/file_storage/uploaders/public.rb
|
170
223
|
- lib/tp_common/railtie.rb
|
171
224
|
- lib/tp_common/timezones.rb
|
172
225
|
- lib/tp_common/timezones/config.rb
|
@@ -195,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
248
|
version: '0'
|
196
249
|
requirements: []
|
197
250
|
rubyforge_project:
|
198
|
-
rubygems_version: 2.7.
|
251
|
+
rubygems_version: 2.7.8
|
199
252
|
signing_key:
|
200
253
|
specification_version: 4
|
201
254
|
summary: Common libraries used for TINYpulse apps
|