activestorage-validator 0.2.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/rspec.yml +3 -6
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/activestorage-validator.gemspec +3 -1
- data/lib/activestorage/validator/blob.rb +2 -0
- data/lib/activestorage/validator/version.rb +1 -1
- data/lib/activestorage/validator.rb +0 -11
- metadata +10 -11
- data/.travis.yml +0 -5
- data/gemfiles/rails60.gemfile +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c09a9b8ded80c3fe2be9547622aa8408fbdd9c7cd4a1beee2ab1425809f62ba9
|
4
|
+
data.tar.gz: 841c661ce228726b1fa7c28adcabe006bb561c50122e317b9fb628b8ebfc6630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ec8362922c900e8ace6185e8c23a40a8a366c671a341397189e6035eeda0c1ca8826d49ae0d244bcbcaa655d2dbe6df367640914bb5e0edf54d143be03ecb5c
|
7
|
+
data.tar.gz: 3528baa631ad61e40c0a04785dd92bbc60af1b442d843be91956a64c9db082085aa6ea15024ee4f37e026aeb88bfcee8e05c2a8561be422a6768a427831bc48d
|
data/.github/workflows/rspec.yml
CHANGED
@@ -22,18 +22,15 @@ jobs:
|
|
22
22
|
strategy:
|
23
23
|
fail-fast: false
|
24
24
|
matrix:
|
25
|
-
ruby: [
|
26
|
-
gemfile: [
|
27
|
-
exclude:
|
28
|
-
- ruby: 3.1
|
29
|
-
gemfile: rails60
|
25
|
+
ruby: ["3.0", 3.1, 3.2]
|
26
|
+
gemfile: [rails61, rails70]
|
30
27
|
steps:
|
31
28
|
- name: Install packages
|
32
29
|
run: |
|
33
30
|
sudo apt update -y
|
34
31
|
sudo apt install -y libsqlite3-dev
|
35
32
|
|
36
|
-
- uses: actions/checkout@
|
33
|
+
- uses: actions/checkout@v3
|
37
34
|
|
38
35
|
- name: Set up Ruby
|
39
36
|
uses: ruby/setup-ruby@v1
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -28,7 +28,7 @@ class User < ApplicationRecord
|
|
28
28
|
has_one_attached :avatar
|
29
29
|
has_many_attached :photos
|
30
30
|
|
31
|
-
validates :avatar, presence: true, blob: { content_type: :
|
31
|
+
validates :avatar, presence: true, blob: { content_type: :web_image } # supported options: :web_image, :image, :audio, :video, :text
|
32
32
|
validates :photos, presence: true, blob: { content_type: ['image/png', 'image/jpg', 'image/jpeg'], size_range: 1..(5.megabytes) }
|
33
33
|
# validates :photos, presence: true, blob: { content_type: %r{^image/}, size_range: 1..(5.megabytes) }
|
34
34
|
end
|
@@ -23,7 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.
|
26
|
+
spec.required_ruby_version = '>= 3.0.0'
|
27
|
+
|
28
|
+
spec.add_dependency "rails", ">= 6.1.0"
|
27
29
|
spec.add_development_dependency "bundler", "~> 2.0"
|
28
30
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
29
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -29,6 +29,8 @@ module ActiveRecord
|
|
29
29
|
options[:content_type].match?(blob.content_type)
|
30
30
|
when Array
|
31
31
|
options[:content_type].include?(blob.content_type)
|
32
|
+
when :web_image
|
33
|
+
ActiveStorage.web_image_content_types.include?(blob.content_type)
|
32
34
|
when Symbol
|
33
35
|
blob.public_send("#{options[:content_type]}?")
|
34
36
|
else
|
@@ -4,15 +4,4 @@ ActiveSupport.on_load(:active_record) do
|
|
4
4
|
require 'activestorage/validator/blob'
|
5
5
|
end
|
6
6
|
|
7
|
-
module ActiveStorage
|
8
|
-
# https://github.com/rails/rails/commit/42259ce904eb2538761b32a793cbe390fb8272b7
|
9
|
-
if Rails::VERSION::MAJOR < 6
|
10
|
-
class Attached::One < Attached
|
11
|
-
def blank?
|
12
|
-
attachment.blank?
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
7
|
I18n.load_path += Dir[File.expand_path(File.join(__dir__, '../../config/locales', '*.yml')).to_s]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activestorage-validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aki
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.0
|
19
|
+
version: 6.1.0
|
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: 6.0
|
26
|
+
version: 6.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,10 +87,10 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
+
- ".github/dependabot.yml"
|
90
91
|
- ".github/workflows/rspec.yml"
|
91
92
|
- ".gitignore"
|
92
93
|
- ".rspec"
|
93
|
-
- ".travis.yml"
|
94
94
|
- CHANGELOG.md
|
95
95
|
- CODE_OF_CONDUCT.md
|
96
96
|
- Gemfile
|
@@ -108,7 +108,6 @@ files:
|
|
108
108
|
- config/locales/ja.yml
|
109
109
|
- config/locales/pl.yml
|
110
110
|
- config/locales/pt-br.yml
|
111
|
-
- gemfiles/rails60.gemfile
|
112
111
|
- gemfiles/rails61.gemfile
|
113
112
|
- gemfiles/rails70.gemfile
|
114
113
|
- lib/activestorage/validator.rb
|
@@ -118,7 +117,7 @@ homepage: https://github.com/aki77/activestorage-validator
|
|
118
117
|
licenses:
|
119
118
|
- MIT
|
120
119
|
metadata: {}
|
121
|
-
post_install_message:
|
120
|
+
post_install_message:
|
122
121
|
rdoc_options: []
|
123
122
|
require_paths:
|
124
123
|
- lib
|
@@ -126,15 +125,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
126
125
|
requirements:
|
127
126
|
- - ">="
|
128
127
|
- !ruby/object:Gem::Version
|
129
|
-
version:
|
128
|
+
version: 3.0.0
|
130
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
130
|
requirements:
|
132
131
|
- - ">="
|
133
132
|
- !ruby/object:Gem::Version
|
134
133
|
version: '0'
|
135
134
|
requirements: []
|
136
|
-
rubygems_version: 3.
|
137
|
-
signing_key:
|
135
|
+
rubygems_version: 3.3.7
|
136
|
+
signing_key:
|
138
137
|
specification_version: 4
|
139
138
|
summary: ActiveStorage blob validator.
|
140
139
|
test_files: []
|
data/.travis.yml
DELETED