acts_as_notifiable_redmine 0.1
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 +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +35 -0
- data/acts_as_notifiable_redmine.gemspec +21 -0
- data/lib/acts_as_notifiable_redmine.rb +7 -0
- data/lib/acts_as_notifiable_redmine/channel.rb +37 -0
- data/lib/acts_as_notifiable_redmine/couriers.rb +13 -0
- data/lib/acts_as_notifiable_redmine/couriers/pusher_courier.rb +51 -0
- data/lib/acts_as_notifiable_redmine/event.rb +14 -0
- data/lib/acts_as_notifiable_redmine/notifications.rb +41 -0
- data/lib/acts_as_notifiable_redmine/version.rb +3 -0
- metadata +57 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6fb1c74cb7172a58728585e51cf267caf71195cc
|
4
|
+
data.tar.gz: 11352631b7152326cd2fddd6b87e919f80416cf0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 64a1b2ec08bc40ab7ac141ac4ab8053827549dbb69d6cb8f4080d74ce22162e6c87197ec1968ea9215f34c1925c74cc7d6b70fa7e9f888a90936fa77c2ad7ef8
|
7
|
+
data.tar.gz: 8abaed0ab9aef03e7e626e0327e57be5c425697032c3293b247185fb233aafcca43650f88df3c1bfd4689ef3a683ae0c0c634f0c19c53939db28445ff2c9e8e9
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Nicolas Rodriguez (nrodriguez@jbox-web.com), JBox Web (http://www.jbox-web.com)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
### A gem which makes notifying your Redmine instance easy ;)
|
2
|
+
|
3
|
+
This gem is designed to integrate the [Pusher Notification System](http://pusher.com) in Redmine.
|
4
|
+
|
5
|
+
It must be used with [Redmine Pusher Notifications](https://github.com/jbox-web/redmine_pusher_notifications).
|
6
|
+
|
7
|
+
## Code status
|
8
|
+
|
9
|
+
* [](https://codeclimate.com/github/jbox-web/acts_as_notifiable_redmine)
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
* Ruby 1.9.x or 2.0.x
|
13
|
+
* a working [Redmine](http://www.redmine.org/) installation
|
14
|
+
* an account on [Pusher](http://pusher.com)
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
gem install acts_as_notifiable_redmine
|
19
|
+
|
20
|
+
## Copyrights & License
|
21
|
+
acts_as_notifiable_redmine is completely free and open source and released under the [MIT License](https://github.com/jbox-web/acts_as_notifiable_redmine/blob/devel/LICENSE.txt).
|
22
|
+
|
23
|
+
Copyright (c) 2014 Nicolas Rodriguez (nrodriguez@jbox-web.com), JBox Web (http://www.jbox-web.com) [](https://coderwall.com/n-rodriguez)
|
24
|
+
|
25
|
+
## Contribute
|
26
|
+
|
27
|
+
You can contribute to this plugin in many ways such as :
|
28
|
+
* Helping with documentation
|
29
|
+
* Contributing code (features or bugfixes)
|
30
|
+
* Reporting a bug
|
31
|
+
* Submitting translations
|
32
|
+
|
33
|
+
You can also donate :)
|
34
|
+
|
35
|
+
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FBT7E7DAVVEEU)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "acts_as_notifiable_redmine/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "acts_as_notifiable_redmine"
|
7
|
+
s.version = ActsAsNotifiableRedmine::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Nicolas Rodriguez"]
|
10
|
+
s.email = ["nrodriguez@jbox-web.com"]
|
11
|
+
s.homepage = "https://github.com/jbox-web/acts_as_notifiable_redmine"
|
12
|
+
s.summary = %q{A Ruby gem who provides a small DSL to register Pusher channels and events in Redmine}
|
13
|
+
s.license = 'MIT'
|
14
|
+
|
15
|
+
s.rubyforge_project = "acts_as_notifiable_redmine"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
module ActsAsNotifiableRedmine
|
2
|
+
require 'acts_as_notifiable_redmine/channel'
|
3
|
+
require 'acts_as_notifiable_redmine/event'
|
4
|
+
require 'acts_as_notifiable_redmine/notifications'
|
5
|
+
require 'acts_as_notifiable_redmine/couriers'
|
6
|
+
require 'acts_as_notifiable_redmine/couriers/pusher_courier'
|
7
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module ActsAsNotifiableRedmine
|
2
|
+
class Channel
|
3
|
+
|
4
|
+
attr_reader :name, :identifier, :events
|
5
|
+
|
6
|
+
def initialize(id, &block)
|
7
|
+
@id = id.to_sym
|
8
|
+
@name = @id
|
9
|
+
@identifier = "channel_#{name}"
|
10
|
+
@events = []
|
11
|
+
@target = "#{name}"
|
12
|
+
|
13
|
+
instance_eval(&block)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def target(target)
|
18
|
+
@target = target
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def token
|
23
|
+
if @target.is_a?(Proc)
|
24
|
+
"#{@name}-#{@target.call(self)}"
|
25
|
+
else
|
26
|
+
@target
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def event(name, options = {})
|
32
|
+
new_event = Event.new(name, options)
|
33
|
+
@events.push(new_event)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ActsAsNotifiableRedmine
|
2
|
+
module Couriers
|
3
|
+
|
4
|
+
def self.factory(klass_name, &block)
|
5
|
+
klass = "ActsAsNotifiableRedmine::Couriers::#{klass_name.to_s.capitalize}Courier".constantize
|
6
|
+
klass.new(&block)
|
7
|
+
rescue => e
|
8
|
+
puts e.message
|
9
|
+
nil
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module ActsAsNotifiableRedmine
|
2
|
+
module Couriers
|
3
|
+
|
4
|
+
class PusherCourier
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def def_field(*names)
|
8
|
+
class_eval do
|
9
|
+
names.each do |name|
|
10
|
+
define_method(name) do |*args|
|
11
|
+
args.empty? ? instance_variable_get("@#{name}") : instance_variable_set("@#{name}", *args)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def_field :name, :app_id, :key, :secret, :encrypted
|
19
|
+
|
20
|
+
|
21
|
+
def initialize(&block)
|
22
|
+
@name = 'Pusher'
|
23
|
+
@app_id = ''
|
24
|
+
@key = ''
|
25
|
+
@secret = ''
|
26
|
+
@encrypted = true
|
27
|
+
|
28
|
+
instance_eval(&block)
|
29
|
+
setup_pusher
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def send_notification(channels, event, options)
|
34
|
+
Pusher.trigger(channels, event, options)
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
|
41
|
+
def setup_pusher
|
42
|
+
Pusher.app_id = @app_id
|
43
|
+
Pusher.key = @key
|
44
|
+
Pusher.secret = @secret
|
45
|
+
Pusher.encrypted = @encrypted
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module ActsAsNotifiableRedmine
|
2
|
+
class Notifications
|
3
|
+
|
4
|
+
@@channels = {}
|
5
|
+
@@courier = nil
|
6
|
+
|
7
|
+
class << self
|
8
|
+
|
9
|
+
def register_courier(type, &block)
|
10
|
+
@@courier = Couriers.factory(type, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
def register_channel(id, &block)
|
15
|
+
@@channels[id] = Channel.new(id, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
def channels
|
20
|
+
@@channels
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def courier
|
25
|
+
@@courier
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
def find_by_id(id)
|
30
|
+
@@channels[id.to_sym]
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def send_notification(channels, event, options)
|
35
|
+
@@courier.send_notification(channels, event, options)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acts_as_notifiable_redmine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicolas Rodriguez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-31 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email:
|
15
|
+
- nrodriguez@jbox-web.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- Gemfile
|
21
|
+
- LICENSE.txt
|
22
|
+
- README.md
|
23
|
+
- acts_as_notifiable_redmine.gemspec
|
24
|
+
- lib/acts_as_notifiable_redmine.rb
|
25
|
+
- lib/acts_as_notifiable_redmine/channel.rb
|
26
|
+
- lib/acts_as_notifiable_redmine/couriers.rb
|
27
|
+
- lib/acts_as_notifiable_redmine/couriers/pusher_courier.rb
|
28
|
+
- lib/acts_as_notifiable_redmine/event.rb
|
29
|
+
- lib/acts_as_notifiable_redmine/notifications.rb
|
30
|
+
- lib/acts_as_notifiable_redmine/version.rb
|
31
|
+
homepage: https://github.com/jbox-web/acts_as_notifiable_redmine
|
32
|
+
licenses:
|
33
|
+
- MIT
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project: acts_as_notifiable_redmine
|
51
|
+
rubygems_version: 2.2.2
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: A Ruby gem who provides a small DSL to register Pusher channels and events
|
55
|
+
in Redmine
|
56
|
+
test_files: []
|
57
|
+
has_rdoc:
|