gluez 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gluez/context.rb +12 -4
- metadata +2 -2
data/lib/gluez/context.rb
CHANGED
@@ -10,10 +10,11 @@ module Gluez
|
|
10
10
|
# A reference to the outer context
|
11
11
|
attr_reader :parent, :included_user_contexts
|
12
12
|
|
13
|
-
def initialize(parent=nil, name=nil, user=nil, &block)
|
13
|
+
def initialize(parent=nil, name=nil, user=nil, type=nil, &block)
|
14
14
|
@parent = parent
|
15
15
|
@name = name
|
16
16
|
@user = user
|
17
|
+
@type = type
|
17
18
|
|
18
19
|
@resources = []
|
19
20
|
@properties = {}
|
@@ -65,7 +66,14 @@ module Gluez
|
|
65
66
|
end
|
66
67
|
|
67
68
|
def locate(resource)
|
68
|
-
|
69
|
+
case @type
|
70
|
+
when :recipe
|
71
|
+
File.dirname($0) + "/recipes/#{@name}/files/#{resource}"
|
72
|
+
when :user
|
73
|
+
File.dirname($0) + "/users/files/#{resource}"
|
74
|
+
else
|
75
|
+
File.dirname($0) + "/files/#{resource}"
|
76
|
+
end
|
69
77
|
end
|
70
78
|
|
71
79
|
def read(resource)
|
@@ -84,7 +92,7 @@ module Gluez
|
|
84
92
|
|
85
93
|
def include_library_recipe(library_dir, name, &block)
|
86
94
|
raise "include_recipe is only allowed in user context" if self == self.root
|
87
|
-
Gluez::Context.new(self, name, nil) do |c|
|
95
|
+
Gluez::Context.new(self, name, nil, :recipe) do |c|
|
88
96
|
c.instance_eval(&block) if block
|
89
97
|
load "#{library_dir}/recipes/#{name}/#{name}.rb"
|
90
98
|
end
|
@@ -101,7 +109,7 @@ module Gluez
|
|
101
109
|
|
102
110
|
def include_user(name, failsafe=false, &block)
|
103
111
|
raise "include_user is only allowed in root context" unless self == self.root
|
104
|
-
Gluez::Context.new(self, name, name) do |c|
|
112
|
+
Gluez::Context.new(self, name, name, :user) do |c|
|
105
113
|
if block
|
106
114
|
c.instance_eval(&block)
|
107
115
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gluez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: a server configuration toolkit
|
15
15
|
email: jan.zimmek@web.de
|