What is the best way to store project specific config info in ruby Rake tasks? -


There are rack assignments to obtain a production database from my remote server, etc. It is always the same task but I have code here per project change in the server information: In the previous work, I am getting a @local_db_dir_path = zero error

I do not think the use of shell environment variables That's because I do not want to use every time I use rake or open a new shell.

Stick the settings in a YAML file, and read it like this:

  requires 'yaml' config = YAML. Load  "<"> "" "" "" "" "" " And you can just read one big configuration hash:  
  $ config = YAML.load ("config.yaml")   

Note that I am using global here, not an example variable, so there is no chance of surprise from the variable scope.

config.yaml will then look like this:

  --- remote_host: some.host.name ssh_username: myusername other_setting: foo Whatever: bar   

I have a config.yaml. Try to keep the sample which is checked with the main body of that code, which is for example but copy anything I can copy the non-edited config.yaml Some people have their config.yaml I want to check myself at a live branch on the server, so this is the version, but I have never bothered him.

Comments