simple_notifications 1.0.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3429c440ecdbb8810066360b76cc3a1ba79ff9fd5ecc108171a052d57fe1a649
4
+ data.tar.gz: 117ab5c746b2a14f1247cfdd1918e0fb642cf14acb096abc22c56c878128c915
5
+ SHA512:
6
+ metadata.gz: cc556f64c92b82ed8533185bd67b23a28d6b42dd930ba36e20c8b0ecaa0e0f648b5eeade1b85a3bf4f021ac765e6b9ca529a9c632cd491698c52240009b4dfe5
7
+ data.tar.gz: 9904cbd9964d6a53315db6650bd354a5533c649a8d84e8c7c0296a55fc97ac7ac6789d20398c6bf0e232f7c08f585c52ad30a73e6a73433f1d63d2f983860dea
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .idea/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.0
7
+ before_install: gem install bundler -v 1.16.6
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at ashish2.kumar@trantorinc.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in simple_notifications.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,35 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ simple_notifications (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.3)
10
+ rake (10.5.0)
11
+ rspec (3.8.0)
12
+ rspec-core (~> 3.8.0)
13
+ rspec-expectations (~> 3.8.0)
14
+ rspec-mocks (~> 3.8.0)
15
+ rspec-core (3.8.0)
16
+ rspec-support (~> 3.8.0)
17
+ rspec-expectations (3.8.2)
18
+ diff-lcs (>= 1.2.0, < 2.0)
19
+ rspec-support (~> 3.8.0)
20
+ rspec-mocks (3.8.0)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.8.0)
23
+ rspec-support (3.8.0)
24
+
25
+ PLATFORMS
26
+ ruby
27
+
28
+ DEPENDENCIES
29
+ bundler (~> 1.16)
30
+ rake (~> 10.0)
31
+ rspec (~> 3.0)
32
+ simple_notifications!
33
+
34
+ BUNDLED WITH
35
+ 1.16.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Ashish Garg
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,134 @@
1
+ # SimpleNotifications
2
+
3
+ A very simple gem providing the notifications functionality to any model in a Rails application.
4
+
5
+ ### Installation
6
+
7
+ Add following line to your gemfile
8
+
9
+ ```ruby
10
+ gem 'simple_notifications'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install simple_notifications
20
+
21
+ ### Usage
22
+
23
+ Run the simple notifications generator
24
+
25
+ ```ruby
26
+ rails generate simple_notifications:install
27
+ ```
28
+ This will generate two files in your rails project
29
+
30
+ * simple_notifications.rb - An initializer file.
31
+ * Migration file - Required for recording notifications.
32
+
33
+ Then run
34
+
35
+ ```ruby
36
+ rails db:migrate
37
+ ```
38
+
39
+ Add following line to the model for which notifications functionality is required
40
+
41
+ ```ruby
42
+ notify sender: :author, receivers: :followers
43
+ ```
44
+ Or you can provide ActiveRecord::Base object or ActiveRecord::Relation objects as
45
+
46
+ ```ruby
47
+ notify sender: :author, receivers: User.all
48
+
49
+ notify sender: User.first, receivers: [:followers, User.all]
50
+ ```
51
+
52
+ Here :sender and :followers should be associations for the model which needs to be notified.
53
+
54
+ ### Notification Models
55
+
56
+ ```ruby
57
+ SimpleNotifications::Record
58
+ SimpleNotifications::Delivery
59
+ ```
60
+
61
+ ### Scopes
62
+
63
+ ```ruby
64
+ SimpleNotifications::Record.read
65
+ SimpleNotifications::Record.unread
66
+ ```
67
+
68
+ ### Methods
69
+ Suppose **Post** is the notified model and **author** is the sender association and **followers** is the receiver association.
70
+ Then following methods are available
71
+
72
+ ```ruby
73
+ Post.notified?
74
+ ```
75
+
76
+ **Methods for the [post] object**
77
+
78
+ ```ruby
79
+ post.notify(sender: :author, receivers: :followers, message: 'My own message')
80
+ post.notifications
81
+ post.notifiers
82
+ post.notificants
83
+ post.#{receiver_class}_notificants
84
+ post.read_marked_notificants
85
+ post.unread_marked_notificants
86
+ post.mark_read
87
+ post.mark_read(receivers)
88
+ post.mark_unread
89
+ post.mark_unread(receivers)
90
+ ```
91
+
92
+ **Methods for [author] object**
93
+
94
+ ```ruby
95
+ author.sent_notifications
96
+ ```
97
+
98
+ **Methods for [follower] object**
99
+
100
+ ```ruby
101
+ follower.received_notifications
102
+ ```
103
+
104
+ **Methods for [notification] object**
105
+ ```ruby
106
+ SimpleNotifications::Record.last.sender
107
+ SimpleNotifications::Record.last.entity
108
+ SimpleNotifications::Record.last.#{receiver_class.name.downcase}_receivers
109
+ ```
110
+
111
+ ### Skipping Notification
112
+
113
+ ```ruby
114
+ Post.create(content: '123', notify: false)
115
+ ```
116
+
117
+ ### Custom Notification message
118
+
119
+ ```ruby
120
+ Post.create(content: '123', message: 'My custom notification message')
121
+ ```
122
+
123
+ ## Contributing
124
+
125
+ Bug reports and pull requests are welcome on GitHub at https://github.com/aashishgarg/simple_notifications.
126
+ This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
127
+
128
+ ## License
129
+
130
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
131
+
132
+ ## Code of Conduct
133
+
134
+ Everyone interacting in the SimpleNotifications project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/simple_notifications/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "simple_notifications"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ Description:
2
+ 1. Creates an initializer file for simple_notifications.
3
+ 2. Creates a migration file file for recording the data of notifications receiver and sender.
4
+
5
+ Example:
6
+ rails generate simple_notifications:install
7
+
8
+ This will create:
9
+ config/simple_notifications.rb
10
+ db/migrate/{time_stamp}_create_simple_notifications.rb
@@ -0,0 +1,13 @@
1
+ module SimpleNotifications
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('templates', __dir__)
4
+
5
+ def copy_initializer_file
6
+ copy_file "initializer.rb", "config/initializers/simple_notifications.rb"
7
+ end
8
+
9
+ def create_migration_file
10
+ copy_file "migration.rb", "db/migrate/#{Time.now.strftime("%Y%m%d%H%M%S")}_create_simple_notifications.rb"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1 @@
1
+ # Initializer file for simple_notifications
@@ -0,0 +1,25 @@
1
+ class CreateSimpleNotifications < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table(:simple_notifications) do |t|
4
+ t.references :sender, polymorphic: true
5
+ t.references :entity, polymorphic: true
6
+ t.string :message
7
+
8
+ t.timestamps
9
+ end
10
+
11
+ create_table(:deliveries) do |t|
12
+ t.references :simple_notification
13
+ t.references :receiver, polymorphic: true
14
+ t.boolean :is_delivered, default: false
15
+ t.boolean :is_read, default: false
16
+
17
+ t.timestamps
18
+ end
19
+
20
+ add_index(:simple_notifications, [:sender_id, :sender_type])
21
+ add_index(:simple_notifications, [:entity_id, :entity_type])
22
+ add_index(:deliveries, [:sender_id, :sender_type])
23
+ add_index(:deliveries, :is_delivered)
24
+ end
25
+ end
@@ -0,0 +1,12 @@
1
+ require 'simple_notifications/version'
2
+ require 'simple_notifications/base'
3
+ require_relative 'simple_notifications/app/models/simple_notification'
4
+ require_relative 'simple_notifications/app/models/delivery'
5
+
6
+ module SimpleNotifications
7
+ def self.included(base_class)
8
+ base_class.extend Base
9
+ end
10
+ end
11
+
12
+ ActiveRecord::Base.send(:include, SimpleNotifications)
@@ -0,0 +1,9 @@
1
+ module SimpleNotifications
2
+ class Delivery < ActiveRecord::Base
3
+ self.table_name = 'deliveries'
4
+
5
+ # --- Associations --- #
6
+ belongs_to :simple_notification, class_name: 'SimpleNotifications::Record', inverse_of: :deliveries
7
+ belongs_to :receiver, polymorphic: true
8
+ end
9
+ end
@@ -0,0 +1,29 @@
1
+ module SimpleNotifications
2
+ class Record < ActiveRecord::Base
3
+ self.table_name = 'simple_notifications'
4
+
5
+ # --- Associations --- #
6
+ belongs_to :sender, polymorphic: true
7
+ belongs_to :entity, polymorphic: true
8
+ has_many :deliveries, class_name: 'SimpleNotifications::Delivery', inverse_of: :simple_notification,
9
+ foreign_key: :simple_notification_id, dependent: :destroy
10
+ has_many :read_deliveries, -> {where(is_read: true)}, class_name: 'SimpleNotifications::Delivery', inverse_of: :simple_notification,
11
+ foreign_key: :simple_notification_id, dependent: :destroy
12
+ has_many :unread_deliveries, -> {where(is_read: false)}, class_name: 'SimpleNotifications::Delivery', inverse_of: :simple_notification,
13
+ foreign_key: :simple_notification_id, dependent: :destroy
14
+
15
+ scope :read, -> {where(is_read: true)}
16
+ scope :unread, -> {where.not(is_read: true)}
17
+
18
+ # --- validations --- #
19
+ validates :message, presence: true, length: {minimum: 1, maximum: 199}
20
+
21
+ # --- Callbacks --- #
22
+ after_create_commit :after_actions
23
+
24
+ private
25
+
26
+ def after_actions
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,162 @@
1
+ module SimpleNotifications
2
+ module Base
3
+ mattr_accessor :notified_flag, :entity_class, :sender, :receivers
4
+
5
+ #Getter to check if model is enabled with notifications
6
+ def notified?
7
+ !!@@notified_flag
8
+ end
9
+
10
+ # Add this method to any model and it starts the notification functionality on the Model.
11
+ # Expects two parameters :sender and :receiver.
12
+ def notify(options = {})
13
+ @@entity_class = self
14
+ @@sender = options[:sender]
15
+ @@receivers = options[:receivers]
16
+
17
+ open_sender_class
18
+ open_receiver_class
19
+ open_notified_class
20
+
21
+ @@notified_flag = true
22
+ end
23
+
24
+ def open_sender_class
25
+ # Define association for sender model
26
+ sender_class(@@sender).class_eval do
27
+ has_many :sent_notifications, class_name: 'SimpleNotifications::Record', as: :sender
28
+ end
29
+ end
30
+
31
+ def open_receiver_class
32
+ # Define association for receiver model
33
+ [receivers_class(@@receivers)].flatten.each do |base|
34
+ base.class_eval do
35
+ has_many :deliveries, class_name: 'SimpleNotifications::Delivery', as: :receiver
36
+ has_many :received_notifications, through: :deliveries, source: :simple_notification
37
+ end
38
+ end
39
+ end
40
+
41
+ def open_notified_class
42
+ class_eval do
43
+ attr_accessor :message, :notify
44
+ # Define association for the notified model
45
+ has_many :notifications, class_name: 'SimpleNotifications::Record', as: :entity
46
+ has_many :notifiers, through: :notifications, source: :sender, source_type: sender_class(@@sender).to_s
47
+
48
+ SimpleNotifications::Record.class_eval do
49
+ [@@entity_class.receivers_class(@@receivers)].flatten.each do |receiver_class|
50
+ has_many "#{receiver_class.name.downcase}_receivers".to_sym,
51
+ through: :deliveries,
52
+ source: :receiver,
53
+ source_type: receiver_class.name
54
+ end
55
+ end
56
+
57
+ [receivers_class(@@receivers)].flatten.each do |receiver_class|
58
+ has_many "#{receiver_class.name.downcase}_notificants".to_sym,
59
+ through: :notifications,
60
+ source: "#{receiver_class.name.downcase}_receivers".to_sym
61
+ end
62
+
63
+ # has_many :notificants, through: :notifications, source: :receivers
64
+ has_many :read_deliveries, through: :notifications, source: :read_deliveries
65
+ has_many :unread_deliveries, through: :notifications, source: :unread_deliveries
66
+ # has_many :read_notificants, through: :read_deliveries, source: :receiver, source_type: 'User'
67
+ # has_many :unread_notificants, through: :unread_deliveries, source: :receiver, source_type: 'User'
68
+
69
+ after_create_commit :create_notification, if: proc {@notify.nil? || !!@notify}
70
+ after_update_commit :update_notification, if: proc {@notify.nil? || !!@notify}
71
+
72
+ # Check if notifications has already been delivered.
73
+ def notified?
74
+ !notifications.blank?
75
+ end
76
+
77
+ # Deliver notifications at any time
78
+ def notify(options = {})
79
+ raise 'SimpleNotification::SenderReceiverError' unless options[:sender] && options[:receivers]
80
+ @message = options[:message] if options[:message]
81
+ notification = notifications.build(entity: self, sender: options[:sender],
82
+ message: default_message(self, options[:sender], 'created'))
83
+ options[:receivers].each {|receiver| notification.deliveries.build(receiver: receiver)}
84
+ notification.save
85
+ end
86
+
87
+ def notificants
88
+ #TODO : Need to eager load
89
+ SimpleNotifications::Record.where(entity: self).collect {|notification| notification.deliveries.collect(&:receiver)}.flatten
90
+ end
91
+
92
+ def read_marked_notificants
93
+ #TODO : Need to eager load
94
+ SimpleNotifications::Record.where(entity: self).collect {|notification| notification.deliveries.where(is_read: true).collect(&:receiver)}.flatten
95
+ end
96
+
97
+ def unread_marked_notificants
98
+ #TODO : Need to eager load
99
+ SimpleNotifications::Record.where(entity: self).collect {|notification| notification.deliveries.where(is_read: false).collect(&:receiver)}.flatten
100
+ end
101
+
102
+ # Mark notifications in read mode.
103
+ # If notificants are provided then only those respective notifications will be marked read.
104
+ # Else all will be marked as read.
105
+ def mark_read(notificants = nil)
106
+ (notificants ? unread_deliveries.where(receiver: notificants) : unread_deliveries).update_all(is_read: true)
107
+ end
108
+
109
+ # Mark notifications in unread mode.
110
+ # If notificants are provided then only those respective notifications will be marked unread.
111
+ # Else all will be marked as unread.
112
+ def mark_unread(notificants = nil)
113
+ (notificants ? read_deliveries.where(receiver: notificants) : read_deliveries).update_all(is_read: false)
114
+ end
115
+
116
+ private
117
+
118
+ def get_obj(sender_or_receivers)
119
+ sender_or_receivers.kind_of?(Symbol) ? send(sender_or_receivers) : sender_or_receivers
120
+ end
121
+
122
+ def default_message(entity, sender, action)
123
+ @message || "#{entity.class.name} #{entity.name} #{action}."
124
+ end
125
+
126
+ def create_notification
127
+ notify({sender: get_obj(@@sender), receivers: get_obj(@@receivers), message: default_message(self, get_obj(@@sender), 'created')})
128
+ end
129
+
130
+ def update_notification
131
+ notify({sender: get_obj(@@sender), receivers: get_obj(@@receivers), message: default_message(self, get_obj(@@sender), 'updated')})
132
+ end
133
+ end
134
+ end
135
+
136
+ def sender_class(sender)
137
+ if sender.kind_of? Symbol
138
+ reflections[sender.to_s].klass
139
+ elsif sender.kind_of? ActiveRecord::Base
140
+ sender.class
141
+ else
142
+ raise 'SimpleNotifications::SenderTypeError'
143
+ end
144
+ end
145
+
146
+ def receivers_class(receivers)
147
+ if receivers.kind_of? Symbol
148
+ reflections[receivers.to_s].klass
149
+ else
150
+ if receivers.kind_of? ActiveRecord::Base
151
+ receivers.class
152
+ elsif receivers.kind_of? ActiveRecord::Relation
153
+ receivers.klass
154
+ elsif receivers.kind_of? Array
155
+ receivers.flatten.collect {|receiver| receivers_class(receiver)}
156
+ else
157
+ raise 'SimpleNotifications::ReceiverTypeError'
158
+ end
159
+ end
160
+ end
161
+ end
162
+ end
@@ -0,0 +1,3 @@
1
+ module SimpleNotifications
2
+ VERSION = "1.0.3"
3
+ end
@@ -0,0 +1,41 @@
1
+ lib = File.expand_path("../lib", __FILE__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require "simple_notifications/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "simple_notifications"
7
+ spec.version = SimpleNotifications::VERSION
8
+ spec.authors = ["Ashish Garg"]
9
+ spec.email = ["01ashishgarg@gmail.com"]
10
+
11
+ spec.summary = %q{A very simple gem providing the notifications functionality to any model in a Rails application.}
12
+ spec.description = %q{A very simple gem providing the notifications functionality to any model in a Rails application.}
13
+ spec.homepage = "https://github.com/aashishgarg/simple_notifications"
14
+ spec.license = "MIT"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ # if spec.respond_to?(:metadata)
19
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
+
21
+ # spec.metadata["homepage_uri"] = spec.homepage
22
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
23
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
24
+ # else
25
+ # raise "RubyGems 2.0 or newer is required to protect against " \
26
+ # "public gem pushes."
27
+ # end
28
+
29
+ # Specify which files should be added to the gem when it is released.
30
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
31
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
32
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
33
+ end
34
+ spec.bindir = "exe"
35
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
+ spec.require_paths = ["lib"]
37
+
38
+ spec.add_development_dependency "bundler", "~> 1.16"
39
+ spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "rspec", "~> 3.0"
41
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple_notifications
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Ashish Garg
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: A very simple gem providing the notifications functionality to any model
56
+ in a Rails application.
57
+ email:
58
+ - 01ashishgarg@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - ".rspec"
65
+ - ".travis.yml"
66
+ - CODE_OF_CONDUCT.md
67
+ - Gemfile
68
+ - Gemfile.lock
69
+ - LICENSE.txt
70
+ - README.md
71
+ - Rakefile
72
+ - bin/console
73
+ - bin/setup
74
+ - lib/generators/simple_notifications/install/USAGE
75
+ - lib/generators/simple_notifications/install/install_generator.rb
76
+ - lib/generators/simple_notifications/install/templates/initializer.rb
77
+ - lib/generators/simple_notifications/install/templates/migration.rb
78
+ - lib/simple_notifications.rb
79
+ - lib/simple_notifications/app/models/delivery.rb
80
+ - lib/simple_notifications/app/models/simple_notification.rb
81
+ - lib/simple_notifications/base.rb
82
+ - lib/simple_notifications/version.rb
83
+ - simple_notifications.gemspec
84
+ homepage: https://github.com/aashishgarg/simple_notifications
85
+ licenses:
86
+ - MIT
87
+ metadata: {}
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ requirements: []
103
+ rubyforge_project:
104
+ rubygems_version: 2.7.3
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: A very simple gem providing the notifications functionality to any model
108
+ in a Rails application.
109
+ test_files: []