Advices on Rake tasks organization


I am using some Rake tasks for various actions (from backup to project
management) using this layout :
|-- Rakefile
|-- assets
|-- config
| |-- YAML files
|-- lib
| |-- parametres.rb
`-- tasks
|-- .rake files (for each namespace)

The main Rakefile includes lib/ files and tasks/*.tasks files, define
task-related constants (ASSETS_PATH, formatted DATE…) then use the
(I’m french :-)) class to parse the YAML files :

class Parametres
require “yaml”
attr_accessor :parametres

def initialize
configsdir = defined?(RAKE_ROOT) ? RAKE_ROOT : ENV[‘PWD’]

 @parametres = {}
 Dir["#{configsdir}/config/*.yml"].each { |file|
   filename =  File.basename(file, '.yml')
   unless filename.match(/\.server$/)
     @parametres[ filename.to_sym ] = open(file) { |f| YAML.load(f)}


I would like some feedback on this organization, as I didn’t find much
information on this subject (except for rails-related tasks).

At the moment I’m using a global variable to store an instance of
Parametres :
$config =

This seems really ugly, but I don’t know what would be better. Maybe a
should be used for Parametres ?

My second question is more ruby related.
In my Parametres class I’m building an instance variable @parametres
with a hash
filled with the YAML config files.
So, for an ftp.yml file, I can use $config[:ftp][:login] for example.
I could i use class attributes instead ? Like this :
config =
config.paths[:backup_dir] #maybe even config.paths.backup_dir ?

Jean-Philippe M.