# HG changeset patch # User Edho Arief # Date 1353254256 -25200 # Node ID 812711965af1eeeda413400d7f54147df61dfbf4 # Parent 601c608637e700d14d9254d30de0c5b6c8fdf310 Added support for disabling supported web server without changing Gemfile. diff -r 601c608637e7 -r 812711965af1 Gemfile --- a/Gemfile Sun Nov 18 00:48:32 2012 +0700 +++ b/Gemfile Sun Nov 18 22:57:36 2012 +0700 @@ -28,9 +28,11 @@ # To use Jbuilder templates for JSON # gem 'jbuilder' -# Use unicorn as the app server -gem 'unicorn', :platforms => :mri -gem 'puma', :platforms => [:rbx, :jruby] +group :standalone do + # Use unicorn as the app server + gem 'unicorn', :platforms => :mri + gem 'puma', :platforms => [:rbx, :jruby] +end # Deploy with Capistrano # gem 'capistrano' diff -r 601c608637e7 -r 812711965af1 config/application.rb --- a/config/application.rb Sun Nov 18 00:48:32 2012 +0700 +++ b/config/application.rb Sun Nov 18 22:57:36 2012 +0700 @@ -1,6 +1,5 @@ require File.expand_path('../boot', __FILE__) -# Pick the frameworks you want: require "active_record/railtie" require "action_controller/railtie" # require "action_mailer/railtie" @@ -8,9 +7,14 @@ require "sprockets/railtie" # require "rails/test_unit/railtie" +require File.expand_path('../init_config', __FILE__) +require File.expand_path('../local_config', __FILE__) +require File.expand_path('../default_config', __FILE__) + +# Pick the frameworks you want: if defined?(Bundler) # If you precompile assets before deploying to production, use this line - Bundler.require(*Rails.groups(:assets => %w(development test))) + Bundler.require(*CONFIG['bundler_groups']) # If you want your assets lazily compiled in production, use this line # Bundler.require(:default, :assets, Rails.env) end diff -r 601c608637e7 -r 812711965af1 config/default_config.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/default_config.rb Sun Nov 18 22:57:36 2012 +0700 @@ -0,0 +1,3 @@ +CONFIG['standalone'] ||= true +CONFIG['bundler_groups'] ||= Rails.groups(:assets => %w(development test)) +CONFIG['bundler_groups'] << 'standalone' if CONFIG['standalone'] diff -r 601c608637e7 -r 812711965af1 config/init_config.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/init_config.rb Sun Nov 18 22:57:36 2012 +0700 @@ -0,0 +1,1 @@ +CONFIG = {} diff -r 601c608637e7 -r 812711965af1 config/local_config.rb.example --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/local_config.rb.example Sun Nov 18 22:57:36 2012 +0700 @@ -0,0 +1,5 @@ +# Set to false if you want to use different web server (e.g. passenger) +# Default is set to use standalone server: +# - MRI Ruby: Unicorn +# - JRuby and Rubinius: Puma +# CONFIG['standalone'] = true