crier 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ccbf63ac57f13537d175c3f100e8dd4f5f7e45a9
4
- data.tar.gz: 05e3baa8d4c1d4a1bc84297341f6e6ae71b75deb
2
+ SHA256:
3
+ metadata.gz: 6f4fa7f75a941cba9c57fa2e281d6bc0e92c9b88d2b571a4d380a7922ad6dfd1
4
+ data.tar.gz: dd83363b1b70cb6f6e4a4654da201a48120810c264ae18030c9ddbc5ac8d30b0
5
5
  SHA512:
6
- metadata.gz: ab8c92784743d2a6722a14e7012b6a509b3cef321c4d071b38e42447b170c5c79a522a7b775ff19754418d0490f9f1d5a23c4c9794ff531291d5a6275c41bf72
7
- data.tar.gz: aa36e3968a1abd470d4d58f9710edbe5dd9eac2f5710a61f4d0e0af8c74c8e242a7d092ccf3f2ce75b2df6e4ca6889cea544d7a265980d1c52377c6e1f65f409
6
+ metadata.gz: f8469062945a146c19d6fd8d595f8e04b996369730a1cc8997173b4bb56f9167f3733a0895d5a7382962a62b03bcce0ad80bec775fe85a53bf61efba4e3ccf23
7
+ data.tar.gz: ab0ef99180409a765d103944a752b43e42863303e632ef5c1acdb6947bc2315bb6a860f5daa8d0b5f3effe012d2d0efb23b35537dbebdf6cf8d08dd37ba484da
data/README.md CHANGED
@@ -64,3 +64,19 @@ Crier::Notification.heard_by(some_user) # Get all the
64
64
  Crier::Notification.about(@record) # Get all the notifications with the given subject
65
65
  Crier::Notification.in_scope(:my_town) # Get all the notifications within the given scope
66
66
  ```
67
+
68
+ ## Testing
69
+
70
+ Define Rails versions you'd like to test in the `Appraisals` file and then run `bundle exec appraisal install`
71
+
72
+ Run tests against all your Rails versions:
73
+
74
+ ```bash
75
+ bundle exec appraisal rake spec
76
+ ```
77
+
78
+ Or just run specific versions:
79
+
80
+ ```bash
81
+ bundle exec appraisal rails-5 rake
82
+ ```
@@ -2,10 +2,8 @@ module Crier
2
2
  # If a notification has listeners, the notification is considered private and only available to those listeners
3
3
  class Listening < ActiveRecord::Base
4
4
  self.table_name = 'crier_listenings'
5
-
5
+
6
6
  belongs_to :notification
7
7
  belongs_to :user
8
-
9
- validates_presence_of :user_id, :notification_id
10
8
  end
11
- end
9
+ end
@@ -2,7 +2,11 @@ module Crier
2
2
  class Notification < ActiveRecord::Base
3
3
  self.table_name = 'crier_notifications'
4
4
 
5
- belongs_to :crier, :class_name => 'User'
5
+ if ActiveRecord::VERSION::MAJOR <= 4
6
+ belongs_to :crier, :class_name => 'User'
7
+ else
8
+ belongs_to :crier, :class_name => 'User', :optional => true
9
+ end
6
10
  belongs_to :subject, :polymorphic => true
7
11
 
8
12
  has_many :listenings, :dependent => :delete_all
@@ -12,9 +16,11 @@ module Crier
12
16
 
13
17
  scope :by, lambda {|user| where(:crier_id => user) }
14
18
  scope :heard_by, lambda {|user| joins("LEFT OUTER JOIN #{Listening.table_name} ON #{Listening.table_name}.notification_id = #{table_name}.id").where("#{Listening.table_name}.user_id = #{user.id} OR NOT private")}
15
- scope :about, lambda {|subject| where(:subject_id => subject.id, :subject_type => subject.class) }
19
+ scope :about, lambda {|subject| where(:subject_id => subject.id, :subject_type => subject.class.name) }
16
20
  scope :in_scope, lambda {|scope| where(:scope => scope) }
17
21
 
22
+ before_save :set_privacy
23
+
18
24
  # Shortcut for creating a private audience for this notification
19
25
  def to(audience)
20
26
  self.update_column(:private, true)
@@ -26,5 +32,11 @@ module Crier
26
32
  def to_others(audience)
27
33
  to(Array(audience) - [crier])
28
34
  end
35
+
36
+ private
37
+
38
+ def set_privacy
39
+ self.private = audience.present? unless private_changed?
40
+ end
29
41
  end
30
42
  end
data/lib/crier/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Crier
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Wallace
8
8
  - Nicholas Jakobsen
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-16 00:00:00.000000000 Z
12
+ date: 2021-10-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -17,20 +17,76 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3.2'
20
+ version: '4'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
- version: '5.0'
23
+ version: '7'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: '3.2'
30
+ version: '4'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '7'
34
+ - !ruby/object:Gem::Dependency
35
+ name: bundler
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1'
41
+ type: :development
42
+ prerelease: false
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1'
48
+ - !ruby/object:Gem::Dependency
49
+ name: sqlite3
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.4'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.4'
62
+ - !ruby/object:Gem::Dependency
63
+ name: appraisal
64
+ requirement: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ type: :development
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ - !ruby/object:Gem::Dependency
77
+ name: rspec-rails
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4'
34
90
  description: Simple notification for the whole town
35
91
  email:
36
92
  - contact@culturecode.ca
@@ -45,10 +101,10 @@ files:
45
101
  - lib/crier/notification.rb
46
102
  - lib/crier/version.rb
47
103
  - lib/tasks/crier_tasks.rake
48
- homepage:
104
+ homepage:
49
105
  licenses: []
50
106
  metadata: {}
51
- post_install_message:
107
+ post_install_message:
52
108
  rdoc_options: []
53
109
  require_paths:
54
110
  - lib
@@ -63,9 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
119
  - !ruby/object:Gem::Version
64
120
  version: '0'
65
121
  requirements: []
66
- rubyforge_project:
67
- rubygems_version: 2.2.2
68
- signing_key:
122
+ rubygems_version: 3.0.8
123
+ signing_key:
69
124
  specification_version: 4
70
125
  summary: Simple notification for the whole town
71
126
  test_files: []