activestorage-validator 0.3.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c2a3e9f4b202495bb55e509e437f4f2e668574fcaf88a6c14d785a139bb22fb
4
- data.tar.gz: 417964ec62b0a599af5310c6f49de8686e453ed547dfe47c21105dc8e8ac2991
3
+ metadata.gz: c09a9b8ded80c3fe2be9547622aa8408fbdd9c7cd4a1beee2ab1425809f62ba9
4
+ data.tar.gz: 841c661ce228726b1fa7c28adcabe006bb561c50122e317b9fb628b8ebfc6630
5
5
  SHA512:
6
- metadata.gz: e3a499373b966040d39d26fc2ad2610b0dd3f150032b0743cf9e6a9a57077efd85c183eaebfe388e38e2d490779273ddbe2c35dc9694f2fc5efed5572451c030
7
- data.tar.gz: 4b64b3eba04af4da47d0cf14c1443af36c0027b70c0e72531dc7800f193eb71b821791f641243e056a4a6e8f7d623677729713ec426e2bf9190471ba2fdcade6
6
+ metadata.gz: 5ec8362922c900e8ace6185e8c23a40a8a366c671a341397189e6035eeda0c1ca8826d49ae0d244bcbcaa655d2dbe6df367640914bb5e0edf54d143be03ecb5c
7
+ data.tar.gz: 3528baa631ad61e40c0a04785dd92bbc60af1b442d843be91956a64c9db082085aa6ea15024ee4f37e026aeb88bfcee8e05c2a8561be422a6768a427831bc48d
@@ -30,7 +30,7 @@ jobs:
30
30
  sudo apt update -y
31
31
  sudo apt install -y libsqlite3-dev
32
32
 
33
- - uses: actions/checkout@v2
33
+ - uses: actions/checkout@v3
34
34
 
35
35
  - name: Set up Ruby
36
36
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## 0.4.0
4
+
5
+ - Add `content_type: :web_image` options
6
+
3
7
  ## 0.3.0
4
8
 
5
9
  - Drop support for rails 6.0
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: :image } # supported options: :image, :audio, :video, :text
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,6 +23,8 @@ 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.required_ruby_version = '>= 3.0.0'
27
+
26
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,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
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module Validator
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
@@ -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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-01 00:00:00.000000000 Z
11
+ date: 2023-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -91,7 +91,6 @@ files:
91
91
  - ".github/workflows/rspec.yml"
92
92
  - ".gitignore"
93
93
  - ".rspec"
94
- - ".travis.yml"
95
94
  - CHANGELOG.md
96
95
  - CODE_OF_CONDUCT.md
97
96
  - Gemfile
@@ -126,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
125
  requirements:
127
126
  - - ">="
128
127
  - !ruby/object:Gem::Version
129
- version: '0'
128
+ version: 3.0.0
130
129
  required_rubygems_version: !ruby/object:Gem::Requirement
131
130
  requirements:
132
131
  - - ">="
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.1
5
- before_install: gem install bundler -v 1.16.2