28 |
28 |
end
|
29 |
29 |
end
|
30 |
30 |
|
31 |
|
# Database gems
|
32 |
|
platforms :mri, :mingw do
|
33 |
|
group :postgresql do
|
34 |
|
gem "pg", ">= 0.11.0"
|
35 |
|
end
|
36 |
|
|
37 |
|
group :sqlite do
|
38 |
|
gem "sqlite3"
|
39 |
|
end
|
40 |
|
end
|
41 |
|
|
42 |
|
platforms :mri_18, :mingw_18 do
|
43 |
|
group :mysql do
|
44 |
|
gem "mysql", "~> 2.8.1"
|
45 |
|
end
|
46 |
|
end
|
47 |
|
|
48 |
|
platforms :mri_19, :mingw_19 do
|
49 |
|
group :mysql do
|
50 |
|
gem "mysql2", "~> 0.3.11"
|
51 |
|
end
|
52 |
|
end
|
53 |
|
|
54 |
31 |
platforms :jruby do
|
55 |
32 |
# jruby-openssl is bundled with JRuby 1.7.0
|
56 |
33 |
gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
|
57 |
34 |
gem "activerecord-jdbc-adapter", "1.2.5"
|
58 |
|
|
59 |
|
group :mysql do
|
60 |
|
gem "activerecord-jdbcmysql-adapter"
|
61 |
|
end
|
62 |
|
|
63 |
|
group :postgresql do
|
64 |
|
gem "activerecord-jdbcpostgresql-adapter"
|
65 |
|
end
|
|
35 |
end
|
66 |
36 |
|
67 |
|
group :sqlite do
|
68 |
|
gem "activerecord-jdbcsqlite3-adapter"
|
|
37 |
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
|
|
38 |
if File.exist?(database_file)
|
|
39 |
database_config = YAML.load_file(database_file)
|
|
40 |
adapters = database_config.values.map {|c| c['adapter']}.uniq
|
|
41 |
adapters.each do |adapter|
|
|
42 |
case adapter
|
|
43 |
when /mysql/
|
|
44 |
gem "mysql", "~> 2.8.1", :platforms => [:mri_18, :mingw_18]
|
|
45 |
gem "mysql2", "~> 0.3.11", :platforms => [:mri_19, :mingw_19]
|
|
46 |
gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
|
|
47 |
when /postgresql/
|
|
48 |
gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw]
|
|
49 |
gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
|
|
50 |
when /sqlite3/
|
|
51 |
gem "sqlite3", :platforms => [:mri, :mingw]
|
|
52 |
gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
|
|
53 |
when /sqlserver/
|
|
54 |
gem "tiny_tds", :platforms => [:mri, :mingw]
|
|
55 |
gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw]
|
|
56 |
else
|
|
57 |
abort("Unknown database adapter `#{adapter}` found in database.yml")
|
|
58 |
end
|
69 |
59 |
end
|
|
60 |
else
|
|
61 |
abort("Please, configure your database.yml first")
|
70 |
62 |
end
|
71 |
63 |
|
72 |
64 |
group :development do
|