chrismccord / labrador

A loyal data retriever for your Rails development databases.
http://chrismccord.github.com/labrador/
253 stars 15 forks source link

Fails to load when ERB is used by database.yml #4

Closed audionerd closed 12 years ago

audionerd commented 12 years ago

I encounter a "couldn't parse YAML" error when any ERB appears in database.yml.

Labrador doesn't use ERB before parsing the YAML file (see https://github.com/chrismccord/labrador/blob/master/lib/labrador/adapter.rb#L75)

A fix might be:

config = YAML.load(ERB.new(File.read(path)).result)

Some ERB would of course break – references to application code that Labrador doesn't know about for example. But often ERB is used for simple things, conditional logic. Trying to run database.yml through ERB before parsing might be helpful.

chrismccord commented 12 years ago

Taking an optimistic pass through ERB might be the best option. I'll do some digging and see if there are any other options. Thanks for the heads up.

chrismccord commented 12 years ago

This has been addressed on master. Let me know if it gets you up and running. To update your local copy:

$ cd ~/.labrador
$ git pull origin master
$ mkdir -p tmp/
$ touch tmp/restart.txt