I'm using sequel in my test framework (taza) for database validation. The tests are run through rake commands.
I would like to be able to do two things from my rake command: 1. set the server based on the environment 2. set the database from the command line. We use mssql, and our os is Windows XP or 7. So for #1 Taza has a way to choose which site url to test based on the command TAZA_ENV=x that's passed in as part of the rake command, which is rake spec:isolation:site TAZA_ENV=qa. This will use the url configured a config.yml file. I would like to do the same with the database. I found this thread<https://groups.google.com/forum/#!topic/sequel-talk/MGhcXoeGzfM> and have tried both options, but I think i've put the wrong things in the database.yml file so i'm getting errors. I'm not a rails developer so i don't have any experience with configuring the database.yml. Using the Class Method, I'm getting two errors, one is a SQL Server does not exist or access denied and another is a can't parse the yml file at line x column 0. The class I created looks like this: module DB class << DB def env ENV['TAZA_ENV'] || 'qa' end def root "File.dirname(__FILE__)}/../config/" end def config config = YAML.load_file(File.join(root,'database.yml'))[env] end def connect puts config Sequel.ado(config) end end end my database.yml looks like this: qa: adaptor: sqlserver mode: ado server: <servername> database: <db> username: <user> password: <password> The other option in that thread was to directly call the string, with that option i get an invalid argument error. My code looks like this TAZA_ROOT = " File.dirname(__FILE__)}/../config/" $DB = DB.ado(YAML.load_file(File.read(File.join(TAZA_ROOT,'database.yml')))['TAZA_ENV']) Number #2 I'm not really sure where to start. Thanks. -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/sequel-talk/-/p0wrTFxpnYAJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
