Class: RicConf
- Inherits:
-
Object
- Object
- RicConf
- Defined in:
- lib/classes/ricconf.rb
Instance Attribute Summary collapse
-
#home ⇒ Object
Returns the value of attribute home.
-
#nreloads ⇒ Object
Returns the value of attribute nreloads.
-
#path ⇒ Object
Returns the value of attribute path.
-
#svn ⇒ Object
Returns the value of attribute svn.
-
#user ⇒ Object
Returns the value of attribute user.
-
#ver ⇒ Object
Returns the value of attribute ver.
Instance Method Summary collapse
-
#cool_eval(x) ⇒ Object
x is a string.
- #get_tags ⇒ Object
-
#initialize ⇒ RicConf
constructor
A new instance of RicConf.
-
#SVNRIC ⇒ Object
after migration svn!.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ RicConf
Returns a new instance of RicConf.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/classes/ricconf.rb', line 35 def initialize() #puts "DEB RicConf::initialize(): Initializing a new #{self.class}" self.ver = $RICLIB_VERSION self.home = $HOME self.user = $USER || get_username # = 'riccardo' self.path = ENV['PATH'].split(':').uniq.sort # = 'riccardo' self.svn = ENV['SVNRIC'] self.nreloads ||= 0 self.nreloads += 1 # lo riassegna quindi vale sempre uno a ogni costruzione.. end |
Instance Attribute Details
#home ⇒ Object
Returns the value of attribute home.
32 33 34 |
# File 'lib/classes/ricconf.rb', line 32 def home @home end |
#nreloads ⇒ Object
Returns the value of attribute nreloads.
32 33 34 |
# File 'lib/classes/ricconf.rb', line 32 def nreloads @nreloads end |
#path ⇒ Object
Returns the value of attribute path.
32 33 34 |
# File 'lib/classes/ricconf.rb', line 32 def path @path end |
#svn ⇒ Object
Returns the value of attribute svn.
32 33 34 |
# File 'lib/classes/ricconf.rb', line 32 def svn @svn end |
#user ⇒ Object
Returns the value of attribute user.
32 33 34 |
# File 'lib/classes/ricconf.rb', line 32 def user @user end |
#ver ⇒ Object
Returns the value of attribute ver.
32 33 34 |
# File 'lib/classes/ricconf.rb', line 32 def ver @ver end |
Instance Method Details
#cool_eval(x) ⇒ Object
x is a string
56 57 58 59 60 |
# File 'lib/classes/ricconf.rb', line 56 def cool_eval(x) y = (eval(x.to_s)) rescue "CoolEvalEsception: '#{$!}'" deb "CoolEval('#{yellow x}' (#{x.class})) --> ''#{azure(y)}'' (class=#{y.class})" return y end |
#get_tags ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/classes/ricconf.rb', line 62 def () deb "$network_conf is a #{$network_conf.class}" deb "$host_conf is a #{$hostconf.class}" [ '$host_conf', '$network_conf', '2+3', 'RicConf' ].each{|var| # x = 'var.inspect()' # y = eval(x) # deb "Supercool: Evaluing('#{x}') for #{blue var} (#{var.class}) --> #{azure(y)} (class=#{y.class})" cool_eval(var) } # my_network_tags = $network_conf['tags'] rescue [] = { # :conf_network => my_network_tags.split(',') , :ENV_TAGS => ENV['HOST_TAGS'].split(','), :ENV_SRVS => ENV['HOST_SERVICES'].split(','), } [:conf_host] = $host_conf['tags'].split(',') rescue [] # fatal("Conf missing for this host: #{$!}") [:conf_network] = $network_conf['tags'] .split(',') rescue [] # fatal("Conf missing for this host: #{$!}") .each{|k,v| deb "#{k}: #{v}" } = .values.flatten.compact.map{|x| x.strip }.uniq.sort deb .inspect # obsolete tags: = & $obsolete_tags deb "#Obsolete tags: #{red(.map{|tag| "'#{tag}' from #{.map{|k,v| k if v.match(tag) }.compact }"}) }" return - $obsolete_tags end |
#SVNRIC ⇒ Object
after migration svn!
51 52 53 |
# File 'lib/classes/ricconf.rb', line 51 def SVNRIC File.(ENV['SVNRIC'] || "~/git/gic" ) end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/classes/ricconf.rb', line 46 def to_s "RicConf: #{yellow self.inspect}" end |