activestorage-validator 0.2.2 → 0.4.0

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: 7794a4dee965852bef0ebf772d56444e8fead4da8af495ebc385a22c8772a4f5
4
- data.tar.gz: ed0e09adaea48bd600efe763be83dc8d97644a60c24d56e6dba4f2f7ccfe81fe
3
+ metadata.gz: c09a9b8ded80c3fe2be9547622aa8408fbdd9c7cd4a1beee2ab1425809f62ba9
4
+ data.tar.gz: 841c661ce228726b1fa7c28adcabe006bb561c50122e317b9fb628b8ebfc6630
5
5
  SHA512:
6
- metadata.gz: e35d5f61512ff3cf914bd88c5420fed81b86f758b54d545761d7d76cbc57150649badc9e0a63facedfce8be2df2ca423d12b51b1ae0b5c69ed262e14fc9f6ae8
7
- data.tar.gz: 8f32cebdb515d387a6df86f7dd51cab61acc3cf0cdf66059c23d0127ed6e933deeff010880c318243b95e186aca6ebfd57bcc25b86ef72bb4fa6255abfb48577
6
+ metadata.gz: 5ec8362922c900e8ace6185e8c23a40a8a366c671a341397189e6035eeda0c1ca8826d49ae0d244bcbcaa655d2dbe6df367640914bb5e0edf54d143be03ecb5c
7
+ data.tar.gz: 3528baa631ad61e40c0a04785dd92bbc60af1b442d843be91956a64c9db082085aa6ea15024ee4f37e026aeb88bfcee8e05c2a8561be422a6768a427831bc48d
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: github-actions
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
@@ -22,18 +22,15 @@ jobs:
22
22
  strategy:
23
23
  fail-fast: false
24
24
  matrix:
25
- ruby: [2.7, '3.0', 3.1]
26
- gemfile: [rails60, rails61, rails70]
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@v2
33
+ - uses: actions/checkout@v3
37
34
 
38
35
  - name: Set up Ruby
39
36
  uses: ruby/setup-ruby@v1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## 0.4.0
4
+
5
+ - Add `content_type: :web_image` options
6
+
7
+ ## 0.3.0
8
+
9
+ - Drop support for rails 6.0
10
+
3
11
  ## 0.2.2
4
12
 
5
13
  - Add polish locale (#29)
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,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.add_dependency "rails", ">= 6.0.4.1"
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
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module Validator
3
- VERSION = '0.2.2'
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.2.2
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: 2022-07-07 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
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 6.0.4.1
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.4.1
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: '0'
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.1.2
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
@@ -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
@@ -1,6 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem 'rails', '6.0.4.1'
4
- gem 'sqlite3'
5
-
6
- gemspec path: '../'