acts-as-messageable 0.4.11 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +1 -0
  3. data/.rubocop.yml +19 -0
  4. data/.rubocop_todo.yml +33 -0
  5. data/.travis.yml +40 -4
  6. data/Appraisals +24 -11
  7. data/Dockerfile +13 -0
  8. data/Gemfile +11 -4
  9. data/Gemfile.lock +94 -63
  10. data/README.md +30 -12
  11. data/Rakefile +4 -0
  12. data/VERSION +1 -1
  13. data/acts-as-messageable.gemspec +62 -49
  14. data/docker-compose.yml +73 -0
  15. data/gemfiles/rails_3.2.gemfile +17 -10
  16. data/gemfiles/rails_4.2.gemfile +24 -0
  17. data/gemfiles/rails_5.2.gemfile +17 -10
  18. data/gemfiles/rails_6.0.gemfile +17 -10
  19. data/gemfiles/rails_master.gemfile +23 -0
  20. data/lib/acts-as-messageable.rb +2 -17
  21. data/lib/acts_as_messageable.rb +23 -0
  22. data/lib/{acts-as-messageable → acts_as_messageable}/message.rb +25 -8
  23. data/lib/{acts-as-messageable → acts_as_messageable}/model.rb +27 -30
  24. data/lib/{acts-as-messageable → acts_as_messageable}/rails3.rb +7 -5
  25. data/lib/{acts-as-messageable → acts_as_messageable}/rails4.rb +8 -4
  26. data/lib/acts_as_messageable/rails6.rb +31 -0
  27. data/lib/acts_as_messageable/railtie.rb +11 -0
  28. data/lib/{acts-as-messageable → acts_as_messageable}/relation.rb +4 -2
  29. data/lib/{acts-as-messageable → acts_as_messageable}/scopes.rb +16 -12
  30. data/lib/generators/{acts-as-messageable → acts_as_messageable}/migration/migration_generator.rb +16 -2
  31. data/lib/generators/{acts-as-messageable → acts_as_messageable}/migration/templates/migration.rb +3 -3
  32. data/lib/generators/acts_as_messageable/migration/templates/migration_indexes.rb +11 -0
  33. data/lib/generators/acts_as_messageable/migration/templates/migration_opened_as_datetime.rb +15 -0
  34. data/lib/generators/{acts-as-messageable → acts_as_messageable}/migration/templates/migration_permanent.rb +1 -1
  35. data/spec/{acts-as-messageable_spec.rb → acts_as_messageable_spec.rb} +77 -5
  36. data/spec/{custom-class_spec.rb → custom_class_spec.rb} +14 -5
  37. data/spec/{custom-required_spec.rb → custom_required_spec.rb} +3 -1
  38. data/spec/{group-messages_spec.rb → group_messages_spec.rb} +4 -2
  39. data/spec/migrations_spec.rb +75 -0
  40. data/spec/spec_helper.rb +30 -37
  41. data/spec/support/admin.rb +2 -0
  42. data/spec/support/custom_message.rb +5 -0
  43. data/spec/support/custom_message_uuid.rb +5 -0
  44. data/spec/support/custom_search_user.rb +5 -0
  45. data/spec/support/men.rb +6 -0
  46. data/spec/support/send_message.rb +2 -0
  47. data/spec/support/table_schema.rb +35 -0
  48. data/spec/support/user.rb +2 -3
  49. data/spec/support/uuid_user.rb +6 -0
  50. metadata +113 -31
  51. data/gemfiles/rails_3.2.gemfile.lock +0 -153
  52. data/gemfiles/rails_4.2.11.gemfile +0 -16
  53. data/gemfiles/rails_4.2.11.gemfile.lock +0 -157
  54. data/gemfiles/rails_5.2.gemfile.lock +0 -155
  55. data/gemfiles/rails_6.0.gemfile.lock +0 -155
  56. data/lib/acts-as-messageable/railtie.rb +0 -13
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CustomMessageUUID < ActsAsMessageable::Message
4
+ self.table_name = :custom_messages_uuid
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CustomSearchUser < ActiveRecord::Base
4
+ acts_as_messageable search_scope: :custom_search, class_name: 'CustomMessage'
5
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './user'
4
+
5
+ class Men < User
6
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  def send_message(from = @bob, to = @alice, topic = 'Topic', body = 'Body')
2
4
  from.send_message(to, topic, body)
