Skip to content
Browse files

For users without both postgres and mysql installed, be a little more…

… intelligent about the related gems
  • Loading branch information...
1 parent fb766b4 commit ce80cf45d71c52158867abde58ff597309ea62d6 @augustf augustf committed Feb 14, 2014
Showing with 20 additions and 13 deletions.
  1. +20 −13 Gemfile
View
33 Gemfile
@@ -40,19 +40,6 @@ gem 'bootstrap-datepicker-rails'
gem 'jquery-timepicker-rails'
gem 'twitter-bootstrap-rails-confirm'
-# In production we prefer MySQL over sqlite3. If you are only
-# interested in development and don't want to bother with production,
-# run `bundle install --without production` to ignore MySQL.
-gem "sqlite3", :group => [:development, :test]
-
-require "#{Dir.getwd}/lib/command_check.rb"
-if system_has_mysql?
- gem "mysql2", :require => false, :group => :production
-end
-if system_has_postgres?
- gem "pg", :require => false, :group => :production
-end
-
#RMagick is used for image resizing and processing
gem "rmagick", ">= 2.12.2", :require => 'RMagick', :platforms => :ruby
@@ -77,6 +64,26 @@ gem 'strong_parameters'
gem 'kaminari', '0.14.1' # Pagination
+require "#{Dir.getwd}/lib/command_check.rb"
+if system_has_mysql?
+ mysql_platforms = Bundler::Dependency::PLATFORM_MAP.keys
+else
+ mysql_platforms = []
+end
+if system_has_postgres?
+ postgres_platforms = Bundler::Dependency::PLATFORM_MAP.keys
+else
+ postgres_platforms = []
+end
+
+# In production we prefer MySQL over sqlite3. If you are only
+# interested in development and don't want to bother with production,
+# run `bundle install --without production` to ignore MySQL.
+gem "sqlite3", :group => [:development, :test]
+
+gem "mysql2", :require => false, :group => :production, :platforms => mysql_platforms
+gem "pg", :require => false, :group => :production, :platforms => postgres_platforms
+
# Enable the newsfeed for 1.9+ users.
pa_platforms = [:ruby_19, :ruby_20, :ruby_21]
pa_platforms &= Bundler::Dependency::PLATFORM_MAP.keys

0 comments on commit ce80cf4

Please sign in to comment.
Something went wrong with that request. Please try again.