mentionable 0.2.1 → 0.3.0

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: 1d8e5145d44c07e8d1954a424a9fed78a95c9943f91799216de004a0eab65f60
4
- data.tar.gz: 02db348c44ad09733c256f2dbcb60cb2a0f5221c7613e8766641a51f3d21700e
3
+ metadata.gz: 9ae598511ec93e6dc35fe9162f036487ae5f63af4fd56ffb317f4510946baacb
4
+ data.tar.gz: ddf5660769c66b5d17554615d5adced39f11c2537c5c3a52591e897e52331c11
5
5
  SHA512:
6
- metadata.gz: 520de84863bd600203f2cf185e08995aa1066ec8b1f92f04c602a3d0088141fb2808f7bec161e46df2fddd03e8e81c11671e3389a14844baf45b1e7f8c69b960
7
- data.tar.gz: b5b19d6af87c0a56a707acffb1401e922f9c63fc0c80430de04054327053a60f1c43975961a5d93654cd8205049f500ce840c311238ff0b7bb024edc384283b8
6
+ metadata.gz: 5520086ead098c403af5391dff7678741314db47e84856650994198816b18b164cbe779fcf13a3d5f623b98414ed8d7286b5e506ca0d8031c3c036f1536fe222
7
+ data.tar.gz: '048df95306ac9a0bc29c6128d59776e9ed7482694ccd2827c07ee6e0e02e1661d67ca94d09d79cda4d8f5a5c400575673d1303250f32c8747f3e41aff8801ba1'
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in mentionable.gemspec
4
6
  gemspec
5
7
 
6
- gem 'rake', '~> 12.0'
7
8
  gem 'minitest', '~> 5.0'
9
+ gem 'rake', '~> 12.0'
data/Gemfile.lock CHANGED
@@ -1,155 +1,180 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mentionable (0.1.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 (6.0.3.2)
12
- actionpack (= 6.0.3.2)
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 (6.0.3.2)
16
- actionpack (= 6.0.3.2)
17
- activejob (= 6.0.3.2)
18
- activerecord (= 6.0.3.2)
19
- activestorage (= 6.0.3.2)
20
- activesupport (= 6.0.3.2)
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
- actionmailer (6.0.3.2)
23
- actionpack (= 6.0.3.2)
24
- actionview (= 6.0.3.2)
25
- activejob (= 6.0.3.2)
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 (6.0.3.2)
29
- actionview (= 6.0.3.2)
30
- activesupport (= 6.0.3.2)
31
- rack (~> 2.0, >= 2.0.8)
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 (6.0.3.2)
36
- actionpack (= 6.0.3.2)
37
- activerecord (= 6.0.3.2)
38
- activestorage (= 6.0.3.2)
39
- activesupport (= 6.0.3.2)
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 (6.0.3.2)
42
- activesupport (= 6.0.3.2)
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 (6.0.3.2)
48
- activesupport (= 6.0.3.2)
56
+ activejob (7.0.4.2)
57
+ activesupport (= 7.0.4.2)
49
58
  globalid (>= 0.3.6)
50
- activemodel (6.0.3.2)
51
- activesupport (= 6.0.3.2)
52
- activerecord (6.0.3.2)
53
- activemodel (= 6.0.3.2)
54
- activesupport (= 6.0.3.2)
55
- activestorage (6.0.3.2)
56
- actionpack (= 6.0.3.2)
57
- activejob (= 6.0.3.2)
58
- activerecord (= 6.0.3.2)
59
- marcel (~> 0.3.1)
60
- activesupport (6.0.3.2)
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 (>= 0.7, < 2)
63
- minitest (~> 5.1)
64
- tzinfo (~> 1.1)
65
- zeitwerk (~> 2.2, >= 2.2.2)
66
- addressable (2.7.0)
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.33.0)
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 (~> 1.5)
86
+ regexp_parser (>= 1.5, < 3.0)
76
87
  xpath (~> 3.2)
