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 +4 -4
- data/README.md +11 -5
- data/config/locales/de.yml +2 -2
- data/config/locales/ja.yml +55 -55
- data/lib/active_storage_validations/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bfc41c7b685fffb02f2fd8b19295777a0946d3725781baea5a8791adc72309
|
4
|
+
data.tar.gz: 35e2e50b228839fbb1d04110e4d1dfd85658d2ba1bc97f9a456be8ad03138f5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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(:
|
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) }
|
data/config/locales/de.yml
CHANGED
@@ -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
|
-
|
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
|
-
|
63
|
+
pages_not_equal_to: "Die Seitenanzahl muss gleich %{exact} sein (die aktuelle Seitenanzahl beträgt %{pages})."
|
data/config/locales/ja.yml
CHANGED
@@ -2,62 +2,62 @@ ja:
|
|
2
2
|
errors:
|
3
3
|
messages:
|
4
4
|
content_type_invalid:
|
5
|
-
one: "
|
6
|
-
other: "
|
5
|
+
one: "のファイルタイプは許可されていません (許可されたファイルタイプは%{authorized_human_content_types})"
|
6
|
+
other: "のファイルタイプは許可されていません (許可されたファイルタイプは%{authorized_human_content_types})"
|
7
7
|
content_type_spoofed:
|
8
|
-
one: "
|
9
|
-
other: "
|
10
|
-
file_size_not_less_than: "
|
11
|
-
file_size_not_less_than_or_equal_to: "
|
12
|
-
file_size_not_greater_than: "
|
13
|
-
file_size_not_greater_than_or_equal_to: "
|
14
|
-
file_size_not_between: "
|
15
|
-
file_size_not_equal_to: "
|
16
|
-
total_file_size_not_less_than: "
|
17
|
-
total_file_size_not_less_than_or_equal_to: "
|
18
|
-
total_file_size_not_greater_than: "
|
19
|
-
total_file_size_not_greater_than_or_equal_to: "
|
20
|
-
total_file_size_not_between: "
|
21
|
-
total_file_size_not_equal_to: "
|
22
|
-
duration_not_less_than: "
|
23
|
-
duration_not_less_than_or_equal_to: "
|
24
|
-
duration_not_greater_than: "
|
25
|
-
duration_not_greater_than_or_equal_to: "
|
26
|
-
duration_not_between: "
|
27
|
-
duration_not_equal_to: "
|
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: "
|
30
|
-
one: "
|
31
|
-
other: "
|
29
|
+
zero: "には%{min}件以上%{max}以下のファイルを添付してください (添付されたファイルは%{count}件)"
|
30
|
+
one: "には%{min}件以上%{max}以下のファイルを添付してください (添付されたファイルは%{count}件)"
|
31
|
+
other: "には%{min}件以上%{max}以下のファイルを添付してください (添付されたファイルは%{count}件)"
|
32
32
|
limit_min_not_reached:
|
33
|
-
zero: "
|
34
|
-
one: "
|
35
|
-
other: "
|
33
|
+
zero: "には%{min}件以上のファイルを添付してください (添付されたファイルは%{count}件)"
|
34
|
+
one: "には%{min}件以上のファイルを添付してください (添付されたファイルは%{count}件)"
|
35
|
+
other: "には%{min}件以上のファイルを添付してください (添付されたファイルは%{count}件)"
|
36
36
|
limit_max_exceeded:
|
37
|
-
zero: "
|
38
|
-
one: "
|
39
|
-
other: "
|
40
|
-
attachment_missing: "
|
41
|
-
media_metadata_missing: "
|
42
|
-
dimension_min_not_included_in: "
|
43
|
-
dimension_max_not_included_in: "
|
44
|
-
dimension_width_not_included_in: "
|
45
|
-
dimension_height_not_included_in: "
|
46
|
-
dimension_width_not_greater_than_or_equal_to: "
|
47
|
-
dimension_height_not_greater_than_or_equal_to: "
|
48
|
-
dimension_width_not_less_than_or_equal_to: "
|
49
|
-
dimension_height_not_less_than_or_equal_to: "
|
50
|
-
dimension_width_not_equal_to: "
|
51
|
-
dimension_height_not_equal_to: "
|
52
|
-
aspect_ratio_not_square: "
|
53
|
-
aspect_ratio_not_portrait: "
|
54
|
-
aspect_ratio_not_landscape: "
|
55
|
-
aspect_ratio_not_x_y: "
|
56
|
-
aspect_ratio_invalid: "
|
57
|
-
file_not_processable: "
|
58
|
-
pages_not_less_than: "
|
59
|
-
pages_not_less_than_or_equal_to: "
|
60
|
-
pages_not_greater_than: "
|
61
|
-
pages_not_greater_than_or_equal_to: "
|
62
|
-
pages_not_between: "
|
63
|
-
pages_not_equal_to: "
|
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}ページ)"
|
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.
|
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-
|
11
|
+
date: 2025-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|