3
5
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ TABLE_SCHEMA = lambda do |t|
4
+ t.string :topic
5
+ t.text :body
6
+ t.references :received_messageable, polymorphic: true, index: false
7
+ t.references :sent_messageable, polymorphic: true, index: false
8
+ t.boolean :opened, default: false
9
+ t.boolean :recipient_delete, default: false
10
+ t.boolean :sender_delete, default: false
11
+ t.boolean :recipient_permanent_delete, default: false
12
+ t.boolean :sender_permanent_delete, default: false
13
+ t.datetime :opened_at, :datetime
14
+ t.string :ancestry
15
+ t.timestamps
16
+ end
17
+
18
+ TABLE_SCHEMA_UUID = lambda do |t|
19
+ t.string :topic
20
+ t.text :body
21
+ t.references :received_messageable, polymorphic: true, index: false, type: :uuid
22
+ t.references :sent_messageable, polymorphic: true, index: false, type: :uuid
23
+ t.boolean :opened, default: false
24
+ t.boolean :recipient_delete, default: false
25
+ t.boolean :sender_delete, default: false
26
+ t.boolean :recipient_permanent_delete, default: false
27
+ t.boolean :sender_permanent_delete, default: false
28
+ t.datetime :opened_at, :datetime
29
+ t.string :ancestry
30
+ t.timestamps
31
+ end
32
+
33
+ USER_SCHEMA = lambda do |t|
34
+ t.string :email
35
+ end
@@ -1,6 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class User < ActiveRecord::Base
2
4
  acts_as_messageable
3
5
  end
4
-
5
- class Men < User
6
- end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ class UuidUser < ActiveRecord::Base
4
+ acts_as_messageable class_name: 'CustomMessageUUID', table_name: 'custom_messages_uuid'
5
+ self.table_name = :uuid_users
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts-as-messageable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Nielacny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-09 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,56 +16,56 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
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: 3.0.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.0
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.0
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ancestry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: '0'
48
48
  type: :runtime
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: 1.3.0
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: railties
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.0
61
+ version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 3.0.0
68
+ version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: appraisal
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,34 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pg
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: rspec
113
141
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +150,20 @@ dependencies:
122
150
  - - ">="
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
125
167
  - !ruby/object:Gem::Dependency
126
168
  name: sqlite3
127
169
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +178,34 @@ dependencies:
136
178
  - - ">="
137
179
  - !ruby/object:Gem::Version
138
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: timecop
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: yard
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
139
209
  description:
140
210
  email: piotr.nielacny@gmail.com
141
211
  executables: []
@@ -144,9 +214,13 @@ extra_rdoc_files:
144
214
  - README.md
145
215
  files:
146
216
  - ".coveralls.yml"
217
+ - ".dockerignore"
147
218
  - ".rspec"
219
+ - ".rubocop.yml"
220
+ - ".rubocop_todo.yml"
148
221
  - ".travis.yml"
149
222
  - Appraisals
223
+ - Dockerfile
150
224
  - Gemfile
151
225
  - Gemfile.lock
152
226
  - MIT-LICENSE
@@ -154,33 +228,42 @@ files:
154
228
  - Rakefile
155
229
  - VERSION
156
230
  - acts-as-messageable.gemspec
231
+ - docker-compose.yml
157
232
  - gemfiles/rails_3.2.gemfile
158
- - gemfiles/rails_3.2.gemfile.lock
159
- - gemfiles/rails_4.2.11.gemfile
160
- - gemfiles/rails_4.2.11.gemfile.lock
233
+ - gemfiles/rails_4.2.gemfile
161
234
  - gemfiles/rails_5.2.gemfile
162
- - gemfiles/rails_5.2.gemfile.lock
163
235
  - gemfiles/rails_6.0.gemfile
164
- - gemfiles/rails_6.0.gemfile.lock
236
+ - gemfiles/rails_master.gemfile
165
237
  - lib/acts-as-messageable.rb
