activestorage-validator 0.1.0 → 0.1.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: a021d8b583438be10d8c5c4c888a1bc73df0f1c4da39e8e3d5c17185173ffac9
4
- data.tar.gz: 4f9f5841b1b3619d354c2ddec01a3b99a978b1b04810b6f157f52dda3d886e97
3
+ metadata.gz: 77d1ae10da54133ba2ab8776eb4c2f0ac671b025a9de6d790d27600a966f79cf
4
+ data.tar.gz: 159dc5d99a34bdea7fc2a1790be65466d1c06a7004cd31ff59f01a86724cb8b9
5
5
  SHA512:
6
- metadata.gz: b0d83e53fa6a761f1a4468495eb6ed316e8deabc845b64812e82057a30cd7851b163f3928b81f2eb5adfb5f55c94d94ec2805b9235859f43a072a71597f09796
7
- data.tar.gz: 7c241829ad5520c264ae73fcd54582c836e2b3ce71b6f8fef7bc69dbb41eaf6a250fd81d4e36feaaeab11df4db20668c98b2d3eb1328c410e6e65f0c1ee251c2
6
+ metadata.gz: 287d4bf2a5f22ad26cd23276e6299ce209b50157b626bda4105112004e4592d09bfb82c384e451cea9a2e3c674d31b37c23bc0b77f7f72f3b668e518d9bf28c9
7
+ data.tar.gz: d154f704dc0c112a1da4f1506ff6b63fbb1ed17c1d449074b6eeedf1522e2525efa18d30ca570429994fe5a4c9ae4138e703b5442296707ca9b1e5b064d37233
@@ -1,3 +1,7 @@
1
+ ## 0.1.1
2
+
3
+ - Add default error messages
4
+
1
5
  ## 0.1.0
2
6
 
3
7
  - First Release
