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
data/README.md CHANGED
@@ -33,20 +33,45 @@ Post installation
33
33
  =================
34
34
 
35
35
  ```
36
- rails g acts-as-messageable:migration table_name # default 'messages'
36
+ rails g acts_as_messageable:migration [messages] [--uuid]
37
37
  rake db:migrate
38
38
  ```
39
39
 
40
+ You need to run migration generator to create tables in database. You can do this with `acts_as_messageable:migration`
41
+ generator. Default table name is `messages`, you can pass table name and uuid option to enable `uuid` support (by
42
+ default disabled). UUID support is required in case when your user primary key is `uuid` type.
43
+
44
+ **Create `messages` table without `uuid` support**
45
+ ```
46
+ rails g acts_as_messageable:migration
47
+ ```
48
+
49
+ **Create `messages` table with `uuid` support**
50
+ ```
51
+ rails g acts_as_messageable:migration --uuid
52
+ ```
53
+
54
+ **Create `my_messages` table without `uuid` support**
55
+ ```
56
+ rails g acts_as_messageable:migration my_messages
57
+ ```
58
+
59
+ **Create `my_messages` table with `uuid` support**
60
+ ```
61
+ rails g acts_as_messageable:migration my_messages
62
+ ```
63
+
40
64
  Usage
41
65
  =====
42
66
 
43
67
  ```ruby
44
68
  class User < ActiveRecord::Base
45
69
  acts_as_messageable :table_name => "table_with_messages", # default 'messages'
46
- :required => :body # default [:topic, :body]
47
- :class_name => "CustomMessages" # default "ActsAsMessageable::Message",
48
- :dependent => :destroy # default :nullify
49
- :group_messages => true # default false
70
+ :required => :body, # default [:topic, :body]
71
+ :class_name => "CustomMessages", # default "ActsAsMessageable::Message",
72
+ :dependent => :destroy, # default :nullify
73
+ :group_messages => true, # default false
74
+ :search_scope => :custom_search # default :search
50
75
  end
51
76
  ```
52
77
 
@@ -227,7 +252,6 @@ records = @alice.messages.search("Search me") @alice search text "Search me" fr
227
252
  ```
228
253
 
229
254
  ## Filters
230
- ==========
231
255
 
232
256
  ```ruby
233
257
  @alice.messages.are_from(@bob) # all message from @bob
@@ -351,9 +375,3 @@ Search
351
375
  ```ruby
352
376
  @alice.messages.search("Search me") @alice seach text "Search me" from all messages
353
377
  ```
354
-
355
- Copyright © 2011-2012 Piotr Niełacny (http://ruby-blog.pl), released under the MIT license
356
-
357
-
358
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/LTe/acts-as-messageable/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
359
-
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'bundler'
3
5
  begin
@@ -8,6 +10,7 @@ rescue Bundler::BundlerError => e
8
10
  exit e.status_code
9
11
  end
10
12
  require 'rake'
13
+ require 'rubocop/rake_task'
11
14
 
12
15
  require 'jeweler'
13
16
  Jeweler::Tasks.new do |gem|
@@ -19,6 +22,7 @@ Jeweler::Tasks.new do |gem|
19
22
  # dependencies defined in Gemfile
20
23
  end
21
24
  Jeweler::RubygemsDotOrgTasks.new
25
+ RuboCop::RakeTask.new
22
26
 
23
27
  require 'rspec/core'
24
28
  require 'rspec/core/rake_task'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.11
1
+ 0.5.0
@@ -2,25 +2,29 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: acts-as-messageable 0.4.11 ruby lib
5
+ # stub: acts-as-messageable 0.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "acts-as-messageable".freeze
9
- s.version = "0.4.11"
9
+ s.version = "0.5.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Piotr Nielacny".freeze]
14
- s.date = "2019-06-09"
14
+ s.date = "2020-05-13"
15
15
  s.email = "piotr.nielacny@gmail.com".freeze
16
16
  s.extra_rdoc_files = [
17
17
  "README.md"
18
18
  ]