77
- concurrent-ruby (1.1.6)
88
+ concurrent-ruby (1.2.0)
78
89
  crass (1.0.6)
79
- erubi (1.9.0)
80
- globalid (0.4.2)
81
- activesupport (>= 4.2.0)
82
- i18n (1.8.3)
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.0)
85
- loofah (2.6.0)
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.7.1)
100
+ mail (2.8.0.1)
89
101
  mini_mime (>= 0.1.1)
90
- marcel (0.3.3)
91
- mimemagic (~> 0.3.2)
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
- mimemagic (0.3.5)
94
- mini_mime (1.0.2)
95
- mini_portile2 (2.4.0)
96
- minitest (5.14.1)
97
- nio4r (2.5.2)
98
- nokogiri (1.10.9)
99
- mini_portile2 (~> 2.4.0)
100
- power_assert (1.2.0)
101
- public_suffix (4.0.5)
102
- rack (2.2.3)
103
- rack-test (1.1.0)
104
- rack (>= 1.0, < 3)
105
- rails (6.0.3.2)
106
- actioncable (= 6.0.3.2)
107
- actionmailbox (= 6.0.3.2)
108
- actionmailer (= 6.0.3.2)
109
- actionpack (= 6.0.3.2)
110
- actiontext (= 6.0.3.2)
111
- actionview (= 6.0.3.2)
112
- activejob (= 6.0.3.2)
113
- activemodel (= 6.0.3.2)
114
- activerecord (= 6.0.3.2)
115
- activestorage (= 6.0.3.2)
116
- activesupport (= 6.0.3.2)
117
- bundler (>= 1.3.0)
118
- railties (= 6.0.3.2)
119
- sprockets-rails (>= 2.0.0)
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.3.0)
124
- loofah (~> 2.3)
125
- railties (6.0.3.2)
126
- actionpack (= 6.0.3.2)
127
- activesupport (= 6.0.3.2)
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 (>= 0.8.7)
130
- thor (>= 0.20.3, < 2.0)
153
+ rake (>= 12.2)
154
+ thor (~> 1.0)
155
+ zeitwerk (~> 2.5)
131
156
  rake (12.3.3)
132
- regexp_parser (1.7.1)
133
- rr (1.2.1)
134
- sprockets (4.0.2)
135
- concurrent-ruby (~> 1.0)
136
- rack (> 1, < 3)
137
- sprockets-rails (3.2.1)
138
- actionpack (>= 4.0)
139
- activesupport (>= 4.0)
140
- sprockets (>= 3.0.0)
141
- sqlite3 (1.4.2)
142
- test-unit (3.3.6)
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.0.9)
169
+ test-unit-activesupport (1.1.1)
145
170
  activesupport
146
171
  test-unit
147
- test-unit-capybara (1.0.9)
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 (6.0.0)
152
- rails (>= 5.1.2)
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.0.1)
161
- thread_safe (0.3.6)
162
- tzinfo (1.2.7)
163
- thread_safe (~> 0.1)
164
- websocket-driver (0.7.2)
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.3.0)
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.1.4
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
- require "bundler/gem_tasks"
2
- require "rake/testtask"
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 << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList["test/**/*_test.rb"]
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
8
10
  end
9
11
 
10
- task :default => :test
12
+ task default: :test
data/bin/console CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "mentionable"
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 "irb"
15
+ require 'irb'
14
16
  IRB.start(__FILE__)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mentionable
4
- VERSION = '0.2.1'
4
+ VERSION = '0.3.0'
5
5
  end
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
- klass = name.constantize
20
- klass.class_variable_set :@@mentionable_name, column
21
- klass.class_variable_set :@@on_mention, on_mention
22
- klass.class_variable_set :@@regexp, regexp
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.2.1
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: 2021-03-29 00:00:00.000000000 Z
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.0.3
138
+ rubygems_version: 3.3.7
125
139
  signing_key:
126
140
  specification_version: 4
127
141
  summary: Discovery mentions from ActiveRecord column.