pushr-core 1.0.4 → 1.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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b863ca933317f600b397b26c3e1ba6075f0882cbf9790687f1556288e2819e65
|
4
|
+
data.tar.gz: b6d46fb71f809753fd66f0fa1639bb2f0afe1b04d021874aff4f9112e1304882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3358210249ae43ea51905979fcd0f3b10f560a67ca203dbd13b6f32124d3ebb91f9d3b5558f4997f849de1ab549a567f9a608b5f9a5a32ccd5e7b072a10a033
|
7
|
+
data.tar.gz: cecd4649f0078410f928c91608a40d5d8ba12484b49af38e74acf3764ae87e5014b5c5a8f7eda5219d2bd47dd9c673ce8c1faa79a15e74e5efe8ba09f93f5b79
|
data/lib/pushr/configuration.rb
CHANGED
@@ -69,13 +69,13 @@ module Pushr
|
|
69
69
|
def self.read_from_yaml_file
|
70
70
|
filename = Pushr::Core.configuration_file
|
71
71
|
configs = File.open(filename) { |fd| YAML.load(fd) }
|
72
|
-
configs.map { |hsh| instantiate(hsh) }
|
72
|
+
configs.map { |hsh| instantiate(hsh) }.compact
|
73
73
|
end
|
74
74
|
|
75
75
|
def self.read_from_redis
|
76
76
|
configurations = Pushr::Core.redis { |conn| conn.hgetall('pushr:configurations') }
|
77
77
|
configurations.each { |key, config| configurations[key] = instantiate_json(config, key) }
|
78
|
-
configurations.values
|
78
|
+
configurations.values.compact
|
79
79
|
end
|
80
80
|
|
81
81
|
def self.instantiate_json(config, id)
|
@@ -83,7 +83,12 @@ module Pushr
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def self.instantiate(hsh)
|
86
|
-
klass = hsh['type'].split('::').reduce(Object)
|
86
|
+
klass = hsh['type'].split('::').reduce(Object) do |a, e|
|
87
|
+
if Object.const_defined?(hsh['type'])
|
88
|
+
a.const_get e
|
89
|
+
end
|
90
|
+
end
|
91
|
+
return nil if klass == nil
|
87
92
|
klass.new(hsh)
|
88
93
|
end
|
89
94
|
end
|
data/lib/pushr/version.rb
CHANGED
@@ -12,6 +12,12 @@ describe Pushr::Configuration do
|
|
12
12
|
it 'returns all configurations' do
|
13
13
|
expect(Pushr::Configuration.all).to eql([])
|
14
14
|
end
|
15
|
+
|
16
|
+
it 'should not load missing configuration constant' do
|
17
|
+
Pushr::ConfigurationDummy2.new(app: 'app_name', connections: 2, enabled: true).save
|
18
|
+
Pushr.send(:remove_const, :ConfigurationDummy2)
|
19
|
+
expect(Pushr::Configuration.all).to eql([])
|
20
|
+
end
|
15
21
|
end
|
16
22
|
|
17
23
|
describe 'create' do
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Pushr
|
2
|
+
class ConfigurationDummy2 < Pushr::Configuration
|
3
|
+
attr_accessor :test_attr
|
4
|
+
|
5
|
+
def name
|
6
|
+
:dummy
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_hash(_ = nil)
|
10
|
+
{ id: [@app, name].join(':'), type: self.class.to_s, app: app, enabled: enabled, connections: connections, test_attr: test_attr }
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pushr-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Pesman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis-namespace
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,6 +235,7 @@ files:
|
|
235
235
|
- spec/spec_helper.rb
|
236
236
|
- spec/support/logger.rb
|
237
237
|
- spec/support/pushr_configuration_dummy.rb
|
238
|
+
- spec/support/pushr_configuration_dummy2.rb
|
238
239
|
- spec/support/pushr_connection_dummy.rb
|
239
240
|
- spec/support/pushr_dummy.rb
|
240
241
|
- spec/support/pushr_feedback_dummy.rb
|
@@ -260,8 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
260
261
|
- !ruby/object:Gem::Version
|
261
262
|
version: '0'
|
262
263
|
requirements: []
|
263
|
-
|
264
|
-
rubygems_version: 2.7.6
|
264
|
+
rubygems_version: 3.0.6
|
265
265
|
signing_key:
|
266
266
|
specification_version: 4
|
267
267
|
summary: Core of the pushr daemon.
|
@@ -280,6 +280,7 @@ test_files:
|
|
280
280
|
- spec/spec_helper.rb
|
281
281
|
- spec/support/logger.rb
|
282
282
|
- spec/support/pushr_configuration_dummy.rb
|
283
|
+
- spec/support/pushr_configuration_dummy2.rb
|
283
284
|
- spec/support/pushr_connection_dummy.rb
|
284
285
|
- spec/support/pushr_dummy.rb
|
285
286
|
- spec/support/pushr_feedback_dummy.rb
|