antivirus 0.0.1 → 0.0.2
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/.gitignore +4 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/README.md +2 -3
- data/antivirus.gemspec +21 -0
- data/lib/antivirus.rb +1 -0
- data/lib/antivirus/railtie.rb +1 -3
- data/lib/antivirus/validator.rb +1 -1
- data/lib/antivirus/version.rb +1 -1
- data/spec/dummy/application.rb +36 -0
- data/spec/dummy/bin/rails +5 -0
- data/spec/dummy/config.ru +1 -0
- data/spec/dummy/config/locales/en.yml +6 -0
- data/spec/models/post_spec.rb +27 -0
- data/spec/spec_helper.rb +7 -0
- metadata +18 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68506dbc5c0ffff2c0c4fa00bd5e72c2c2935d2b
|
4
|
+
data.tar.gz: e36724195f987c2436630fe57c16ef9a23d69f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e694e6360c17a7d5e57c7c088eb93048e4f649ad759fd0e2cf7fc0409c54729631214086c095517a7a3bb1d3828f027ce783cc6c12732653fd1ffba3846c61
|
7
|
+
data.tar.gz: de98b2cc523f516160258afc0e1ec089456f0a4faef505146426042f69d34c98474160e6f0f72534c1c1cab5e06353eb21a464fb64d81c71505a5e0653510f78
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -21,10 +21,9 @@ $ bundle
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
-
|
25
|
-
You can define profane words in `antivirus.profane_words`.
|
24
|
+
Define profane words as array in `config/locales/*.yml` with `antivirus.profane_words` key.
|
26
25
|
|
27
|
-
`antivirus.message` is an error message when
|
26
|
+
`antivirus.message` key is an error message when value includes profane words.
|
28
27
|
|
29
28
|
```yml
|
30
29
|
en:
|
data/antivirus.gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'antivirus/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'antivirus'
|
7
|
+
s.version = Antivirus::VERSION
|
8
|
+
s.authors = 'kami'
|
9
|
+
s.email = 'kami30k@gmail.com'
|
10
|
+
s.homepage = 'https://github.com/kami30k/antivirus'
|
11
|
+
s.summary = 'Profanity filter for Rails application.'
|
12
|
+
s.description = 'Profanity filter for Rails application.'
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.files = `git ls-files -z`.split("\x0")
|
16
|
+
|
17
|
+
s.add_dependency 'rails'
|
18
|
+
|
19
|
+
s.add_development_dependency 'sqlite3'
|
20
|
+
s.add_development_dependency 'rspec-rails'
|
21
|
+
end
|
data/lib/antivirus.rb
CHANGED
data/lib/antivirus/railtie.rb
CHANGED
data/lib/antivirus/validator.rb
CHANGED
data/lib/antivirus/version.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
$:.unshift File.expand_path('../../../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'action_controller/railtie'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
require 'antivirus'
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
config.secret_token = 'abcdefghijklmnopqrstuvwxyz0123456789'
|
11
|
+
config.session_store :cookie_store, key: '_dummy_session'
|
12
|
+
config.eager_load = false
|
13
|
+
config.active_support.deprecation = :log
|
14
|
+
config.i18n.load_path += Dir[Rails.root.join('spec/dummy/config/locales/*.yml')]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Dummy::Application.initialize!
|
19
|
+
|
20
|
+
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
|
21
|
+
|
22
|
+
class Post < ActiveRecord::Base
|
23
|
+
validates :content, profanity_filter: true
|
24
|
+
end
|
25
|
+
|
26
|
+
class CreatePosts < ActiveRecord::Migration
|
27
|
+
def change
|
28
|
+
create_table :posts do |t|
|
29
|
+
t.text :content
|
30
|
+
|
31
|
+
t.timestamps null: true
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
CreatePosts.new.change
|
@@ -0,0 +1 @@
|
|
1
|
+
run Rails.application
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Post do
|
4
|
+
context 'when content is valid' do
|
5
|
+
let(:post) { Post.new(content: 'valid content') }
|
6
|
+
|
7
|
+
it 'should be valid' do
|
8
|
+
expect(post).to be_valid
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context 'when content equals profane word' do
|
13
|
+
let(:post) { Post.new(content: 'foo') }
|
14
|
+
|
15
|
+
it 'should not be valid' do
|
16
|
+
expect(post).not_to be_valid
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when content includes profane word' do
|
21
|
+
let(:post) { Post.new(content: 'foobarbaz') }
|
22
|
+
|
23
|
+
it 'should not be valid' do
|
24
|
+
expect(post).not_to be_valid
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: antivirus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kami
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '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:
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,19 +53,28 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Profanity filter for Rails application.
|
56
|
-
email:
|
57
|
-
- kami30k@gmail.com
|
56
|
+
email: kami30k@gmail.com
|
58
57
|
executables: []
|
59
58
|
extensions: []
|
60
59
|
extra_rdoc_files: []
|
61
60
|
files:
|
61
|
+
- ".gitignore"
|
62
|
+
- ".rspec"
|
63
|
+
- Gemfile
|
62
64
|
- MIT-LICENSE
|
63
65
|
- README.md
|
64
66
|
- Rakefile
|
67
|
+
- antivirus.gemspec
|
65
68
|
- lib/antivirus.rb
|
66
69
|
- lib/antivirus/railtie.rb
|
67
70
|
- lib/antivirus/validator.rb
|
68
71
|
- lib/antivirus/version.rb
|
72
|
+
- spec/dummy/application.rb
|
73
|
+
- spec/dummy/bin/rails
|
74
|
+
- spec/dummy/config.ru
|
75
|
+
- spec/dummy/config/locales/en.yml
|
76
|
+
- spec/models/post_spec.rb
|
77
|
+
- spec/spec_helper.rb
|
69
78
|
homepage: https://github.com/kami30k/antivirus
|
70
79
|
licenses:
|
71
80
|
- MIT
|
@@ -86,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
95
|
version: '0'
|
87
96
|
requirements: []
|
88
97
|
rubyforge_project:
|
89
|
-
rubygems_version: 2.
|
98
|
+
rubygems_version: 2.4.5
|
90
99
|
signing_key:
|
91
100
|
specification_version: 4
|
92
101
|
summary: Profanity filter for Rails application.
|