On 8/10/06, Phillip Toland <[EMAIL PROTECTED]> wrote:
> On 8/10/06, Scott Laird <[EMAIL PROTECTED]> wrote:
> > I'd like to get native mysql support into the installer. I'd really
> > like to get it in *today*. So I'd like some help. It's not all that
> > complex--here's the important part of the postgres driver:
> [snip]
>
> How's this:
>
> class Mysql < RailsInstaller::Database
> def self.db_host(installer)
> installer.config['db_host'] || 'localhost'
> end
>
> def self.db_user(installer)
> installer.config['db_user'] || installer.app_name
> end
>
> def self.db_name(installer)
> installer.config['db_name'] || installer.app_name
> end
>
> def self.yml(installer)
> %Q{
> login: &login
> adapter: mysql
> host: #{db_host installer}
> username: #{db_user installer}
> password: #{installer.config['db_password']}
> database: #{db_name installer}
>
> development:
> <<: *login
>
> production:
> <<: *login
>
> test:
> database: #{db_name installer}-test
> <<: *login
> }
> end
>
> # Create a MySQL database.
> def self.create_database(installer)
> installer.message "Creating MySQL database"
> system("mysql -u #{db_user installer}
> -p#{installer.config['db_password']} -e 'create database #{db_name
> installer}'")
> system("mysql -u #{db_user installer}
> -p#{installer.config['db_password']} -e 'create database #{db_name
> installer}-test'")
> end
> end
Thanks. I'll give this a spin in rails-app-installer 0.1.2 / Typo 4.0.2.
Scott
_______________________________________________
Typo-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/typo-list