Permalink
Browse files

Specify mysql2 version for rails 3.1

- Fix detect regex to support versions as well as requires.
  • Loading branch information...
1 parent 80c1925 commit ef4e5179509df098ed9481cfd4df78b689d2ee8d @jaswope jaswope committed Apr 27, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 recipes/activerecord.rb
@@ -6,9 +6,10 @@
# SQLite3 gem requires special treatment.
gem_string = case gem_for_database
when "sqlite3"; "gem 'sqlite3-ruby', :require => 'sqlite3'"
+ when "mysql2"; "gem 'mysql2', '~> 0.2.6'"
else "gem '#{gem_for_database}'"
end
- gsub_file 'Gemfile', Regexp.new("gem '#{old_gem}'(, :require => '[^']*')?"), gem_string
+ gsub_file 'Gemfile', Regexp.new("gem '#{old_gem}'(, '[^']*')?(, :require => '[^']*')?"), gem_string
template "config/databases/#{@options[:database]}.yml", "config/database.yml.new"
run 'mv config/database.yml.new config/database.yml'

0 comments on commit ef4e517

Please sign in to comment.