19
19
  s.files = [
20
20
  ".coveralls.yml",
21
+ ".dockerignore",
21
22
  ".rspec",
23
+ ".rubocop.yml",
24
+ ".rubocop_todo.yml",
22
25
  ".travis.yml",
23
26
  "Appraisals",
27
+ "Dockerfile",
24
28
  "Gemfile",
25
29
  "Gemfile.lock",
26
30
  "MIT-LICENSE",
@@ -28,72 +32,81 @@ Gem::Specification.new do |s|
28
32
  "Rakefile",
29
33
  "VERSION",
30
34
  "acts-as-messageable.gemspec",
35
+ "docker-compose.yml",
31
36
  "gemfiles/rails_3.2.gemfile",
32
- "gemfiles/rails_3.2.gemfile.lock",
33
- "gemfiles/rails_4.2.11.gemfile",
34
- "gemfiles/rails_4.2.11.gemfile.lock",
37
+ "gemfiles/rails_4.2.gemfile",
35
38
  "gemfiles/rails_5.2.gemfile",
36
- "gemfiles/rails_5.2.gemfile.lock",
37
39
  "gemfiles/rails_6.0.gemfile",
38
- "gemfiles/rails_6.0.gemfile.lock",
40
+ "gemfiles/rails_master.gemfile",
39
41
  "lib/acts-as-messageable.rb",
40
- "lib/acts-as-messageable/message.rb",
41
- "lib/acts-as-messageable/model.rb",
42
- "lib/acts-as-messageable/rails3.rb",
43
- "lib/acts-as-messageable/rails4.rb",
44
- "lib/acts-as-messageable/railtie.rb",
45
- "lib/acts-as-messageable/relation.rb",
46
- "lib/acts-as-messageable/scopes.rb",
47
- "lib/generators/acts-as-messageable/migration/migration_generator.rb",
48
- "lib/generators/acts-as-messageable/migration/templates/migration.rb",
49
- "lib/generators/acts-as-messageable/migration/templates/migration_permanent.rb",
50
- "spec/acts-as-messageable_spec.rb",
51
- "spec/custom-class_spec.rb",
52
- "spec/custom-required_spec.rb",
53
- "spec/group-messages_spec.rb",
42
+ "lib/acts_as_messageable.rb",
43
+ "lib/acts_as_messageable/message.rb",
44
+ "lib/acts_as_messageable/model.rb",
45
+ "lib/acts_as_messageable/rails3.rb",
46
+ "lib/acts_as_messageable/rails4.rb",
47
+ "lib/acts_as_messageable/rails6.rb",
48
+ "lib/acts_as_messageable/railtie.rb",
49
+ "lib/acts_as_messageable/relation.rb",
50
+ "lib/acts_as_messageable/scopes.rb",
51
+ "lib/generators/acts_as_messageable/migration/migration_generator.rb",
52
+ "lib/generators/acts_as_messageable/migration/templates/migration.rb",
53
+ "lib/generators/acts_as_messageable/migration/templates/migration_indexes.rb",
54
+ "lib/generators/acts_as_messageable/migration/templates/migration_opened_as_datetime.rb",
55
+ "lib/generators/acts_as_messageable/migration/templates/migration_permanent.rb",
56
+ "spec/acts_as_messageable_spec.rb",
57
+ "spec/custom_class_spec.rb",
58
+ "spec/custom_required_spec.rb",
59
+ "spec/group_messages_spec.rb",
60
+ "spec/migrations_spec.rb",
54
61
  "spec/spec_helper.rb",
55
62
  "spec/support/admin.rb",
63
+ "spec/support/custom_message.rb",
64
+ "spec/support/custom_message_uuid.rb",
65
+ "spec/support/custom_search_user.rb",
66
+ "spec/support/men.rb",
56
67
  "spec/support/send_message.rb",
57
- "spec/support/user.rb"
68
+ "spec/support/table_schema.rb",
69
+ "spec/support/user.rb",
70
+ "spec/support/uuid_user.rb"
58
71
  ]
59
72
  s.homepage = "http://github.com/LTe/acts-as-messageable".freeze
60
- s.rubygems_version = "2.7.6".freeze
73
+ s.rubygems_version = "3.1.3".freeze
61
74
  s.summary = "Make user messageable!;-)".freeze
62
75
 
63
76
  if s.respond_to? :specification_version then
64
77
  s.specification_version = 4
78
+ end
65
79
 
66
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
67
- s.add_runtime_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
68
- s.add_runtime_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
69
- s.add_runtime_dependency(%q<ancestry>.freeze, [">= 1.3.0"])
70
- s.add_runtime_dependency(%q<railties>.freeze, [">= 3.0.0"])
71
- s.add_development_dependency(%q<appraisal>.freeze, [">= 0"])
72
- s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
73
- s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
74
- s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
75
- s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
76
- else
77
- s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
78
- s.add_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
79
- s.add_dependency(%q<ancestry>.freeze, [">= 1.3.0"])
80
- s.add_dependency(%q<railties>.freeze, [">= 3.0.0"])
81
- s.add_dependency(%q<appraisal>.freeze, [">= 0"])
82
- s.add_dependency(%q<coveralls>.freeze, [">= 0"])
83
- s.add_dependency(%q<jeweler>.freeze, [">= 0"])
84
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
85
- s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
86
- end
80
+ if s.respond_to? :add_runtime_dependency then
81
+ s.add_runtime_dependency(%q<activerecord>.freeze, [">= 0"])
82
+ s.add_runtime_dependency(%q<activesupport>.freeze, [">= 0"])
83
+ s.add_runtime_dependency(%q<ancestry>.freeze, [">= 0"])
84
+ s.add_runtime_dependency(%q<railties>.freeze, [">= 0"])
85
+ s.add_development_dependency(%q<appraisal>.freeze, [">= 0"])
86
+ s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
87
+ s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
88
+ s.add_development_dependency(%q<pg>.freeze, [">= 0"])
89
+ s.add_development_dependency(%q<pry>.freeze, [">= 0"])
90
+ s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
91
+ s.add_development_dependency(%q<rubocop>.freeze, [">= 0"])
92
+ s.add_development_dependency(%q<sqlite3>.freeze, [">= 0"])
93
+ s.add_development_dependency(%q<timecop>.freeze, [">= 0"])
94
+ s.add_development_dependency(%q<yard>.freeze, [">= 0"])
87
95
  else
