project_store 0.2.1 → 0.3.0
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/project_store/base.rb +17 -1
- data/lib/project_store/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 678f752d585ba8f36ffa9a89d7e4cd5366241391
|
4
|
+
data.tar.gz: 198001ff303b4ac6fbd3285c638f496bd50b0864
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c0e173cac8ec51e9e1d6c86d88059ba981073f6318dd66c98d4ddf6ee68ecb5afe3e79e844bf8b55eac6f060f09a5946773f194f1427e687000c30b45d9e3d3
|
7
|
+
data.tar.gz: b1f9c98313db056ac2a5e14a547cf042b1bc6ed79cdbb67d13ac60ecfd77ee7ca9302686dd0a86cb2b44319b4bb174323840593aef59416931823a05b801b133
|
data/lib/project_store/base.rb
CHANGED
@@ -6,7 +6,7 @@ module ProjectStore
|
|
6
6
|
|
7
7
|
include ProjectStore::Editing
|
8
8
|
|
9
|
-
attr_accessor :continue_on_error
|
9
|
+
attr_accessor :continue_on_error, :decorators
|
10
10
|
attr_reader :path, :project_entities, :entity_types, :stores, :logger
|
11
11
|
|
12
12
|
def initialize(path)
|
@@ -17,6 +17,7 @@ module ProjectStore
|
|
17
17
|
@project_entities = {}
|
18
18
|
@stores = {}
|
19
19
|
@entity_types = {}
|
20
|
+
@decorators = {}
|
20
21
|
end
|
21
22
|
|
22
23
|
def load_entities
|
@@ -62,6 +63,8 @@ module ProjectStore
|
|
62
63
|
entity.basic_checks
|
63
64
|
logger.info "Found '#{entity.name}' of type '#{entity.type}'."
|
64
65
|
raise PSE, "Entity '#{entity.name}' already defined in file '#{project_entities[entity.name].backing_store.path}'" if project_entities[entity.name]
|
66
|
+
# Adds extra decorator
|
67
|
+
add_decorators entity
|
65
68
|
entity.backing_store = store
|
66
69
|
# Add to the store index store -> entity list
|
67
70
|
stores[store] << entity
|
@@ -73,6 +76,19 @@ module ProjectStore
|
|
73
76
|
end
|
74
77
|
|
75
78
|
|
79
|
+
def add_decorators(entity)
|
80
|
+
case decorators[entity.type]
|
81
|
+
when Array
|
82
|
+
decorators[entity.type]
|
83
|
+
when NilClass
|
84
|
+
[]
|
85
|
+
else
|
86
|
+
[decorators[entity.type]]
|
87
|
+
end .each do |decorator|
|
88
|
+
entity.extend decorator
|
89
|
+
logger.debug "Decorated entity '#{entity.name}' with '#{decorator}'"
|
90
|
+
end
|
91
|
+
end
|
76
92
|
|
77
93
|
end
|
78
94
|
|