Well I am getting my svk setup here to do some development on a few projects and I decided to try to get some automation in the setup. Seeing as I am currently hacking on Typo, I wanted someway for me to checkout the code from svk, setup my configs, and then put some test data into the databases.
Well using bash and some nice SQL I got a single script that will grab my database.yml config and then insert all my test data into my databases.
#!/bin/bash # Script to setup my Typo development env. cp /Users/eric/Development/Projects/\ typo-local/config/database.yml \config/database.yml echo "Done with Configs" mysql -u root --password=root typo_testing \ </users/eric/Development/Projects/typo-local/db/ta-dump.sql echo "Done with Production Table" mysql -u root --password=root typo_testing_dev \ < /Users/eric/Development/Projects/typo-local/db/ta-dump.sql echo "Done with Development Table" mysql -u root --password=root typo_testing_tests \ < /Users/eric/Development/Projects/typo-local/db/ta-dump.sql echo "Done with Tests Table"
So now for some sample SQL :
DROP TABLE IF EXISTS `settings`; CREATE TABLE IF NOT EXISTS `settings` ( `id` int(11) NOT NULL auto_increment, `name` varchar(255) default NULL, `value` varchar(255) default NULL, PRIMARY KEY (`id`) ) TYPE=InnoDB;
So this SQL will drop the table settings and then insert the new one. This will make sure I have fresh data and works fine on all three databases (development, production, tests).
So now after I checkout and patch my next source for testing I just run
typo-setup.sh
And my databases and configs are ready to go, just fire up Webrick and go at it.
Later I will post on my new svk setup.
Eric