88
- s.add_dependency(%q<activerecord>.freeze, [">= 3.0.0"])
89
- s.add_dependency(%q<activesupport>.freeze, [">= 3.0.0"])
90
- s.add_dependency(%q<ancestry>.freeze, [">= 1.3.0"])
91
- s.add_dependency(%q<railties>.freeze, [">= 3.0.0"])
96
+ s.add_dependency(%q<activerecord>.freeze, [">= 0"])
97
+ s.add_dependency(%q<activesupport>.freeze, [">= 0"])
98
+ s.add_dependency(%q<ancestry>.freeze, [">= 0"])
99
+ s.add_dependency(%q<railties>.freeze, [">= 0"])
92
100
  s.add_dependency(%q<appraisal>.freeze, [">= 0"])
93
101
  s.add_dependency(%q<coveralls>.freeze, [">= 0"])
94
102
  s.add_dependency(%q<jeweler>.freeze, [">= 0"])
103
+ s.add_dependency(%q<pg>.freeze, [">= 0"])
104
+ s.add_dependency(%q<pry>.freeze, [">= 0"])
95
105
  s.add_dependency(%q<rspec>.freeze, [">= 0"])
106
+ s.add_dependency(%q<rubocop>.freeze, [">= 0"])
96
107
  s.add_dependency(%q<sqlite3>.freeze, [">= 0"])
108
+ s.add_dependency(%q<timecop>.freeze, [">= 0"])
109
+ s.add_dependency(%q<yard>.freeze, [">= 0"])
97
110
  end
98
111
  end
99
112
 
@@ -0,0 +1,73 @@
1
+ version: "3.7"
2
+ services:
3
+ development:
4
+ build:
5
+ context: '.'
6
+ args:
7
+ - RUBY_VERSION=2.7
8
+ - GEMFILE=Gemfile
9
+ volumes:
10
+ - ./:/home/app
11
+ environment:
12
+ - BUNDLE_GEMFILE=Gemfile
13
+ ruby_2.3.8_rails_3.2:
14
+ build:
15
+ context: '.'
16
+ args:
17
+ - RUBY_VERSION=2.3.8
18
+ - GEMFILE=rails_3.2.gemfile
19
+ environment:
20
+ - BUNDLE_GEMFILE=gemfiles/rails_3.2.gemfile
21
+ volumes:
22
+ - ./:/home/app
23
+ ruby_2.3.8_rails_4.2:
24
+ build:
25
+ context: '.'
26
+ args:
27
+ - RUBY_VERSION=2.3.8
28
+ - GEMFILE=rails_4.2.gemfile
29
+ volumes:
30
+ - ./:/home/app
31
+ environment:
32
+ - BUNDLE_GEMFILE=gemfiles/rails_4.2.gemfile
33
+ ruby_2.7_rails_5.2:
34
+ build:
35
+ context: '.'
36
+ args:
37
+ - RUBY_VERSION=2.7
38
+ - GEMFILE=rails_5.2.gemfile
39
+ volumes:
40
+ - ./:/home/app
41
+ environment:
42
+ - BUNDLE_GEMFILE=gemfiles/rails_5.2.gemfile
43
+ ruby_2.7_rails_6.0:
44
+ build:
45
+ context: '.'
46
+ args:
47
+ - RUBY_VERSION=2.7
48
+ - GEMFILE=rails_6.0.gemfile
49
+ volumes:
50
+ - ./:/home/app
51
+ environment:
52
+ - BUNDLE_GEMFILE=gemfiles/rails_6.0.gemfile
53
+ - RUN_GENERATORS=${RUN_GENERATORS-true}
54
+ ruby_2.7_rails_master:
55
+ build:
56
+ context: '.'
57
+ args:
58
+ - RUBY_VERSION=2.7
59
+ - GEMFILE=rails_master.gemfile
60
+ volumes:
61
+ - ./:/home/app
62
+ environment:
63
+ - BUNDLE_GEMFILE=gemfiles/rails_master.gemfile
64
+ ruby_latest_rails_master:
65
+ build:
66
+ context: '.'
67
+ args:
68
+ - RUBY_VERSION=latest
69
+ - GEMFILE=rails_master.gemfile
70
+ volumes:
71
+ - ./:/home/app
72
+ environment:
73
+ - BUNDLE_GEMFILE=gemfiles/rails_master.gemfile
@@ -1,16 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
- source "http://rubygems.org"
5
+ source 'http://rubygems.org'
4
6
 
