Hi,

i have a program where several things are hard coded
for production i need a config file now, must be editable
and readable by hand, so i decided to try with YAML

program with hard coded stuff =


require "highline/import"

CVSEXE="//foobar/c$/tools/cvsnt/cvs.exe"

cvsrepos=%w[test test1 foo bar foobar]
cvsuser = ask("Enter CVS User:       ") {|q| 
q.default = "#{ENV["USERNAME"]}"
q.echo = true}
cvspass = ask("Enter your password:  ") { |q| q.echo = '*' }

cvsrepos.each {|x|
puts "Login CVS Repository >> #{x} ..." 
IO.popen("#{CVSEXE} -d
:pserver:#{cvsuser}:#{cvspass}@cvsprod:d:/cvsrepos/#{x} login")
}
puts "Login successful !!"


i tried with YAML, first step =

require 'yaml' 
require "highline/import"

CVSEXE="//foobar/c$/tools/cvsnt/cvs.exe"

cvsrepos=YAML.load_file( "config.yaml" )

cvsuser = ask("Enter CVS User:       ") {|q| 
q.default = "#{ENV["USERNAME"]}"
q.echo = true}
cvspass = ask("Enter your password:  ") { |q| q.echo = '*' }

cvsrepos.each {|x|
puts "Login CVS Repository >> #{x} ..." 
IO.popen("#{CVSEXE} -d
:pserver:#{cvsuser}:#{cvspass}@cvsprod:d:/cvsrepos/#{x} login")
}
puts "Login successful !!"


config.yaml looks like =

---
- test
- test1
- foo
- bar
- foobar

works fine, but now i want to get the CVSEXE path also into that
yamlfile, i tried

require 'yaml' 
require "highline/import"

YAML.load_file( "config.yaml" )

cvsuser = ask("Enter CVS User:       ") {|q| 
q.default = "#{ENV["USERNAME"]}"
q.echo = true}
cvspass = ask("Enter your password:  ") { |q| q.echo = '*' }

cvsrepos.each {|x|
puts "Login CVS Repository >> #{x} ..." 
IO.popen("#{CVSEXE} -d
:pserver:#{cvsuser}:#{cvspass}@cvsprod:d:/cvsrepos/#{x} login")
}
puts "Login successful !!"


but that didn't work, my config.yaml looks like =

---
CVSEXE:"//foobar/c$/tools/cvsnt/cvs.exe"
---
cvsrepos:
- test
- test1
- foo
- bar
- foobar


What't the correct YAML Syntax and how do i access the different
section from my script that loads the yaml file ?


Regards, Gilbert