Browse Source

Revert "Replace the `platform :ruby18` hack with `install_if`"

This reverts commit 06827f99a0506532db0e01d91134fa8fa2d86c9d.
Akinori MUSHA 9 years ago
parent
commit
76be124012
1 changed files with 14 additions and 6 deletions
  1. 14 6
      Gemfile

+ 14 - 6
Gemfile

@@ -131,14 +131,22 @@ gem 'tzinfo', '>= 1.2.0'	# required by rails; 1.2.0 has support for *BSD and Sol
 # Windows does not have zoneinfo files, so bundle the tzinfo-data gem.
 gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]
 
-def heroku?
-  ENV['ON_HEROKU'] ||
-    ENV['HEROKU_POSTGRESQL_ROSE_URL'] ||
-    ENV['HEROKU_POSTGRESQL_GOLD_URL'] ||
-    File.read(File.join(File.dirname(__FILE__), 'Procfile')) =~ /intended for Heroku/
+# Introduces a scope for Heroku specific gems.
+def on_heroku
+  if ENV['ON_HEROKU'] ||
+     ENV['HEROKU_POSTGRESQL_ROSE_URL'] ||
+     ENV['HEROKU_POSTGRESQL_GOLD_URL'] ||
+     File.read(File.join(File.dirname(__FILE__), 'Procfile')) =~ /intended for Heroku/
+    yield
+  else
+    # When not on Heroku, we still want our Gemfile.lock to include
+    # Heroku specific gems, so we scope them to an unsupported
+    # platform.
+    platform :ruby_18, &proc
+  end
 end
 
-install_if -> { heroku? } do
+on_heroku do
   gem 'pg'
   gem 'unicorn'
   gem 'rails_12factor', group: :production