5
- gem "activerecord", "~> 3.2.22"
6
- gem "activesupport", "~> 3.2.22"
7
- gem "ancestry", ">= 1.3.0"
8
- gem "railties", "~> 3.2.22"
7
+ gem 'activerecord', '~> 3.2.22'
8
+ gem 'activesupport', '~> 3.2.22'
9
+ gem 'ancestry'
10
+ gem 'railties', '~> 3.2.22'
9
11
 
10
12
  group :development do
11
- gem "appraisal"
12
- gem "coveralls", require: false
13
- gem "jeweler"
14
- gem "rspec"
15
- gem "sqlite3", "~> 1.3.6"
13
+ gem 'appraisal'
14
+ gem 'coveralls', require: false
15
+ gem 'jeweler'
16
+ gem 'pg'
17
+ gem 'pry'
18
+ gem 'rspec'
19
+ gem 'rubocop', require: false
20
+ gem 'sqlite3', '~> 1.3.6'
21
+ gem 'timecop'
22
+ gem 'yard'
16
23
  end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file was generated by Appraisal
4
+
5
+ source 'http://rubygems.org'
6
+
7
+ gem 'activerecord', '~> 4.2'
8
+ gem 'activesupport', '~> 4.2'
9
+ gem 'ancestry'
10
+ gem 'railties', '~> 4.2'
11
+ gem 'rdoc', '6.2.0'
12
+
13
+ group :development do
14
+ gem 'appraisal'
15
+ gem 'coveralls', require: false
16
+ gem 'jeweler'
17
+ gem 'pg'
18
+ gem 'pry'
19
+ gem 'rspec'
20
+ gem 'rubocop', require: false
21
+ gem 'sqlite3', '~> 1.3.6'
22
+ gem 'timecop'
23
+ gem 'yard'
24
+ end
@@ -1,16 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
- source "http://rubygems.org"
5
+ source 'http://rubygems.org'
4
6
 
5
- gem "activerecord", "~> 5.2.0"
6
- gem "activesupport", "~> 5.2.0"
7
- gem "ancestry", ">= 1.3.0"
8
- gem "railties", "~> 5.2.0"
7
+ gem 'activerecord', '~> 5.2.0'
8
+ gem 'activesupport', '~> 5.2.0'
9
+ gem 'ancestry'
10
+ gem 'railties', '~> 5.2.0'
9
11
 
10
12
  group :development do
11
- gem "appraisal"
12
- gem "coveralls", require: false
13
- gem "jeweler"
14
- gem "rspec"
15
- gem "sqlite3", "~> 1.3.6"
13
+ gem 'appraisal'
14
+ gem 'coveralls', require: false
15
+ gem 'jeweler'
16
+ gem 'pg'
17
+ gem 'pry'
18
+ gem 'rspec'
19
+ gem 'rubocop', require: false
20
+ gem 'sqlite3', '~> 1.3.6'
21
+ gem 'timecop'
22
+ gem 'yard'
16
23
  end
@@ -1,16 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # This file was generated by Appraisal
2
4
 
3
- source "http://rubygems.org"
5
+ source 'http://rubygems.org'
4
6
 
5
- gem "activerecord", "~> 6.0.0.rc1"
6
- gem "activesupport", "~> 6.0.0.rc1"
7
- gem "ancestry", ">= 1.3.0"
8
- gem "railties", "~> 6.0.0.rc1"
7
+ gem 'activerecord', '~> 6'
8
+ gem 'activesupport', '~> 6'
9
+ gem 'ancestry'
10
+ gem 'railties', '~> 6'
9
11
 
10
12
  group :development do
11
- gem "appraisal"
12
- gem "coveralls", require: false
13
- gem "jeweler"
14
- gem "rspec"
15
- gem "sqlite3", "~> 1.4.0"
13
+ gem 'appraisal'
14
+ gem 'coveralls', require: false
15
+ gem 'jeweler'
16
+ gem 'pg'
17
+ gem 'pry'
18
+ gem 'rspec'
19
+ gem 'rubocop', require: false
20
+ gem 'sqlite3', '~> 1.4.0'
21
+ gem 'timecop'
22
+ gem 'yard'
16
23
  end