Class: Fairy::Conf::DefaultConf
Overview
def method_missing(method, *args, &b) del = “#prefix_#methodmethod.id2namemethod.id2name.upcase” if respond_to?(del) __send__(del, *args, &b) else super end
end
end
BJobConf = JobConf
NJobConf = JobConf
Constant Summary
Constants inherited
from Fairy::Conf
PROPS
Instance Method Summary
collapse
Methods inherited from Fairy::Conf
#HOME, #base_conf=, configure_common_conf, def_prop, def_prop_relative_path, #props, #set_values
Constructor Details
Returns a new instance of DefaultConf.
203
204
205
206
207
208
|
# File 'lib/fairy/share/conf.rb', line 203
def initialize
super
@default_host = `hostname`.chomp
@hosts = {}
end
|
Instance Method Details
#[](host) ⇒ Object
210
211
212
213
214
215
|
# File 'lib/fairy/share/conf.rb', line 210
def [](host)
unless @hosts[host]
@hosts[host] = Conf.new
end
@hosts[host]
end
|
#load_all_conf ⇒ Object
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# File 'lib/fairy/share/conf.rb', line 224
def load_all_conf
loaded = false
for path in CONF_PATH
if path
if File.exist?(path)
load_conf path
loaded = true
end
end
end
end
|
#load_conf(conf) ⇒ Object
239
240
241
242
243
244
245
246
247
248
249
250
251
|
# File 'lib/fairy/share/conf.rb', line 239
def load_conf(conf)
begin
load conf
rescue LoadError
puts "設定ファイル #{conf} をロードできませんでした."
exit 1
rescue
puts "設定ファイル #{@conf} をロード中に例外が発生しました."
p $!
p $@
exit 2
end
end
|
#value(prop) ⇒ Object
217
218
219
220
221
222
|
# File 'lib/fairy/share/conf.rb', line 217
def value(prop)
conf = @hosts[@default_host]
v = conf && conf.value(prop)
return v if v
@values[prop]
end
|