@@ -1,102 +1,102 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- activestorage-validator (0.1.0)
4
+ activestorage-validator (0.1.1)
5
5
  rails (~> 5.2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (5.2.1)
11
- actionpack (= 5.2.1)
10
+ actioncable (5.2.2)
11
+ actionpack (= 5.2.2)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
- actionmailer (5.2.1)
15
- actionpack (= 5.2.1)
16
- actionview (= 5.2.1)
17
- activejob (= 5.2.1)
14
+ actionmailer (5.2.2)
15
+ actionpack (= 5.2.2)
16
+ actionview (= 5.2.2)
17
+ activejob (= 5.2.2)
18
18
  mail (~> 2.5, >= 2.5.4)
19
19
  rails-dom-testing (~> 2.0)
20
- actionpack (5.2.1)
21
- actionview (= 5.2.1)
22
- activesupport (= 5.2.1)
20
+ actionpack (5.2.2)
21
+ actionview (= 5.2.2)
22
+ activesupport (= 5.2.2)
23
23
  rack (~> 2.0)
24
24
  rack-test (>= 0.6.3)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- actionview (5.2.1)
28
- activesupport (= 5.2.1)
27
+ actionview (5.2.2)
28
+ activesupport (= 5.2.2)
29
29
  builder (~> 3.1)
30
30
  erubi (~> 1.4)
31
31
  rails-dom-testing (~> 2.0)
32
32
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
- activejob (5.2.1)
34
- activesupport (= 5.2.1)
33
+ activejob (5.2.2)
34
+ activesupport (= 5.2.2)
35
35
  globalid (>= 0.3.6)
36
- activemodel (5.2.1)
37
- activesupport (= 5.2.1)
38
- activerecord (5.2.1)
39
- activemodel (= 5.2.1)
40
- activesupport (= 5.2.1)
36
+ activemodel (5.2.2)
37
+ activesupport (= 5.2.2)
38
+ activerecord (5.2.2)
39
+ activemodel (= 5.2.2)
40
+ activesupport (= 5.2.2)
41
41
  arel (>= 9.0)
42
- activestorage (5.2.1)
43
- actionpack (= 5.2.1)
44
- activerecord (= 5.2.1)
42
+ activestorage (5.2.2)
43
+ actionpack (= 5.2.2)
44
+ activerecord (= 5.2.2)
45
45
  marcel (~> 0.3.1)
46
- activesupport (5.2.1)
46
+ activesupport (5.2.2)
47
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
48
48
  i18n (>= 0.7, < 2)
49
49
  minitest (~> 5.1)
50
50
  tzinfo (~> 1.1)
51
51
  arel (9.0.0)
52
52
  builder (3.2.3)
53
- concurrent-ruby (1.0.5)
53
+ concurrent-ruby (1.1.4)
54
54
  crass (1.0.4)
55
55
  diff-lcs (1.3)
56
56
  erubi (1.7.1)
57
57
  globalid (0.4.1)
58
58
  activesupport (>= 4.2.0)
59
- i18n (1.1.0)
59
+ i18n (1.2.0)
60
60
  concurrent-ruby (~> 1.0)
61
- loofah (2.2.2)
61
+ loofah (2.2.3)
62
62
  crass (~> 1.0.2)
63
63
  nokogiri (>= 1.5.9)
64
- mail (2.7.0)
64
+ mail (2.7.1)
65
65
  mini_mime (>= 0.1.1)
66
66
  marcel (0.3.3)
67
67
  mimemagic (~> 0.3.2)
68
- method_source (0.9.0)
68
+ method_source (0.9.2)
69
69
  mimemagic (0.3.2)
70
70
  mini_mime (1.0.1)
71
- mini_portile2 (2.3.0)
71
+ mini_portile2 (2.4.0)
72
72
  minitest (5.11.3)
73
73
  nio4r (2.3.1)
74
- nokogiri (1.8.4)
75
- mini_portile2 (~> 2.3.0)
76
- rack (2.0.5)
74
+ nokogiri (1.9.0)
75
+ mini_portile2 (~> 2.4.0)
76
+ rack (2.0.6)
77
77
  rack-test (1.1.0)
78
78
  rack (>= 1.0, < 3)
79
- rails (5.2.1)
80
- actioncable (= 5.2.1)
81
- actionmailer (= 5.2.1)
82
- actionpack (= 5.2.1)
83
- actionview (= 5.2.1)
84
- activejob (= 5.2.1)
85
- activemodel (= 5.2.1)
86
- activerecord (= 5.2.1)
87
- activestorage (= 5.2.1)
88
- activesupport (= 5.2.1)
79
+ rails (5.2.2)
80
+ actioncable (= 5.2.2)
81
+ actionmailer (= 5.2.2)
82
+ actionpack (= 5.2.2)
83
+ actionview (= 5.2.2)
84
+ activejob (= 5.2.2)
85
+ activemodel (= 5.2.2)
86
+ activerecord (= 5.2.2)
87
+ activestorage (= 5.2.2)
88
+ activesupport (= 5.2.2)
89
89
  bundler (>= 1.3.0)
90
- railties (= 5.2.1)
90
+ railties (= 5.2.2)
91
91
  sprockets-rails (>= 2.0.0)
92
92
  rails-dom-testing (2.0.3)
93
93
  activesupport (>= 4.2.0)
94
94
  nokogiri (>= 1.6)
95
95
  rails-html-sanitizer (1.0.4)
96
96
  loofah (~> 2.2, >= 2.2.2)
97
- railties (5.2.1)
98
- actionpack (= 5.2.1)
99
- activesupport (= 5.2.1)
97
+ railties (5.2.2)
98
+ actionpack (= 5.2.2)
99
+ activesupport (= 5.2.2)
100
100
  method_source
101
101
  rake (>= 0.8.7)
102
102
  thor (>= 0.19.0, < 2.0)
@@ -122,7 +122,7 @@ GEM
122
122
  activesupport (>= 4.0)
123
123
  sprockets (>= 3.0.0)
124
124
  sqlite3 (1.3.13)
125
- thor (0.20.0)
125
+ thor (0.20.3)
126
126
  thread_safe (0.3.6)
127
127
  tzinfo (1.2.5)
128
128
  thread_safe (~> 0.1)
@@ -141,4 +141,4 @@ DEPENDENCIES
141
141
  sqlite3
142
142
 
143
143
  BUNDLED WITH
144
- 1.16.2
144
+ 1.17.1
data/README.md CHANGED
@@ -25,8 +25,9 @@ class User < ApplicationRecord
25
25
  has_one_attached :avatar
26
26
  has_many_attached :photos
27
27
 
28
- validates :avatar, precence: true, blob: { content_type: :image }
29
- validates :photos, precence: true, blob: { content_type: ['image/png', 'image/jpg', 'image/jpeg'], size_range: 1..5.megabytes }
28
+ validates :avatar, presence: true, blob: { content_type: :image } # supported options: :image, :audio, :video, :text
29
+ validates :photos, presence: true, blob: { content_type: ['image/png', 'image/jpg', 'image/jpeg'], size_range: 1..5.megabytes }
30
+ # validates :photos, presence: true, blob: { content_type: %r{^image/}, size_range: 1..5.megabytes }
30
31
  end
31
32
  ```
32
33
 
@@ -5,7 +5,7 @@ require "activestorage/validator/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "activestorage-validator"
8
- spec.version = Activestorage::Validator::VERSION
8
+ spec.version = ActiveStorage::Validator::VERSION
9
9
  spec.authors = ["aki"]
10
10
  spec.email = ["aki77@users.noreply.github.com"]
11
11
 
@@ -0,0 +1,7 @@
1
+ en:
2
+ activerecord:
3
+ errors:
4
+ messages:
5
+ content_type: "is not a valid file format"
6
+ min_size_error: "File size should be greater than %{min_size}"
7
+ max_size_error: "File size should be less than %{max_size}"
@@ -0,0 +1,7 @@
1
+ ja:
2
+ activerecord:
3
+ errors:
4
+ messages:
5
+ content_type: "のファイル形式が不正です。"
6
+ min_size_error: "を%{max_size}以上のサイズにしてください。"
7
+ max_size_error: "を%{max_size}以下のサイズにしてください。"
@@ -11,3 +11,5 @@ module ActiveStorage
11
11
  end
12
12
  end
13
13
  end
14
+
15
+ I18n.load_path += Dir[File.expand_path(File.join(__dir__, '../../config/locales', '*.yml')).to_s]
@@ -1,5 +1,5 @@
1
- module Activestorage
1
+ module ActiveStorage
2
2
  module Validator
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-18 00:00:00.000000000 Z
11
+ date: 2019-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,6 +86,8 @@ files:
86
86
  - activestorage-validator.gemspec
87
87
  - bin/console
88
88
  - bin/setup
89
+ - config/locales/en.yml
90
+ - config/locales/ja.yml
89
91
  - lib/activestorage/validator.rb
90
92
  - lib/activestorage/validator/blob.rb
91
93
  - lib/activestorage/validator/version.rb