cayuga 0.0.3 → 0.0.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.
data/cayuga.gemspec CHANGED
@@ -36,4 +36,5 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "file-tail", "~>1.2"
37
37
  spec.add_development_dependency "facets", "~>3.1"
38
38
  spec.add_development_dependency "memoist", "~>0.16"
39
+ spec.add_development_dependency "ice_nine", "~>0.11"
39
40
  end
data/cayuga.iml CHANGED
@@ -18,6 +18,7 @@
18
18
  <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.4.4-p296) [gem]" level="application" />
19
19
  <orderEntry type="library" scope="PROVIDED" name="facets (v3.1.0, ruby-2.4.4-p296) [gem]" level="application" />
20
20
  <orderEntry type="library" scope="PROVIDED" name="file-tail (v1.2.0, ruby-2.4.4-p296) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="ice_nine (v0.11.2, ruby-2.4.4-p296) [gem]" level="application" />
21
22
  <orderEntry type="library" scope="PROVIDED" name="memoist (v0.16.0, ruby-2.4.4-p296) [gem]" level="application" />
22
23
  <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.4.4-p296) [gem]" level="application" />
23
24
  <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, ruby-2.4.4-p296) [gem]" level="application" />
@@ -6,20 +6,36 @@ require 'cayuga'
6
6
  module Cayuga
7
7
  module Object
8
8
  class Constants < Singleton
9
+ def constant(constant)
10
+ constants[constant.symbolize]
11
+ end
12
+
13
+ alias [] :constant
9
14
 
10
15
  def directory(constant)
11
16
  directories[constant.symbolize]
12
17
  end
13
18
 
19
+ def file(constant)
20
+ files[constant.symbolize]
21
+ end
22
+
23
+ def repository(constant)
24
+ repositories[constant.symbolize]
25
+ end
26
+
14
27
  private_class_method :new
15
28
 
16
29
  private
17
30
 
18
- attr_reader :factory, :directories
31
+ attr_reader :factory, :constants, :directories, :files, :repositories
19
32
 
20
33
  def initialize(factory, configuration)
21
34
  super
35
+ @constants = configuration[:constants]
22
36
  @directories = configuration[:directories]
37
+ @files = configuration[:files]
38
+ @repositories = configuration[:repositories]
23
39
  end
24
40
 
25
41
  end
@@ -2,6 +2,8 @@
2
2
  # Copyright (c) 2018 Patrick Thomas. All rights reserved.
3
3
  #
4
4
  require 'json'
5
+ require 'ice_nine'
6
+ require 'ice_nine/core_ext/object'
5
7
  require 'cayuga'
6
8
 
7
9
  module Cayuga
@@ -83,13 +85,12 @@ module Cayuga
83
85
  attr_reader :configuration, :types, :instances
84
86
 
85
87
  def initialize(config)
86
- @configuration = JSON.parse(File.read(config), symbolize_names: true)
88
+ @configuration = JSON.parse(File.read(config), symbolize_names: true).deep_freeze
87
89
  @configuration_name = configuration[:configuration_name]
88
90
  @logs_directory = configuration[:directories][:logs]
89
91
  @types = {}
90
- # register_classes(FACTORIES, :factory)
91
- register_classes(configuration[:singletons], :singleton)
92
- # register_classes(INDEXED_CLASSES, :indexed)
92
+ register_classes(configuration[:object_classes],:object)
93
+ register_classes(configuration[:singleton_classes], :singleton)
93
94
  register_classes(
94
95
  configuration[:named_object_classes], :named
95
96
  )
@@ -119,7 +120,7 @@ module Cayuga
119
120
  # unless klass == LoggerFactory
120
121
  # log.info("factory #{klass} created ")
121
122
  # end
122
- when :singleton
123
+ when :object, :singleton
123
124
  object = klass.create(self, configuration)
124
125
  # log.info("singleton #{klass} created ")
125
126
  when :named
@@ -39,7 +39,7 @@ module Cayuga
39
39
  def initialize(factory, configuration, name)
40
40
  super(factory, configuration)
41
41
  @name = name
42
- # Todo: alternative names
42
+ # TO DO: alternative names
43
43
  end
44
44
 
45
45
  def self.verify_name_validity(factory, name, alternate)
@@ -14,6 +14,10 @@ module Cayuga
14
14
 
15
15
  attr_reader :configuration_name
16
16
 
17
+ def self.create(factory, configuration)
18
+ new(factory, configuration)
19
+ end
20
+
17
21
  private_class_method :new
18
22
 
19
23
  private
@@ -9,6 +9,7 @@ module Cayuga
9
9
  raise "#{self.stringify} already registered" if factory.registered?(self)
10
10
  factory.register(new(factory, configuration), self)
11
11
  end
12
+
12
13
  end
13
14
  end
14
15
  end
@@ -1,3 +1,3 @@
1
1
  module Cayuga
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - patrick
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-02 00:00:00.000000000 Z
11
+ date: 2018-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.16'
111
+ - !ruby/object:Gem::Dependency
112
+ name: ice_nine
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.11'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.11'
111
125
  description:
112
126
  email:
113
127
  - peateas@gmail.com