166
- - lib/acts-as-messageable/message.rb
167
- - lib/acts-as-messageable/model.rb
168
- - lib/acts-as-messageable/rails3.rb
169
- - lib/acts-as-messageable/rails4.rb
170
- - lib/acts-as-messageable/railtie.rb
171
- - lib/acts-as-messageable/relation.rb
172
- - lib/acts-as-messageable/scopes.rb
173
- - lib/generators/acts-as-messageable/migration/migration_generator.rb
174
- - lib/generators/acts-as-messageable/migration/templates/migration.rb
175
- - lib/generators/acts-as-messageable/migration/templates/migration_permanent.rb
176
- - spec/acts-as-messageable_spec.rb
177
- - spec/custom-class_spec.rb
178
- - spec/custom-required_spec.rb
179
- - spec/group-messages_spec.rb
238
+ - lib/acts_as_messageable.rb
239
+ - lib/acts_as_messageable/message.rb
240
+ - lib/acts_as_messageable/model.rb
241
+ - lib/acts_as_messageable/rails3.rb
242
+ - lib/acts_as_messageable/rails4.rb
243
+ - lib/acts_as_messageable/rails6.rb
244
+ - lib/acts_as_messageable/railtie.rb
245
+ - lib/acts_as_messageable/relation.rb
246
+ - lib/acts_as_messageable/scopes.rb
247
+ - lib/generators/acts_as_messageable/migration/migration_generator.rb
248
+ - lib/generators/acts_as_messageable/migration/templates/migration.rb
249
+ - lib/generators/acts_as_messageable/migration/templates/migration_indexes.rb
250
+ - lib/generators/acts_as_messageable/migration/templates/migration_opened_as_datetime.rb
251
+ - lib/generators/acts_as_messageable/migration/templates/migration_permanent.rb
252
+ - spec/acts_as_messageable_spec.rb
253
+ - spec/custom_class_spec.rb
254
+ - spec/custom_required_spec.rb
255
+ - spec/group_messages_spec.rb
256
+ - spec/migrations_spec.rb
180
257
  - spec/spec_helper.rb
181
258
  - spec/support/admin.rb
259
+ - spec/support/custom_message.rb
260
+ - spec/support/custom_message_uuid.rb
261
+ - spec/support/custom_search_user.rb
262
+ - spec/support/men.rb
182
263
  - spec/support/send_message.rb
264
+ - spec/support/table_schema.rb
183
265
  - spec/support/user.rb
266
+ - spec/support/uuid_user.rb
184
267
  homepage: http://github.com/LTe/acts-as-messageable
185
268
  licenses: []
186
269
  metadata: {}
@@ -199,8 +282,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
282
  - !ruby/object:Gem::Version
200
283
  version: '0'
201
284
  requirements: []
202
- rubyforge_project:
203
- rubygems_version: 2.7.6
285
+ rubygems_version: 3.1.3
204
286
  signing_key:
205
287
  specification_version: 4
206
288
  summary: Make user messageable!;-)
