saviour 0.6.9 → 0.6.10

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: 202bb160466c2bb965d8bf474c07d0e55456f0ee8b001f07f023903146683b2f
4
- data.tar.gz: 52e50a243ef24bafbbb44d41b4ac19b9f81b6c21413a799d3dfb0efdfefa19ed
3
+ metadata.gz: 94654aa75977e1fc1b51ac4635cf62d99daacfe0c63b94b27132176e1a89b2f8
4
+ data.tar.gz: 72c77578ddfc92a494b4397a11ee55d5427075158939a3ab82d46fa620dada04
5
5
  SHA512:
6
- metadata.gz: 066ea6c30f34caa92fb60ead4c33393b417a0ade42dccc464e079679840aae7c0161a7cec1de38c11f4ee0c29d7930db59fd7e0f1db0a098943b05b0fc55ab45
7
- data.tar.gz: b5c6a954120bb02290a6dc26936760201b24253601262622edec69c188f4bc3e56837d43420387f0761676764ee55cee939fa92a56c2ddef09ca394a53f917fa
6
+ metadata.gz: 1261335b9ae8af1929e708769cbcb115cb73e05f458241467a8a93124b198cbb1c7e2faec51a70b79dd068cab016277f84d4478d323bd7b83b25419a4a883ef7
7
+ data.tar.gz: f9012382aacb98104c4e83fe7049c554dad19ee2fae77f6f9524c43b03f4a531ea432fbd615211b0f2c2dcf7fc6669b3cdf2908a653db2e6aac37c6b7c7cc2e6
data/.gitignore CHANGED
@@ -19,4 +19,5 @@ spec/support/test_data_dir/*
19
19
  .idea
20
20
  .rbenv-gemsets
21
21
  *.gemfile.lock
22
- .DS_Store
22
+ .DS_Store
23
+ .ruby-version
@@ -1,6 +1,6 @@
1
1
  module Saviour
2
2
  class LifeCycle
3
- SHOULD_USE_INTERLOCK = defined?(Rails)
3
+ SHOULD_USE_INTERLOCK = defined?(Rails) && !Rails.env.test?
4
4
 
5
5
  class FileCreator
6
6
  def initialize(current_path, file, column, connection)
@@ -96,9 +96,7 @@ module Saviour
96
96
  end
97
97
  end
98
98
 
99
- ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
100
- futures.each(&:value!)
101
- end
99
+ futures.each(&:value!)
102
100
  end
103
101
  end
104
102
 
@@ -3,6 +3,8 @@ begin
3
3
  rescue LoadError
4
4
  end
5
5
 
6
+ require 'marcel'
7
+
6
8
  module Saviour
7
9
  class S3Storage
8
10
  MissingPublicUrlPrefix = Class.new(StandardError)
@@ -27,8 +29,12 @@ module Saviour
27
29
  raise(KeyTooLarge, "The key in S3 must be at max 1024 bytes, this key is too big: #{path}")
28
30
  end
29
31
 
32
+ mime_type = Marcel::MimeType.for file_or_contents
33
+
30
34
  # TODO: Use multipart api
31
- client.put_object(@create_options.merge(body: file_or_contents, bucket: @bucket, key: path))
35
+ client.put_object(@create_options.merge(
36
+ body: file_or_contents, bucket: @bucket, key: path, content_type: mime_type
37
+ ))
32
38
  end
33
39
 
34
40
  def write_from_file(file, path)
@@ -24,7 +24,7 @@ module Saviour
24
24
  if opts.empty?
25
25
  @uploader.send(method_or_block, data, filename)
26
26
  else
27
- @uploader.send(method_or_block, data, filename, opts)
27
+ @uploader.send(method_or_block, data, filename, **opts)
28
28
  end
29
29
  end
30
30
  end
@@ -1,3 +1,3 @@
1
1
  module Saviour
2
- VERSION = "0.6.9"
2
+ VERSION = "0.6.10"
3
3
  end
data/saviour.gemspec CHANGED
@@ -15,10 +15,11 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.required_ruby_version = ">= 2.5.0"
17
17
 
18
- spec.add_dependency "activerecord", ">= 5.1"
18
+ spec.add_dependency "activerecord", ">= 5.1", "< 7.0.0"
19
19
  spec.add_dependency "activesupport", ">= 5.1"
20
20
  spec.add_dependency "concurrent-ruby", ">= 1.0.5"
21
21
  spec.add_dependency "concurrent-ruby-edge", ">= 0.6.0"
22
+ spec.add_dependency "marcel", ">= 1.0.0"
22
23
 
23
24
  spec.add_development_dependency "bundler"
24
25
  spec.add_development_dependency "rspec"
@@ -56,8 +56,7 @@ describe "memory usage" do
56
56
 
57
57
  a.update! file: f
58
58
 
59
- # Expect memory usage to grow below 10% of the file size
60
- expect(GetProcessMem.new.mb - base_line).to be < size_to_test / 10
59
+ expect(GetProcessMem.new.mb - base_line).to be < 3
61
60
  end
62
61
  end
63
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saviour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.9
4
+ version: 0.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roger Campos
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-10 00:00:00.000000000 Z
11
+ date: 2021-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 7.0.0
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '5.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 7.0.0
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: activesupport
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +72,20 @@ dependencies:
66
72
  - - ">="
67
73
  - !ruby/object:Gem::Version
68
74
  version: 0.6.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: marcel
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: 1.0.0
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 1.0.0
69
89
  - !ruby/object:Gem::Dependency
70
90
  name: bundler
71
91
  requirement: !ruby/object:Gem::Requirement
@@ -255,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
275
  - !ruby/object:Gem::Version
256
276
  version: '0'
257
277
  requirements: []
258
- rubygems_version: 3.0.3
278
+ rubygems_version: 3.1.6
259
279
  signing_key:
260
280
  specification_version: 4
261
281
  summary: File storage handler following active record model lifecycle