activestorage 5.2.0.beta2 → 5.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activestorage might be problematic. Click here for more details.

Files changed (43) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +25 -0
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +15 -1
  5. data/app/assets/javascripts/activestorage.js +1 -1
  6. data/app/controllers/active_storage/blobs_controller.rb +4 -6
  7. data/app/controllers/active_storage/previews_controller.rb +4 -6
  8. data/app/controllers/active_storage/variants_controller.rb +4 -6
  9. data/app/controllers/concerns/active_storage/set_blob.rb +16 -0
  10. data/app/javascript/activestorage/blob_record.js +17 -3
  11. data/app/javascript/activestorage/helpers.js +10 -1
  12. data/app/models/active_storage/attachment.rb +5 -1
  13. data/app/models/active_storage/blob.rb +15 -134
  14. data/app/models/active_storage/blob/analyzable.rb +57 -0
  15. data/app/models/active_storage/blob/identifiable.rb +11 -0
  16. data/app/models/active_storage/blob/representable.rb +93 -0
  17. data/app/models/active_storage/filename.rb +1 -1
  18. data/app/models/active_storage/filename/parameters.rb +1 -1
  19. data/app/models/active_storage/identification.rb +38 -0
  20. data/app/models/active_storage/variant.rb +51 -5
  21. data/app/models/active_storage/variation.rb +19 -5
  22. data/config/routes.rb +7 -7
  23. data/lib/active_storage.rb +8 -1
  24. data/lib/active_storage/analyzer.rb +1 -1
  25. data/lib/active_storage/analyzer/image_analyzer.rb +1 -2
  26. data/lib/active_storage/analyzer/video_analyzer.rb +51 -10
  27. data/lib/active_storage/attached/macros.rb +4 -4
  28. data/lib/active_storage/downloading.rb +16 -4
  29. data/lib/active_storage/engine.rb +18 -1
  30. data/lib/active_storage/errors.rb +7 -0
  31. data/lib/active_storage/gem_version.rb +1 -1
  32. data/lib/active_storage/log_subscriber.rb +4 -0
  33. data/lib/active_storage/previewer.rb +21 -5
  34. data/lib/active_storage/previewer/pdf_previewer.rb +10 -1
  35. data/lib/active_storage/previewer/video_previewer.rb +5 -1
  36. data/lib/active_storage/service.rb +8 -3
  37. data/lib/active_storage/service/azure_storage_service.rb +24 -8
  38. data/lib/active_storage/service/disk_service.rb +26 -24
  39. data/lib/active_storage/service/gcs_service.rb +21 -7
  40. data/lib/active_storage/service/mirror_service.rb +5 -0
  41. data/lib/active_storage/service/s3_service.rb +13 -7
  42. data/lib/tasks/activestorage.rake +5 -1
  43. metadata +43 -9
@@ -35,6 +35,11 @@ module ActiveStorage
35
35
  perform_across_services :delete, key
36
36
  end
37
37
 
38
+ # Delete files at keys starting with the +prefix+ on all services.
39
+ def delete_prefixed(prefix)
40
+ perform_across_services :delete_prefixed, prefix
41
+ end
42
+
38
43
  private
39
44
  def each_service(&block)
40
45
  [ primary, *mirrors ].each(&block)
@@ -17,7 +17,7 @@ module ActiveStorage
17
17
  end
18
18
 
19
19
  def upload(key, io, checksum: nil)
20
- instrument :upload, key, checksum: checksum do
20
+ instrument :upload, key: key, checksum: checksum do
21
21
  begin
22
22
  object_for(key).put(upload_options.merge(body: io, content_md5: checksum))
23
23
  rescue Aws::S3::Errors::BadDigest
@@ -28,24 +28,30 @@ module ActiveStorage
28
28
 
29
29
  def download(key, &block)
30
30
  if block_given?
31
- instrument :streaming_download, key do
31
+ instrument :streaming_download, key: key do
32
32
  stream(key, &block)
33
33
  end
34
34
  else
35
- instrument :download, key do
35
+ instrument :download, key: key do
36
36
  object_for(key).get.body.read.force_encoding(Encoding::BINARY)
37
37
  end
38
38
  end
39
39
  end
40
40
 
41
41
  def delete(key)
42
- instrument :delete, key do
42
+ instrument :delete, key: key do
43
43
  object_for(key).delete
44
44
  end
45
45
  end
46
46
 
47
+ def delete_prefixed(prefix)
48
+ instrument :delete_prefixed, prefix: prefix do
49
+ bucket.objects(prefix: prefix).batch_delete!
50
+ end
51
+ end
52
+
47
53
  def exist?(key)
48
- instrument :exist, key do |payload|
54
+ instrument :exist, key: key do |payload|
49
55
  answer = object_for(key).exists?
