active_storage_validations 3.0.0 → 3.0.1

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: 93e3cce4862a67b4676b924738a37a5e25ef31ad60ece364872aef2a0edc33c5
4
- data.tar.gz: bc62d1d25eeadf3361fff156d0c8dbab86b703039c7fdefb1d1d7a0bb21f2dcb
3
+ metadata.gz: 36bfc41c7b685fffb02f2fd8b19295777a0946d3725781baea5a8791adc72309
4
+ data.tar.gz: 35e2e50b228839fbb1d04110e4d1dfd85658d2ba1bc97f9a456be8ad03138f5f
5
5
  SHA512:
6
- metadata.gz: 2a3e38c9a90eca24b3a4c31b5910ba32fe042766a21e662dd7949e86304e5b07d405fbd319ce5142bad2029bf957bf6e65726d9966f1807e988fd50942102699
7
- data.tar.gz: 19d3e96320dbcb34febf7546d62ad556a892520b274d9b335f9a9d18b18c0539297328d5ad18886907cf83837f61deb40c2c43f8c51d949b72a251eb44dbbb1b
6
+ metadata.gz: f60144f1f2ad43afdffab4ef13fb0e6bce21c605896e894243796652db4317fa2b87c1b58c80269c79e0ab248adea2f4bab1de352d1979564f390ed6611ae482
7
+ data.tar.gz: e7e074643ae0d9cbc08b7fd871f11435b1fafab170af7cae3f241e8380a9c1911db4815a8bcdd2c82616d86448473b32de39cbaf4b761dad69ba01e9617d7be1
data/README.md CHANGED
@@ -20,6 +20,8 @@ This gems is doing it right for you! Just use `validates :avatar, attached: true
20
20
  - [Error messages (I18n)](#error-messages-i18n)
21
21
  - [Using image metadata validators](#using-image-metadata-validators)
22
22
  - [Using video and audio metadata validators](#using-video-and-audio-metadata-validators)
23
+ - [Using pdf metadata validators](#using-pdf-metadata-validators)
24
+ - [Using content type spoofing protection validator option](#using-content-type-spoofing-protection-validator-option)
23
25
  - [Validators](#validators)
24
26
  - [Attached](#attached)
25
27
  - [Limit](#limit)
@@ -74,12 +76,16 @@ Plus, you have to be sure to have the corresponding command-line tool installed
74
76
 
75
77
  To use the video and audio metadata validators (`dimension`, `aspect_ratio`, `processable_file` and `duration`), you will not need to add any gems. However you will need to have the `ffmpeg` command-line tool installed on your system (once again, be sure to have it installed both on your local and in your CI / production environments).
76
78
 
77
- If you want some inspiration about how to add `imagemagick`, `libvips` or `ffmpeg` to your docker image, you can check how we do it for the gem CI (https://github.com/igorkasyanchuk/active_storage_validations/blob/master/.github/workflows/main.yml)
79
+ ### Using pdf metadata validators
80
+
81
+ To use the pdf metadata validators (`dimension`, `aspect_ratio`, `processable_file` and `pages`), you will not need to add any gems. However you will need to have the `poppler` tool installed on your system (once again, be sure to have it installed both on your local and in your CI / production environments).
78
82
 
79
83
  ### Using content type spoofing protection validator option
80
84
 
81
85
  To use the `spoofing_protection` option with the `content_type` validator, you only need to have the UNIX `file` command on your system.
82
86
 
87
+ If you want some inspiration about how to add `imagemagick`, `libvips`, `ffmpeg` or `poppler` to your docker image, you can check how we do it for the gem CI (https://github.com/igorkasyanchuk/active_storage_validations/blob/master/.github/workflows/main.yml)
88
+
83
89
  ## Validators
84
90
 
85
91
  **List of validators:**
@@ -734,14 +740,14 @@ But this major version bump also comes with some breaking changes. Below are the
734
740
 
735
741
  ## Upgrading from 2.x to 3.x
736
742
 
737
- Version 3 comes with the ability to support single page pdf dimension / aspect_ratio analysis, we had to make a breaking change:
743
+ Version 3 comes with the ability to support single page pdf `dimension` / `aspect_ratio` analysis, we had to make a breaking change:
738
744
  - To analyze PDFs, you must install the `poppler` PDF processing dependency
739
745
  - It's a Rails-supported PDF processing dependency (https://guides.rubyonrails.org/active_storage_overview.html#requirements)
740
746
  - To install it, check their documentation at this [link](https://pdf2image.readthedocs.io/en/latest/installation.html).
741
747
  - To check if it's installed, execute `pdftoppm -h`.
742
748
  - To install this tool in your CI / production environments, you can check how we do it in our own CI (https://github.com/igorkasyanchuk/active_storage_validations/blob/master/.github/workflows/main.yml)
743
749
 
744
- We also added the `pages` validator to validate pdf number of pages, and the `equal_to` option to `duration`, `size`and `total_size` validators.
750
+ We also added the `pages` validator to validate pdf number of pages, and the `equal_to` option to `duration`, `size` and `total_size` validators.
745
751
 
746
752
  Note that, if you do not perform these metadata validations on pdfs, the gem will work the same as in version 2.
747
753
 
@@ -781,8 +787,8 @@ Matcher methods available:
781
787
  describe User do
782
788
  # aspect_ratio:
783
789
  # #allowing, #rejecting
784
- it { is_expected.to validate_aspect_ratio_of(:avatar).allowing(:square) }
785
- it { is_expected.to validate_aspect_ratio_of(:avatar).rejecting(:portrait) }
790
+ it { is_expected.to validate_aspect_ratio_of(:avatar).allowing(:square, :portrait) } # possible to use an Array or *splatted array
791
+ it { is_expected.to validate_aspect_ratio_of(:avatar).rejecting(:square, :landscape) } # possible to use an Array or *splatted array
786
792
 
787
793
  # attached
788
794
  it { is_expected.to validate_attached_of(:avatar) }
@@ -58,6 +58,6 @@ de:
58
58
  pages_not_less_than: "Die Seitenanzahl muss kleiner als %{max} sein (die aktuelle Seitenanzahl beträgt %{pages})."
59
59
  pages_not_less_than_or_equal_to: "Die Seitenanzahl muss kleiner oder gleich %{max} sein (die aktuelle Seitenanzahl beträgt %{pages})."
60
60
  pages_not_greater_than: "Die Seitenanzahl muss größer als %{min} sein (die aktuelle Seitenanzahl beträgt %{pages})."
61
- pages_not_greater_than_or_qual_to: "Die Seitenanzahl muss größer oder gleich %{min} sein (die aktuelle Seitenanzahl beträgt %{pages})."
61
+ pages_not_greater_than_or_equal_to: "Die Seitenanzahl muss größer oder gleich %{min} sein (die aktuelle Seitenanzahl beträgt %{pages})."
62
62
  pages_not_between: "Die Seitenanzahl muss zwischen %{min} und %{max} liegen (die aktuelle Seitenanzahl beträgt %{pages})."
63
- pages_not_qual_to: "Die Seitenanzahl muss gleich %{exact} sein (die aktuelle Seitenanzahl beträgt %{pages})."
63
+ pages_not_equal_to: "Die Seitenanzahl muss gleich %{exact} sein (die aktuelle Seitenanzahl beträgt %{pages})."
@@ -2,62 +2,62 @@ ja:
2
2
  errors:
3
3
  messages:
4
4
  content_type_invalid:
5
- one: "無効なコンテンツタイプがあります(許可されたコンテンツタイプは%{authorized_human_content_types}です)"
6
- other: "無効なコンテンツタイプがあります(許可されたコンテンツタイプは%{authorized_human_content_types}です)"
5
+ one: "のファイルタイプは許可されていません (許可されたファイルタイプは%{authorized_human_content_types})"
6
+ other: "のファイルタイプは許可されていません (許可されたファイルタイプは%{authorized_human_content_types})"
7
7
  content_type_spoofed:
8
- one: "コンテンツを通じて検出されたものと同等ではないコンテンツタイプがあります(許可されたコンテンツタイプは%{authorized_human_content_types}です)"
9
- other: "コンテンツを通じて検出されたものと同等ではないコンテンツタイプがあります(承認されたコンテンツタイプは%{authorized_human_content_types}です)"
10
- file_size_not_less_than: "ファイル サイズは %{max} 未満にする必要があります (現在のサイズは %{file_size})"
11
- file_size_not_less_than_or_equal_to: "ファイル サイズは %{max} 以下である必要があります (現在のサイズは %{file_size})"
12
- file_size_not_greater_than: "ファイル サイズは %{min} より大きい必要があります (現在のサイズは %{file_size} です)"
13
- file_size_not_greater_than_or_equal_to: "ファイル サイズは %{min} 以上である必要があります (現在のサイズは %{file_size})"
14
- file_size_not_between: "ファイル サイズは %{min} から %{max} の間でなければなりません (現在のサイズは %{file_size} です)"
15
- file_size_not_equal_to: "ファイル サイズは %{exact} にする必要があります (現在のサイズは %{file_size})"
16
- total_file_size_not_less_than: "ファイルの合計サイズは %{max} 未満である必要があります (現在のサイズは %{total_file_size})"
17
- total_file_size_not_less_than_or_equal_to: "ファイルの合計サイズは %{max} 以下である必要があります (現在のサイズは %{total_file_size})"
18
- total_file_size_not_greater_than: "ファイルの合計サイズは %{min} より大きくなければなりません (現在のサイズは %{total_file_size} です)"
19
- total_file_size_not_greater_than_or_equal_to: "ファイルの合計サイズは %{min} 以上である必要があります (現在のサイズは %{total_file_size})"
20
- total_file_size_not_between: "ファイルの合計サイズは %{min} から %{max} までである必要があります (現在のサイズは %{total_file_size})"
21
- total_file_size_not_equal_to: "ファイルの合計サイズは %{exact} にする必要があります (現在のサイズは %{total_file_size})"
22
- duration_not_less_than: "期間は%{max}未満である必要があります(現在の期間は%{duration})"
23
- duration_not_less_than_or_equal_to: "期間は%{max}以下でなければなりません(現在の期間は%{duration})"
24
- duration_not_greater_than: "期間は%{min}より大きくなければなりません(現在の期間は%{duration}です)"
25
- duration_not_greater_than_or_equal_to: "期間は%{min}以上である必要があります(現在の期間は%{duration})"
26
- duration_not_between: "期間は%{min}と%{max}の間でなければなりません(現在の期間は%{duration})"
27
- duration_not_equal_to: "期間は%{exact}と等しい必要があります(現在の期間は%{duration})"
8
+ one: "のファイルタイプがファイル内容から検出されたものと異なります (許可されたファイルタイプは%{authorized_human_content_types})"
9
+ other: "のファイルタイプがファイル内容から検出されたものと異なります (許可されたファイルタイプは%{authorized_human_content_types})"
10
+ file_size_not_less_than: "のファイルサイズは%{max}未満にしてください (添付ファイルのサイズは%{file_size})"
11
+ file_size_not_less_than_or_equal_to: "のファイルサイズは%{max}以下にしてください (添付ファイルのサイズは%{file_size})"
12
+ file_size_not_greater_than: "のファイルサイズは%{min}より大きくしてください (添付ファイルのサイズは%{file_size})"
13
+ file_size_not_greater_than_or_equal_to: "のファイルサイズは%{min}以上にしてください (添付ファイルのサイズは%{file_size})"
14
+ file_size_not_between: "のファイルサイズは%{min}以上%{max}以下にしてください (添付ファイルのサイズは%{file_size})"
15
+ file_size_not_equal_to: "のファイルサイズは%{exact}にしてください (添付ファイルのサイズは%{file_size})"
16
+ total_file_size_not_less_than: "のファイルサイズの合計は%{max}未満にしてください (添付ファイルのサイズは%{total_file_size})"
17
+ total_file_size_not_less_than_or_equal_to: "のファイルサイズの合計は%{max}以下にしてください (添付ファイルのサイズは%{total_file_size})"
18
+ total_file_size_not_greater_than: "のファイルサイズの合計は%{min}より大きくしてください (添付ファイルのサイズは%{total_file_size})"
19
+ total_file_size_not_greater_than_or_equal_to: "のファイルサイズの合計は%{min}以上してください (添付ファイルのサイズは%{total_file_size})"
20
+ total_file_size_not_between: "のファイルサイズの合計は%{min}以上%{max}以下にしてください (添付ファイルのサイズは%{total_file_size})"
21
+ total_file_size_not_equal_to: "のファイルサイズの合計は%{exact}にしてください (添付ファイルのサイズは%{total_file_size})"
22
+ duration_not_less_than: "の再生時間は%{max}未満にしてください (添付ファイルの再生時間は%{duration})"
23
+ duration_not_less_than_or_equal_to: "の再生時間は%{max}以下にしてください (添付ファイルの再生時間は%{duration})"
24
+ duration_not_greater_than: "の再生時間は%{min}より大きくしてください (添付ファイルの再生時間は%{duration})"
25
+ duration_not_greater_than_or_equal_to: "の再生時間は%{min}以上にしてください (添付ファイルの再生時間は%{duration})"
26
+ duration_not_between: "の再生時間は%{min}以上%{max}以下にしてください (添付ファイルの再生時間は%{duration})"
27
+ duration_not_equal_to: "の再生時間は%{exact}にしてください (添付ファイルの再生時間は%{duration})"
28
28
  limit_out_of_range:
29
- zero: "添付されたファイルはありません(%{min}と%{max}ファイルの間にある必要があります)"
30
- one: "1つのファイルのみが添付されています(%{min}と%{max}ファイルの間にある必要があります)"
31
- other: "ファイルの総数は、%{min}と%{max}ファイルの間でなければなりません(%{count}ファイルが添付されています)"
29
+ zero: "には%{min}件以上%{max}以下のファイルを添付してください (添付されたファイルは%{count}件)"
30
+ one: "には%{min}件以上%{max}以下のファイルを添付してください (添付されたファイルは%{count}件)"
31
+ other: "には%{min}件以上%{max}以下のファイルを添付してください (添付されたファイルは%{count})"
32
32
  limit_min_not_reached:
33
- zero: "添付されたファイルはありません(少なくとも%{min}ファイルが必要です)"
34
- one: "1つのファイルのみが添付されています(少なくとも%{min}ファイルが必要です)"
35
- other: "%{count}添付ファイル(少なくとも%{min}ファイルが必要です)"
33
+ zero: "には%{min}件以上のファイルを添付してください (添付されたファイルは%{count}件)"
34
+ one: "には%{min}件以上のファイルを添付してください (添付されたファイルは%{count}件)"
35
+ other: "には%{min}件以上のファイルを添付してください (添付されたファイルは%{count})"
36
36
  limit_max_exceeded:
37
- zero: "添付されたファイルはありません(最大は%{max}ファイル)"
38
- one: "添付されているファイルが多すぎます(最大は%{max}ファイル、%{count})"
39
- other: "添付されているファイルが多すぎます(最大は%{max}ファイル、%{count})"
40
- attachment_missing: "添付ファイルがありません"
41
- media_metadata_missing: "有効なメディアファイルではありません"
42
- dimension_min_not_included_in: "は %{width} x %{height} ピクセル以上の大きさにしてください"
43
- dimension_max_not_included_in: "は %{width} x %{height} ピクセル以下の大きさにしてください"
44
- dimension_width_not_included_in: "の横幅は %{min} ピクセル以上 %{max} ピクセル以下にしてください"
45
- dimension_height_not_included_in: "の縦幅は %{min} ピクセル以上 %{max} ピクセル以下にしてください"
46
- dimension_width_not_greater_than_or_equal_to: "の横幅は %{length} ピクセル以上にしてください"
47
- dimension_height_not_greater_than_or_equal_to: "の縦幅は %{length} ピクセル以上にしてください"
48
- dimension_width_not_less_than_or_equal_to: "の横幅は %{length} ピクセル以下にしてください"
49
- dimension_height_not_less_than_or_equal_to: "の縦幅は %{length} ピクセル以下にしてください"
50
- dimension_width_not_equal_to: "の横幅は %{length} ピクセルにしてください"
51
- dimension_height_not_equal_to: "の縦幅は %{length} ピクセルにしてください"
52
- aspect_ratio_not_square: "は正方形である必要があります(現在のファイルは%{width}x%{height})"
53
- aspect_ratio_not_portrait: "は縦長である必要があります(現在のファイルは%{width}x%{height})"
54
- aspect_ratio_not_landscape: "は横長である必要があります(現在のファイルは%{width}x%{height})"
55
- aspect_ratio_not_x_y: "は%{authorized_aspect_ratios}である必要があります(現在のファイルは%{width}x%{height})"
56
- aspect_ratio_invalid: "は無効なアスペクト比です(有効なアスペクト比は%{authorized_aspect_ratios}です)"
57
- file_not_processable: "は無効なメディアファイルです"
58
- pages_not_less_than: "ページ数は %{max} 未満である必要があります (現在のページ数は %{pages} です)"
59
- pages_not_less_than_or_equal_to: "ページ数は %{max} 以下である必要があります (現在のページ数は %{pages} です)"
60
- pages_not_greater_than: "ページ数は %{min} より大きい必要があります (現在のページ数は %{pages} です)"
61
- pages_not_greater_than_or_equal_to: "ページ数は %{min} 以上である必要があります (現在のページ数は %{pages} です)"
62
- pages_not_between: "ページ数は %{min} から %{max} の間である必要があります (現在のページ数は %{pages} です)"
63
- pages_not_equal_to: "ページ数は %{exact} と等しい必要があります (現在のページ数は%{pages})"
37
+ zero: "には%{max}件以下のファイルを添付してください (添付されたファイルは%{count}件)"
38
+ one: "には%{max}件以下のファイルを添付してください (添付されたファイルは%{count})"
39
+ other: "には%{max}件以下のファイルを添付してください (添付されたファイルは%{count})"
40
+ attachment_missing: "にファイルを添付してください"
41
+ media_metadata_missing: "のメディアのメタデータを検出できません"
42
+ dimension_min_not_included_in: "の解像度は%{width}x%{height}ピクセル以上にしてください"
43
+ dimension_max_not_included_in: "の解像度は%{width}x%{height}ピクセル以下にしてください"
44
+ dimension_width_not_included_in: "の横幅は%{min}ピクセル以上%{max}ピクセル以下にしてください"
45
+ dimension_height_not_included_in: "の縦幅は%{min}ピクセル以上%{max}ピクセル以下にしてください"
46
+ dimension_width_not_greater_than_or_equal_to: "の横幅は%{length}ピクセル以上にしてください"
47
+ dimension_height_not_greater_than_or_equal_to: "の縦幅は%{length}ピクセル以上にしてください"
48
+ dimension_width_not_less_than_or_equal_to: "の横幅は%{length}ピクセル以下にしてください"
49
+ dimension_height_not_less_than_or_equal_to: "の縦幅は%{length}ピクセル以下にしてください"
50
+ dimension_width_not_equal_to: "の横幅は%{length}ピクセルにしてください"
51
+ dimension_height_not_equal_to: "の縦幅は%{length}ピクセルにしてください"
52
+ aspect_ratio_not_square: "のアスペクト比は等しくしてください (添付されたメディアの解像度は%{width}x%{height})"
53
+ aspect_ratio_not_portrait: "のアスペクト比は縦長にしてください (添付されたメディアの解像度は%{width}x%{height})"
54
+ aspect_ratio_not_landscape: "のアスペクト比は横長にしてください (添付されたメディアの解像度は%{width}x%{height})"
55
+ aspect_ratio_not_x_y: "のアスペクト比は%{authorized_aspect_ratios}にしてください (添付されたメディアの解像度は%{width}x%{height})"
56
+ aspect_ratio_invalid: "のアスペクト比を検出できません (許可されたアスペクト比は%{authorized_aspect_ratios})"
57
+ file_not_processable: "のメディアを処理できません"
58
+ pages_not_less_than: "のページ数は%{max}未満にしてください (添付されたファイルは%{pages}ページ)"
59
+ pages_not_less_than_or_equal_to: "のページ数は%{max}以下にしてください (添付されたファイルは%{pages}ページ)"
60
+ pages_not_greater_than: "のページ数は%{min}より大きくしてください (添付されたファイルは%{pages}ページ)"
61
+ pages_not_greater_than_or_equal_to: "のページ数は%{min}以上にしてください (添付されたファイルは%{pages}ページ)"
62
+ pages_not_between: "のページ数は%{min}以上%{max}以下にしてください (添付されたファイルは%{pages}ページ)"
63
+ pages_not_equal_to: "のページ数は%{exact}にしてください (添付されたファイルは%{pages}ページ)"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveStorageValidations
4
- VERSION = "3.0.0"
4
+ VERSION = "3.0.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage_validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Kasyanchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-28 00:00:00.000000000 Z
11
+ date: 2025-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob