activestorage-validator 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +54 -0
- data/.gitignore +2 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile +7 -2
- data/README.md +5 -0
- data/activestorage-validator.gemspec +2 -1
- data/config.ru +9 -0
- data/config/locales/pt-br.yml +7 -0
- data/gemfiles/rails52.gemfile +6 -0
- data/gemfiles/rails60.gemfile +6 -0
- data/lib/activestorage/validator.rb +4 -1
- data/lib/activestorage/validator/blob.rb +1 -1
- data/lib/activestorage/validator/version.rb +1 -1
- metadata +26 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 354d8f902cefe6a58a25fcc97f6bcae8c878b971be3e6b9f7689e4074ba3eb7d
|
4
|
+
data.tar.gz: 626b6ba362b037531daa1402387f788506ecf5cb7592cb1fd6c0e05c8a43d079
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30f39dbfc6c3a21a74590042072468bea28d910790cfbb67c5777cf403a405af5576cb5a1c4ccb775d39a0ce30c8d33d2f39c35633b0632d86f51316b0506fab
|
7
|
+
data.tar.gz: 809232803f18f3fd3769591376439aa171c9aa4710ad923f1212a61fbefa0524377dc0d58077f6ff6064eb739cbf508b9922007272df3b291aad7c76214ff8aa
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Build
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
|
15
|
+
jobs:
|
16
|
+
rspec:
|
17
|
+
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
env:
|
20
|
+
BUNDLE_JOBS: 4
|
21
|
+
BUNDLE_RETRY: 3
|
22
|
+
strategy:
|
23
|
+
fail-fast: false
|
24
|
+
matrix:
|
25
|
+
ruby: [2.6, 2.7]
|
26
|
+
gemfile: [
|
27
|
+
"gemfiles/rails52.gemfile",
|
28
|
+
"gemfiles/rails60.gemfile",
|
29
|
+
]
|
30
|
+
steps:
|
31
|
+
- name: Install packages
|
32
|
+
run: |
|
33
|
+
sudo apt update -y
|
34
|
+
sudo apt install -y libsqlite3-dev
|
35
|
+
- uses: actions/checkout@v2
|
36
|
+
- uses: actions/cache@v1
|
37
|
+
with:
|
38
|
+
path: /home/runner/bundle
|
39
|
+
key: bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles(matrix.gemfile) }}-${{ hashFiles('**/*.gemspec') }}
|
40
|
+
restore-keys: |
|
41
|
+
bundle-${{ matrix.ruby }}-${{ matrix.gemfile }}-
|
42
|
+
- name: Set up Ruby
|
43
|
+
uses: ruby/setup-ruby@v1
|
44
|
+
with:
|
45
|
+
ruby-version: ${{ matrix.ruby }}
|
46
|
+
- name: Install dependencies
|
47
|
+
run: |
|
48
|
+
bundle config path /home/runner/bundle
|
49
|
+
bundle config --global gemfile ${{ matrix.gemfile }}
|
50
|
+
bundle install
|
51
|
+
bundle update
|
52
|
+
bundle clean
|
53
|
+
- name: Run rspec
|
54
|
+
run: bundle exec rspec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -5,5 +5,10 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
5
5
|
# Specify your gem's dependencies in activestorage-validator.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
local_gemfile = "Gemfile.local"
|
9
|
+
|
10
|
+
if File.exist?(local_gemfile)
|
11
|
+
eval_gemfile(local_gemfile) # rubocop:disable Security/Eval
|
12
|
+
else
|
13
|
+
gem 'sqlite3'
|
14
|
+
end
|
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/activestorage-validator.svg)](https://rubygems.org/gems/activestorage-validator)
|
2
|
+
[![Build](https://github.com/aki77/activestorage-validator/workflows/Build/badge.svg)](https://github.com/aki77/activestorage-validator/actions)
|
3
|
+
|
1
4
|
# ActiveStorage Validator
|
2
5
|
|
3
6
|
ActiveStorage blob validator.
|
@@ -31,6 +34,8 @@ class User < ApplicationRecord
|
|
31
34
|
end
|
32
35
|
```
|
33
36
|
|
37
|
+
Note: For `has_many_attached`, size is validated on each file individually. In the code above, `:photos` validation allows any number of photos to be upload, each one being 5 MB or less in size.
|
38
|
+
|
34
39
|
## Contributing
|
35
40
|
|
36
41
|
Bug reports and pull requests are welcome on GitHub at https://github.com/aki77/activestorage-validator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
|
26
26
|
spec.add_dependency "rails", ">= 5.2.0"
|
27
27
|
spec.add_development_dependency "bundler", "~> 2.0"
|
28
|
-
spec.add_development_dependency "rake", "
|
28
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
29
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
30
|
+
spec.add_development_dependency "combustion"
|
30
31
|
end
|
data/config.ru
ADDED
@@ -1,6 +1,9 @@
|
|
1
|
-
require 'activestorage/validator/blob'
|
2
1
|
require 'activestorage/validator/version'
|
3
2
|
|
3
|
+
ActiveSupport.on_load(:active_record) do
|
4
|
+
require 'activestorage/validator/blob'
|
5
|
+
end
|
6
|
+
|
4
7
|
module ActiveStorage
|
5
8
|
# https://github.com/rails/rails/commit/42259ce904eb2538761b32a793cbe390fb8272b7
|
6
9
|
if Rails::VERSION::MAJOR < 6
|
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.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 12.3.3
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 12.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: combustion
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: ActiveStorage blob validator.
|
70
84
|
email:
|
71
85
|
- aki77@users.noreply.github.com
|
@@ -73,6 +87,7 @@ executables: []
|
|
73
87
|
extensions: []
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
90
|
+
- ".github/workflows/rspec.yml"
|
76
91
|
- ".gitignore"
|
77
92
|
- ".rspec"
|
78
93
|
- ".travis.yml"
|
@@ -85,9 +100,13 @@ files:
|
|
85
100
|
- activestorage-validator.gemspec
|
86
101
|
- bin/console
|
87
102
|
- bin/setup
|
103
|
+
- config.ru
|
88
104
|
- config/locales/de.yml
|
89
105
|
- config/locales/en.yml
|
90
106
|
- config/locales/ja.yml
|
107
|
+
- config/locales/pt-br.yml
|
108
|
+
- gemfiles/rails52.gemfile
|
109
|
+
- gemfiles/rails60.gemfile
|
91
110
|
- lib/activestorage/validator.rb
|
92
111
|
- lib/activestorage/validator/blob.rb
|
93
112
|
- lib/activestorage/validator/version.rb
|
@@ -110,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
129
|
- !ruby/object:Gem::Version
|
111
130
|
version: '0'
|
112
131
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
132
|
+
rubygems_version: 3.1.2
|
114
133
|
signing_key:
|
115
134
|
specification_version: 4
|
116
135
|
summary: ActiveStorage blob validator.
|