50
56
  payload[:exist] = answer
51
57
  answer
@@ -53,7 +59,7 @@ module ActiveStorage
53
59
  end
54
60
 
55
61
  def url(key, expires_in:, filename:, disposition:, content_type:)
56
- instrument :url, key do |payload|
62
+ instrument :url, key: key do |payload|
57
63
  generated_url = object_for(key).presigned_url :get, expires_in: expires_in.to_i,
58
64
  response_content_disposition: content_disposition_with(type: disposition, filename: filename),
59
65
  response_content_type: content_type
@@ -65,7 +71,7 @@ module ActiveStorage
65
71
  end
66
72
 
67
73
  def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)
68
- instrument :url, key do |payload|
74
+ instrument :url, key: key do |payload|
69
75
  generated_url = object_for(key).presigned_url :put, expires_in: expires_in.to_i,
70
76
  content_type: content_type, content_length: content_length, content_md5: checksum
71
77
 
@@ -3,6 +3,10 @@
3
3
  namespace :active_storage do
4
4
  desc "Copy over the migration needed to the application"
5
5
  task install: :environment do
6
- Rake::Task["active_storage:install:migrations"].invoke
6
+ if Rake::Task.task_defined?("active_storage:install:migrations")
7
+ Rake::Task["active_storage:install:migrations"].invoke
8
+ else
9
+ Rake::Task["app:active_storage:install:migrations"].invoke
10
+ end
7
11
  end
8
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activestorage
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0.beta2
4
+ version: 5.2.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-28 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack
@@ -16,28 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0.beta2
19
+ version: 5.2.0.rc1
20
20
  type: :runtime
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: 5.2.0.beta2
26
+ version: 5.2.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 5.2.0.beta2
33
+ version: 5.2.0.rc1
34
34
  type: :runtime
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: 5.2.0.beta2
40
+ version: 5.2.0.rc1
41
+ - !ruby/object:Gem::Dependency
42
+ name: marcel
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.3.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.2.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.2.1
41
69
  description: Attach cloud and local files in Rails applications.
42
70
  email: david@loudthinking.com
43
71
  executables: []
@@ -53,6 +81,7 @@ files:
53
81
  - app/controllers/active_storage/disk_controller.rb
54
82
  - app/controllers/active_storage/previews_controller.rb
55
83
  - app/controllers/active_storage/variants_controller.rb
84
+ - app/controllers/concerns/active_storage/set_blob.rb
56
85
  - app/javascript/activestorage/blob_record.js
57
86
  - app/javascript/activestorage/blob_upload.js
58
87
  - app/javascript/activestorage/direct_upload.js
@@ -67,8 +96,12 @@ files:
67
96
  - app/jobs/active_storage/purge_job.rb
68
97
  - app/models/active_storage/attachment.rb
69
98
  - app/models/active_storage/blob.rb
99
+ - app/models/active_storage/blob/analyzable.rb
100
+ - app/models/active_storage/blob/identifiable.rb
101
+ - app/models/active_storage/blob/representable.rb
70
102
  - app/models/active_storage/filename.rb
71
103
  - app/models/active_storage/filename/parameters.rb
104
+ - app/models/active_storage/identification.rb
72
105
  - app/models/active_storage/preview.rb
73
106
  - app/models/active_storage/variant.rb
74
107
  - app/models/active_storage/variation.rb
@@ -85,6 +118,7 @@ files:
85
118
  - lib/active_storage/attached/one.rb
86
119
  - lib/active_storage/downloading.rb
87
120
  - lib/active_storage/engine.rb
121
+ - lib/active_storage/errors.rb
88
122
  - lib/active_storage/gem_version.rb
89
123
  - lib/active_storage/log_subscriber.rb
90
124
  - lib/active_storage/previewer.rb
@@ -103,8 +137,8 @@ homepage: http://rubyonrails.org
103
137
  licenses:
104
138
  - MIT
105
139
  metadata:
106
- source_code_uri: https://github.com/rails/rails/tree/v5.2.0.beta2/activestorage
107
- changelog_uri: https://github.com/rails/rails/blob/v5.2.0.beta2/activestorage/CHANGELOG.md
140
+ source_code_uri: https://github.com/rails/rails/tree/v5.2.0.rc1/activestorage
141
+ changelog_uri: https://github.com/rails/rails/blob/v5.2.0.rc1/activestorage/CHANGELOG.md
108
142
  post_install_message:
109
143
  rdoc_options: []
110
144
  require_paths:
@@ -121,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
155
  version: 1.3.1
122
156
  requirements: []
123
157
  rubyforge_project:
124
- rubygems_version: 2.6.12
158
+ rubygems_version: 2.7.3
125
159
  signing_key:
126
160
  specification_version: 4
127
161
  summary: Local and cloud file storage framework.