@@ -1,153 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- actionpack (3.2.22.5)
5
- activemodel (= 3.2.22.5)
6
- activesupport (= 3.2.22.5)
7
- builder (~> 3.0.0)
8
- erubis (~> 2.7.0)
9
- journey (~> 1.0.4)
10
- rack (~> 1.4.5)
11
- rack-cache (~> 1.2)
12
- rack-test (~> 0.6.1)
13
- sprockets (~> 2.2.1)
14
- activemodel (3.2.22.5)
15
- activesupport (= 3.2.22.5)
16
- builder (~> 3.0.0)
17
- activerecord (3.2.22.5)
18
- activemodel (= 3.2.22.5)
19
- activesupport (= 3.2.22.5)
20
- arel (~> 3.0.2)
21
- tzinfo (~> 0.3.29)
22
- activesupport (3.2.22.5)
23
- i18n (~> 0.6, >= 0.6.4)
24
- multi_json (~> 1.0)
25
- addressable (2.4.0)
26
- ancestry (3.0.6)
27
- activerecord (>= 3.2.0)
28
- appraisal (2.2.0)
29
- bundler
30
- rake
31
- thor (>= 0.14.0)
32
- arel (3.0.3)
33
- builder (3.0.4)
34
- concurrent-ruby (1.1.5)
35
- coveralls (0.8.23)
36
- json (>= 1.8, < 3)
37
- simplecov (~> 0.16.1)
38
- term-ansicolor (~> 1.3)
39
- thor (>= 0.19.4, < 2.0)
40
- tins (~> 1.6)
41
- descendants_tracker (0.0.4)
42
- thread_safe (~> 0.3, >= 0.3.1)
43
- diff-lcs (1.3)
44
- docile (1.3.1)
45
- erubis (2.7.0)
46
- faraday (0.9.2)
47
- multipart-post (>= 1.2, < 3)
48
- git (1.5.0)
49
- github_api (0.16.0)
50
- addressable (~> 2.4.0)
51
- descendants_tracker (~> 0.0.4)
52
- faraday (~> 0.8, < 0.10)
53
- hashie (>= 3.4)
54
- mime-types (>= 1.16, < 3.0)
55
- oauth2 (~> 1.0)
56
- hashie (3.6.0)
57
- highline (2.0.2)
58
- hike (1.2.3)
59
- i18n (0.9.5)
60
- concurrent-ruby (~> 1.0)
61
- jeweler (2.3.9)
62
- builder
63
- bundler
64
- git (>= 1.2.5)
65
- github_api (~> 0.16.0)
66
- highline (>= 1.6.15)
67
- nokogiri (>= 1.5.10)
68
- psych
69
- rake
70
- rdoc
71
- semver2
72
- journey (1.0.4)
73
- json (2.2.0)
74
- jwt (2.2.1)
75
- mime-types (2.99.3)
76
- mini_portile2 (2.4.0)
77
- multi_json (1.13.1)
78
- multi_xml (0.6.0)
79
- multipart-post (2.1.1)
80
- nokogiri (1.10.3)
81
- mini_portile2 (~> 2.4.0)
82
- oauth2 (1.4.1)
83
- faraday (>= 0.8, < 0.16.0)
84
- jwt (>= 1.0, < 3.0)
85
- multi_json (~> 1.3)
86
- multi_xml (~> 0.5)
87
- rack (>= 1.2, < 3)
88
- psych (3.1.0)
89
- rack (1.4.7)
90
- rack-cache (1.9.0)
91
- rack (>= 0.4)
92
- rack-ssl (1.3.4)
93
- rack
94
- rack-test (0.6.3)
95
- rack (>= 1.0)
96
- railties (3.2.22.5)
97
- actionpack (= 3.2.22.5)
98
- activesupport (= 3.2.22.5)
99
- rack-ssl (~> 1.3.2)
100
- rake (>= 0.8.7)
101
- rdoc (~> 3.4)
102
- thor (>= 0.14.6, < 2.0)
103
- rake (12.3.2)
104
- rdoc (3.9.5)
105
- rspec (3.8.0)
106
- rspec-core (~> 3.8.0)
107
- rspec-expectations (~> 3.8.0)
108
- rspec-mocks (~> 3.8.0)
109
- rspec-core (3.8.0)
110
- rspec-support (~> 3.8.0)
111
- rspec-expectations (3.8.3)
112
- diff-lcs (>= 1.2.0, < 2.0)
113
- rspec-support (~> 3.8.0)
114
- rspec-mocks (3.8.0)
115
- diff-lcs (>= 1.2.0, < 2.0)
116
- rspec-support (~> 3.8.0)
117
- rspec-support (3.8.0)
118
- semver2 (3.4.2)
119
- simplecov (0.16.1)
120
- docile (~> 1.1)
121
- json (>= 1.8, < 3)
122
- simplecov-html (~> 0.10.0)
123
- simplecov-html (0.10.2)
124
- sprockets (2.2.3)
125
- hike (~> 1.2)
126
- multi_json (~> 1.0)
127
- rack (~> 1.0)
128
- tilt (~> 1.1, != 1.3.0)
129
- sqlite3 (1.3.13)
130
- term-ansicolor (1.7.1)
131
- tins (~> 1.0)
132
- thor (0.20.3)
133
- thread_safe (0.3.6)
134
- tilt (1.4.1)
135
- tins (1.20.3)
136
- tzinfo (0.3.55)
137
-
138
- PLATFORMS
139
- ruby
140
-
141
- DEPENDENCIES
142
- activerecord (~> 3.2.22)
143
- activesupport (~> 3.2.22)
144
- ancestry (>= 1.3.0)
145
- appraisal
146
- coveralls
147
- jeweler
148
- railties (~> 3.2.22)
149
- rspec
150
- sqlite3 (~> 1.3.6)
151
-
152
- BUNDLED WITH
153
- 2.0.1