mentionable 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -1
- data/Gemfile.lock +138 -111
- data/README.md +1 -1
- data/Rakefile +8 -6
- data/bin/console +5 -3
- data/lib/mentionable/version.rb +1 -1
- data/lib/mentionable.rb +9 -10
- data/mentionable.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ae598511ec93e6dc35fe9162f036487ae5f63af4fd56ffb317f4510946baacb
|
4
|
+
data.tar.gz: ddf5660769c66b5d17554615d5adced39f11c2537c5c3a52591e897e52331c11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5520086ead098c403af5391dff7678741314db47e84856650994198816b18b164cbe779fcf13a3d5f623b98414ed8d7286b5e506ca0d8031c3c036f1536fe222
|
7
|
+
data.tar.gz: '048df95306ac9a0bc29c6128d59776e9ed7482694ccd2827c07ee6e0e02e1661d67ca94d09d79cda4d8f5a5c400575673d1303250f32c8747f3e41aff8801ba1'
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,155 +1,180 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mentionable (0.
|
4
|
+
mentionable (0.3.0)
|
5
5
|
activerecord
|
6
6
|
railties
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (
|
12
|
-
actionpack (=
|
11
|
+
actioncable (7.0.4.2)
|
12
|
+
actionpack (= 7.0.4.2)
|
13
|
+
activesupport (= 7.0.4.2)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (
|
16
|
-
actionpack (=
|
17
|
-
activejob (=
|
18
|
-
activerecord (=
|
19
|
-
activestorage (=
|
20
|
-
activesupport (=
|
16
|
+
actionmailbox (7.0.4.2)
|
17
|
+
actionpack (= 7.0.4.2)
|
18
|
+
activejob (= 7.0.4.2)
|
19
|
+
activerecord (= 7.0.4.2)
|
20
|
+
activestorage (= 7.0.4.2)
|
21
|
+
activesupport (= 7.0.4.2)
|
21
22
|
mail (>= 2.7.1)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
net-imap
|
24
|
+
net-pop
|
25
|
+
net-smtp
|
26
|
+
actionmailer (7.0.4.2)
|
27
|
+
actionpack (= 7.0.4.2)
|
28
|
+
actionview (= 7.0.4.2)
|
29
|
+
activejob (= 7.0.4.2)
|
30
|
+
activesupport (= 7.0.4.2)
|
26
31
|
mail (~> 2.5, >= 2.5.4)
|
32
|
+
net-imap
|
33
|
+
net-pop
|
34
|
+
net-smtp
|
27
35
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (
|
29
|
-
actionview (=
|
30
|
-
activesupport (=
|
31
|
-
rack (~> 2.0, >= 2.0
|
36
|
+
actionpack (7.0.4.2)
|
37
|
+
actionview (= 7.0.4.2)
|
38
|
+
activesupport (= 7.0.4.2)
|
39
|
+
rack (~> 2.0, >= 2.2.0)
|
32
40
|
rack-test (>= 0.6.3)
|
33
41
|
rails-dom-testing (~> 2.0)
|
34
42
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (
|
36
|
-
actionpack (=
|
37
|
-
activerecord (=
|
38
|
-
activestorage (=
|
39
|
-
activesupport (=
|
43
|
+
actiontext (7.0.4.2)
|
44
|
+
actionpack (= 7.0.4.2)
|
45
|
+
activerecord (= 7.0.4.2)
|
46
|
+
activestorage (= 7.0.4.2)
|
47
|
+
activesupport (= 7.0.4.2)
|
48
|
+
globalid (>= 0.6.0)
|
40
49
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (
|
42
|
-
activesupport (=
|
50
|
+
actionview (7.0.4.2)
|
51
|
+
activesupport (= 7.0.4.2)
|
43
52
|
builder (~> 3.1)
|
44
53
|
erubi (~> 1.4)
|
45
54
|
rails-dom-testing (~> 2.0)
|
46
55
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (
|
48
|
-
activesupport (=
|
56
|
+
activejob (7.0.4.2)
|
57
|
+
activesupport (= 7.0.4.2)
|
49
58
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (
|
51
|
-
activesupport (=
|
52
|
-
activerecord (
|
53
|
-
activemodel (=
|
54
|
-
activesupport (=
|
55
|
-
activestorage (
|
56
|
-
actionpack (=
|
57
|
-
activejob (=
|
58
|
-
activerecord (=
|
59
|
-
|
60
|
-
|
59
|
+
activemodel (7.0.4.2)
|
60
|
+
activesupport (= 7.0.4.2)
|
61
|
+
activerecord (7.0.4.2)
|
62
|
+
activemodel (= 7.0.4.2)
|
63
|
+
activesupport (= 7.0.4.2)
|
64
|
+
activestorage (7.0.4.2)
|
65
|
+
actionpack (= 7.0.4.2)
|
66
|
+
activejob (= 7.0.4.2)
|
67
|
+
activerecord (= 7.0.4.2)
|
68
|
+
activesupport (= 7.0.4.2)
|
69
|
+
marcel (~> 1.0)
|
70
|
+
mini_mime (>= 1.1.0)
|
71
|
+
activesupport (7.0.4.2)
|
61
72
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
|
-
i18n (>=
|
63
|
-
minitest (
|
64
|
-
tzinfo (~>
|
65
|
-
|
66
|
-
|
67
|
-
public_suffix (>= 2.0.2, < 5.0)
|
73
|
+
i18n (>= 1.6, < 2)
|
74
|
+
minitest (>= 5.1)
|
75
|
+
tzinfo (~> 2.0)
|
76
|
+
addressable (2.8.1)
|
77
|
+
public_suffix (>= 2.0.2, < 6.0)
|
68
78
|
builder (3.2.4)
|
69
|
-
capybara (3.
|
79
|
+
capybara (3.38.0)
|
70
80
|
addressable
|
81
|
+
matrix
|
71
82
|
mini_mime (>= 0.1.3)
|
72
83
|
nokogiri (~> 1.8)
|
73
84
|
rack (>= 1.6.0)
|
74
85
|
rack-test (>= 0.6.3)
|
75
|
-
regexp_parser (
|
86
|
+
regexp_parser (>= 1.5, < 3.0)
|
76
87
|
xpath (~> 3.2)
|
77
|
-
concurrent-ruby (1.
|
88
|
+
concurrent-ruby (1.2.0)
|
78
89
|
crass (1.0.6)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
90
|
+
date (3.3.3)
|
91
|
+
erubi (1.12.0)
|
92
|
+
globalid (1.1.0)
|
93
|
+
activesupport (>= 5.0)
|
94
|
+
i18n (1.12.0)
|
83
95
|
concurrent-ruby (~> 1.0)
|
84
|
-
json (2.3
|
85
|
-
loofah (2.
|
96
|
+
json (2.6.3)
|
97
|
+
loofah (2.19.1)
|
86
98
|
crass (~> 1.0.2)
|
87
99
|
nokogiri (>= 1.5.9)
|
88
|
-
mail (2.
|
100
|
+
mail (2.8.0.1)
|
89
101
|
mini_mime (>= 0.1.1)
|
90
|
-
|
91
|
-
|
102
|
+
net-imap
|
103
|
+
net-pop
|
104
|
+
net-smtp
|
105
|
+
marcel (1.0.2)
|
106
|
+
matrix (0.4.2)
|
92
107
|
method_source (1.0.0)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
108
|
+
mini_mime (1.1.2)
|
109
|
+
mini_portile2 (2.8.1)
|
110
|
+
minitest (5.17.0)
|
111
|
+
net-imap (0.3.4)
|
112
|
+
date
|
113
|
+
net-protocol
|
114
|
+
net-pop (0.1.2)
|
115
|
+
net-protocol
|
116
|
+
net-protocol (0.2.1)
|
117
|
+
timeout
|
118
|
+
net-smtp (0.3.3)
|
119
|
+
net-protocol
|
120
|
+
nio4r (2.5.8)
|
121
|
+
nokogiri (1.14.0)
|
122
|
+
mini_portile2 (~> 2.8.0)
|
123
|
+
racc (~> 1.4)
|
124
|
+
power_assert (2.0.3)
|
125
|
+
public_suffix (5.0.1)
|
126
|
+
racc (1.6.2)
|
127
|
+
rack (2.2.6.2)
|
128
|
+
rack-test (2.0.2)
|
129
|
+
rack (>= 1.3)
|
130
|
+
rails (7.0.4.2)
|
131
|
+
actioncable (= 7.0.4.2)
|
132
|
+
actionmailbox (= 7.0.4.2)
|
133
|
+
actionmailer (= 7.0.4.2)
|
134
|
+
actionpack (= 7.0.4.2)
|
135
|
+
actiontext (= 7.0.4.2)
|
136
|
+
actionview (= 7.0.4.2)
|
137
|
+
activejob (= 7.0.4.2)
|
138
|
+
activemodel (= 7.0.4.2)
|
139
|
+
activerecord (= 7.0.4.2)
|
140
|
+
activestorage (= 7.0.4.2)
|
141
|
+
activesupport (= 7.0.4.2)
|
142
|
+
bundler (>= 1.15.0)
|
143
|
+
railties (= 7.0.4.2)
|
120
144
|
rails-dom-testing (2.0.3)
|
121
145
|
activesupport (>= 4.2.0)
|
122
146
|
nokogiri (>= 1.6)
|
123
|
-
rails-html-sanitizer (1.
|
124
|
-
loofah (~> 2.
|
125
|
-
railties (
|
126
|
-
actionpack (=
|
127
|
-
activesupport (=
|
147
|
+
rails-html-sanitizer (1.5.0)
|
148
|
+
loofah (~> 2.19, >= 2.19.1)
|
149
|
+
railties (7.0.4.2)
|
150
|
+
actionpack (= 7.0.4.2)
|
151
|
+
activesupport (= 7.0.4.2)
|
128
152
|
method_source
|
129
|
-
rake (>=
|
130
|
-
thor (
|
153
|
+
rake (>= 12.2)
|
154
|
+
thor (~> 1.0)
|
155
|
+
zeitwerk (~> 2.5)
|
131
156
|
rake (12.3.3)
|
132
|
-
regexp_parser (
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
test-unit (3.
|
157
|
+
regexp_parser (2.6.2)
|
158
|
+
rexml (3.2.5)
|
159
|
+
rr (3.1.0)
|
160
|
+
rubyzip (2.3.2)
|
161
|
+
selenium-webdriver (4.8.0)
|
162
|
+
rexml (~> 3.2, >= 3.2.5)
|
163
|
+
rubyzip (>= 1.2.2, < 3.0)
|
164
|
+
websocket (~> 1.0)
|
165
|
+
sqlite3 (1.6.0)
|
166
|
+
mini_portile2 (~> 2.8.0)
|
167
|
+
test-unit (3.5.7)
|
143
168
|
power_assert
|
144
|
-
test-unit-activesupport (1.
|
169
|
+
test-unit-activesupport (1.1.1)
|
145
170
|
activesupport
|
146
171
|
test-unit
|
147
|
-
test-unit-capybara (1.
|
172
|
+
test-unit-capybara (1.1.1)
|
148
173
|
capybara (>= 2.1.0)
|
149
174
|
json
|
150
175
|
test-unit (>= 2.5.3)
|
151
|
-
test-unit-rails (
|
152
|
-
rails (>= 5.
|
176
|
+
test-unit-rails (7.0.0)
|
177
|
+
rails (>= 5.2.0)
|
153
178
|
test-unit (>= 3.1.7)
|
154
179
|
test-unit-activesupport (>= 1.0.8)
|
155
180
|
test-unit-capybara (>= 1.0.5)
|
@@ -157,16 +182,17 @@ GEM
|
|
157
182
|
test-unit-rr (1.0.5)
|
158
183
|
rr (>= 1.1.1)
|
159
184
|
test-unit (>= 2.5.2)
|
160
|
-
thor (1.
|
161
|
-
|
162
|
-
tzinfo (
|
163
|
-
|
164
|
-
websocket
|
185
|
+
thor (1.2.1)
|
186
|
+
timeout (0.3.1)
|
187
|
+
tzinfo (2.0.6)
|
188
|
+
concurrent-ruby (~> 1.0)
|
189
|
+
websocket (1.2.9)
|
190
|
+
websocket-driver (0.7.5)
|
165
191
|
websocket-extensions (>= 0.1.0)
|
166
192
|
websocket-extensions (0.1.5)
|
167
193
|
xpath (3.2.0)
|
168
194
|
nokogiri (~> 1.8)
|
169
|
-
zeitwerk (2.
|
195
|
+
zeitwerk (2.6.6)
|
170
196
|
|
171
197
|
PLATFORMS
|
172
198
|
ruby
|
@@ -176,8 +202,9 @@ DEPENDENCIES
|
|
176
202
|
minitest (~> 5.0)
|
177
203
|
rails
|
178
204
|
rake (~> 12.0)
|
205
|
+
selenium-webdriver
|
179
206
|
sqlite3
|
180
207
|
test-unit-rails
|
181
208
|
|
182
209
|
BUNDLED WITH
|
183
|
-
2.
|
210
|
+
2.3.25
|
data/README.md
CHANGED
@@ -24,7 +24,7 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
```ruby
|
26
26
|
class Comment
|
27
|
-
mentionable_as :body #, on_mention: :after_save_mention, regexp: /@\w+/
|
27
|
+
mentionable_as :body #, on_mention: :after_save_mention, hook_name: :after_save, regexp: /@\w+/
|
28
28
|
|
29
29
|
def after_save_mention(new_mentions)
|
30
30
|
p new_mentions # Send notification if you want.
|
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
3
5
|
|
4
6
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
7
|
-
t.test_files = FileList[
|
7
|
+
t.libs << 'test'
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
10
|
end
|
9
11
|
|
10
|
-
task :
|
12
|
+
task default: :test
|
data/bin/console
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'bundler/setup'
|
6
|
+
require 'mentionable'
|
5
7
|
|
6
8
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
9
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +12,5 @@ require "mentionable"
|
|
10
12
|
# require "pry"
|
11
13
|
# Pry.start
|
12
14
|
|
13
|
-
require
|
15
|
+
require 'irb'
|
14
16
|
IRB.start(__FILE__)
|
data/lib/mentionable/version.rb
CHANGED
data/lib/mentionable.rb
CHANGED
@@ -6,20 +6,19 @@ module Mentionable
|
|
6
6
|
REGEXP = /@[\w-]+/.freeze
|
7
7
|
|
8
8
|
def self.included(base)
|
9
|
-
base.after_save do
|
10
|
-
if self.class.class_variable_defined? :@@on_mention
|
11
|
-
send self.class.on_mention, new_mentions if new_mentions?
|
12
|
-
end
|
13
|
-
end
|
14
9
|
base.extend ClassMethods
|
15
10
|
end
|
16
11
|
|
17
12
|
module ClassMethods
|
18
|
-
def mentionable_as(column, on_mention: :after_save_mention, regexp: REGEXP)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
13
|
+
def mentionable_as(column, on_mention: :after_save_mention, hook_name: :after_save, regexp: REGEXP)
|
14
|
+
class_variable_set :@@mentionable_name, column
|
15
|
+
class_variable_set :@@on_mention, on_mention
|
16
|
+
class_variable_set :@@hook_name, hook_name
|
17
|
+
class_variable_set :@@regexp, regexp
|
18
|
+
|
19
|
+
public_send hook_name do
|
20
|
+
public_send on_mention, new_mentions if new_mentions?
|
21
|
+
end
|
23
22
|
end
|
24
23
|
|
25
24
|
def mentionable_name
|
data/mentionable.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency 'activerecord'
|
30
30
|
spec.add_dependency 'railties'
|
31
31
|
spec.add_development_dependency 'rails'
|
32
|
+
spec.add_development_dependency 'selenium-webdriver'
|
32
33
|
spec.add_development_dependency 'sqlite3'
|
33
34
|
spec.add_development_dependency 'test-unit-rails'
|
34
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mentionable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masaki Komagata
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: selenium-webdriver
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: sqlite3
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
135
|
- !ruby/object:Gem::Version
|
122
136
|
version: '0'
|
123
137
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.3.7
|
125
139
|
signing_key:
|
126
140
|
specification_version: 4
|
127
141
|
summary: Discovery mentions from ActiveRecord column.
|