teapot 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/teapot/configuration.rb +19 -4
- data/lib/teapot/controller/create.rb +1 -1
- data/lib/teapot/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: abdffc9e228ea78ccdd980fe913d57db8888db03
|
4
|
+
data.tar.gz: d2615667fdee353c3ed34e2521443d8111e3ffce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 889208dbe3ea2535f296f8a9e1916421c8b5ab10fe9667b7c6095e9550b2cbd592183b68d6b3a11a8b9c51fc5682f5654df5d0196380993a725738a6de2ce613
|
7
|
+
data.tar.gz: b9c7b4348b0adc44a3324d45bced141dd951fa60369ddb4eb776224b8bd8905ea55e494821fa9a61eeea4c579d72bd78bc9ffb4f1d3e83455d4bebe49297a9e5
|
data/lib/teapot/configuration.rb
CHANGED
@@ -80,6 +80,10 @@ module Teapot
|
|
80
80
|
def to_s
|
81
81
|
@table.to_s
|
82
82
|
end
|
83
|
+
|
84
|
+
def self.by_name(contents = [])
|
85
|
+
self.new(contents, &:name)
|
86
|
+
end
|
83
87
|
end
|
84
88
|
|
85
89
|
class Configuration < Definition
|
@@ -98,8 +102,8 @@ module Teapot
|
|
98
102
|
@options = DEFAULT_OPTIONS.dup
|
99
103
|
end
|
100
104
|
|
101
|
-
@packages = IdentitySet.
|
102
|
-
@imports = IdentitySet.
|
105
|
+
@packages = IdentitySet.by_name(packages)
|
106
|
+
@imports = IdentitySet.by_name
|
103
107
|
|
104
108
|
@visibility = :private
|
105
109
|
end
|
@@ -196,6 +200,9 @@ module Teapot
|
|
196
200
|
# Potentially no materialization is required:
|
197
201
|
return false if @imports.count == 0
|
198
202
|
|
203
|
+
# Avoid loops in the dependency chain:
|
204
|
+
imported = IdentitySet.new(&:name)
|
205
|
+
|
199
206
|
# Enumerate all imports and attempt to resolve the packages:
|
200
207
|
begin
|
201
208
|
updated = false
|
@@ -210,11 +217,19 @@ module Teapot
|
|
210
217
|
|
211
218
|
imports.each do |import|
|
212
219
|
named_configuration = @context.configurations[import.name]
|
213
|
-
|
220
|
+
|
221
|
+
# So we don't get into some crazy cycle:
|
222
|
+
next if imported.include? import
|
223
|
+
|
224
|
+
# It would be nice if we could detect cycles and issue an error to the user. However, sometimes the case above is not hit at the point where the cycle begins - it isn't clear at what point the user explicitly created a cycle, and what configuration actually ends up being imported a second time.
|
225
|
+
|
214
226
|
if named_configuration && named_configuration != self
|
227
|
+
# Mark this as resolved
|
228
|
+
imported << import
|
229
|
+
|
215
230
|
updated = self.merge(named_configuration, import.options) || updated
|
216
231
|
else
|
217
|
-
# It couldn't be resolved...
|
232
|
+
# It couldn't be resolved and hasn't already been resolved...
|
218
233
|
@imports << import
|
219
234
|
end
|
220
235
|
end
|
data/lib/teapot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: teapot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|