doorkeepr-rails 0.1.3 → 0.1.4
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 +4 -4
- data/lib/doorkeepr/rails.rb +21 -3
- data/lib/doorkeepr/rails/entrance.rb +1 -1
- data/lib/doorkeepr/rails/nerve.rb +6 -9
- data/lib/doorkeepr/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d972f6fe35df4f737827c71c69182fdba4c34fb6
|
4
|
+
data.tar.gz: 6be891d0d01098c2a1d9cafc2673d8f8e4e8ad2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2792564e0cccc2b50cdd8d8edcbc6f37ca11a86f16ba3b43b43ef07ac147411a61c366722c34c018da176dd46378d2aaefe92ca52615cca8f96341ef79617f17
|
7
|
+
data.tar.gz: 85cb5a675b359416a9d72c3508bababa0dd72b3427fb9b57b21c6253bf7f794453c62a461df1e55fc43384e3a6a330c916d4fe5d49ea51e7045cb32e8059e5ee
|
data/lib/doorkeepr/rails.rb
CHANGED
@@ -11,6 +11,24 @@ module Doorkeepr
|
|
11
11
|
def config
|
12
12
|
@config ||= Doorkeepr::Rails::Config.new
|
13
13
|
end
|
14
|
+
|
15
|
+
def entrance entrance
|
16
|
+
config.entrance = entrance
|
17
|
+
end
|
18
|
+
|
19
|
+
def customer customer
|
20
|
+
config.customer=customer
|
21
|
+
end
|
22
|
+
|
23
|
+
def application application
|
24
|
+
config.application=application
|
25
|
+
end
|
26
|
+
|
27
|
+
def function function
|
28
|
+
config.function=function
|
29
|
+
end
|
30
|
+
|
31
|
+
alias_method :service, :function
|
14
32
|
end
|
15
33
|
module Rails
|
16
34
|
@mount_at = :doorkeepr
|
@@ -20,13 +38,13 @@ module Doorkeepr
|
|
20
38
|
@default_service ||= ::Nerve::Easy::Service.new(::Doorkeepr.config.to_h)
|
21
39
|
end
|
22
40
|
def announce service
|
23
|
-
|
41
|
+
manager.announce service
|
24
42
|
end
|
25
43
|
def config
|
26
|
-
|
44
|
+
manager.config
|
27
45
|
end
|
28
46
|
def publish
|
29
|
-
|
47
|
+
manager.publish
|
30
48
|
end
|
31
49
|
end
|
32
50
|
end
|
@@ -3,7 +3,7 @@ module Doorkeepr
|
|
3
3
|
class Entrance
|
4
4
|
def initialize
|
5
5
|
@entrance_config = Doorkeepr.config.to_h
|
6
|
-
@entrance_config[:interval] =
|
6
|
+
@entrance_config[:interval] = 5
|
7
7
|
@entrance_config[:timeout] = 3
|
8
8
|
@entrance_config[:function] = "entrance"
|
9
9
|
@entrance_config[:zk_path] = Doorkeepr.config.to_h[:entrance]
|
@@ -5,19 +5,16 @@ module Doorkeepr
|
|
5
5
|
module Rails
|
6
6
|
module Nerve
|
7
7
|
class << self
|
8
|
+
attr_accessor :nerve, :thread
|
8
9
|
def publish
|
9
10
|
::Rails.logger.debug "start announce service"
|
10
|
-
if Doorkeepr.config.to_h[:entrance]
|
11
|
-
|
12
|
-
end
|
13
|
-
@nerve = ::Nerve::Nerve.new Rails.config.to_nerve
|
14
|
-
@t = Thread.new do
|
15
|
-
@nerve.run
|
16
|
-
end
|
11
|
+
Rails.announce Entrance.new.service if Doorkeepr.config.to_h[:entrance]
|
12
|
+
nerve = ::Nerve::Nerve.new Rails.config.to_nerve
|
17
13
|
at_exit do
|
18
|
-
|
19
|
-
|
14
|
+
thread.kill
|
15
|
+
::Rails.logger.debug "Nerve removed"
|
20
16
|
end
|
17
|
+
thread = Thread.new{ nerve.run }
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doorkeepr-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathias Kaufmann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|