cayuga 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cayuga/object/constants.rb +6 -8
- data/lib/cayuga/object/factory.rb +8 -6
- data/lib/cayuga/object/factory_helper_shared.rb +24 -0
- data/lib/cayuga/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28806f913a01ae797e4751924b71bbdead9a425575051711c430c8327e75b1cb
|
4
|
+
data.tar.gz: ece3a5e21f131ee8f490bb3ac42b22afdd94741a5574a7b42371314e34a305bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd7623054ed934575f1455a6430c793c6ee82eea54890730a87a38316cea06b1a0f0549e7fc8cc96a4cb57900bea157eb8bca048cc6849767004c460ddc9f4e5
|
7
|
+
data.tar.gz: '01792132b0cbf8eb613a35c8d0b5d0d05dac6ab10453c39e615b2396a30ca01cc37cf02b5fdd426939efa74fe9620bf2b673e8382cf57c19771a832aa20367c5'
|
@@ -2,11 +2,14 @@
|
|
2
2
|
# Copyright (c) 2018 Patrick Thomas. All rights reserved.
|
3
3
|
#
|
4
4
|
require 'cayuga'
|
5
|
+
require 'cayuga/object/factory_helper_shared'
|
5
6
|
|
6
7
|
module Cayuga
|
7
8
|
module Object
|
8
9
|
# noinspection RubyModuleAsSuperclassInspection
|
9
10
|
class Constants < Singleton
|
11
|
+
include FactoryHelperShared
|
12
|
+
|
10
13
|
def constant(constant)
|
11
14
|
constants[constant.symbolize]
|
12
15
|
end
|
@@ -21,10 +24,6 @@ module Cayuga
|
|
21
24
|
files[constant.symbolize]
|
22
25
|
end
|
23
26
|
|
24
|
-
def repository(constant)
|
25
|
-
repositories[constant.symbolize]
|
26
|
-
end
|
27
|
-
|
28
27
|
private_class_method :new
|
29
28
|
|
30
29
|
private
|
@@ -33,10 +32,9 @@ module Cayuga
|
|
33
32
|
|
34
33
|
def initialize(factory, configuration)
|
35
34
|
super
|
36
|
-
@constants =
|
37
|
-
@directories =
|
38
|
-
@files =
|
39
|
-
@repositories = configuration[:repositories]
|
35
|
+
@constants = primary_configuration(:constants)
|
36
|
+
@directories = primary_configuration(:directories)
|
37
|
+
@files = primary_configuration(:files)
|
40
38
|
end
|
41
39
|
|
42
40
|
end
|
@@ -5,14 +5,16 @@ require 'json'
|
|
5
5
|
require 'ice_nine'
|
6
6
|
require 'ice_nine/core_ext/object'
|
7
7
|
require 'cayuga'
|
8
|
-
|
8
|
+
require 'cayuga/object/factory_helper_shared'
|
9
|
+
require 'cayuga/object/factory_helper'
|
9
10
|
|
10
11
|
module Cayuga
|
11
12
|
module Object
|
12
13
|
# Cayuga Object Factory
|
13
14
|
class Factory
|
14
|
-
include Cayuga::Object::FactoryHelper
|
15
15
|
include Tools::Loggable
|
16
|
+
include FactoryHelperShared
|
17
|
+
include FactoryHelper
|
16
18
|
|
17
19
|
attr_reader :configuration_name, :logs_directory
|
18
20
|
|
@@ -82,16 +84,16 @@ module Cayuga
|
|
82
84
|
|
83
85
|
private
|
84
86
|
|
85
|
-
attr_reader :configuration, :types, :instances
|
87
|
+
attr_reader :configuration, :types, :instances, :directories
|
86
88
|
|
87
89
|
def initialize(config)
|
88
90
|
@configuration =
|
89
91
|
JSON.parse(File.read(config), symbolize_names: true).deep_freeze
|
90
|
-
@configuration_name =
|
91
|
-
@logs_directory = configuration[:directories][:logs]
|
92
|
+
@configuration_name = primary_configuration(:configuration_name, type: String)
|
92
93
|
setup_types
|
93
94
|
@instances = {}
|
94
|
-
@directories =
|
95
|
+
@directories = primary_configuration(:directories).freeze
|
96
|
+
@logs_directory = directories[:logs]
|
95
97
|
end
|
96
98
|
|
97
99
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2018 Patrick Thomas. All rights reserved.
|
3
|
+
#
|
4
|
+
require 'ice_nine'
|
5
|
+
require 'ice_nine/core_ext/object'
|
6
|
+
|
7
|
+
module Cayuga
|
8
|
+
module Object
|
9
|
+
# Cayuga Object Factory Helper Shared
|
10
|
+
module FactoryHelperShared
|
11
|
+
private
|
12
|
+
|
13
|
+
def primary_configuration(key, type: Hash)
|
14
|
+
if configuration.key? key
|
15
|
+
configuration[key]
|
16
|
+
else
|
17
|
+
log.warn('missing key in configuration', key: key, type: type.name )
|
18
|
+
type.new
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/cayuga/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cayuga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- patrick
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: facets
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/cayuga/object/constants.rb
|
130
130
|
- lib/cayuga/object/factory.rb
|
131
131
|
- lib/cayuga/object/factory_helper.rb
|
132
|
+
- lib/cayuga/object/factory_helper_shared.rb
|
132
133
|
- lib/cayuga/object/logger.rb
|
133
134
|
- lib/cayuga/object/named_object.rb
|
134
135
|
- lib/cayuga/object/object.rb
|