diff options
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 5 | ||||
-rw-r--r-- | config/environments/development.rb | 8 | ||||
-rw-r--r-- | config/general.yml-example | 8 | ||||
-rw-r--r-- | lib/configuration.rb | 3 |
5 files changed, 24 insertions, 1 deletions
@@ -70,6 +70,7 @@ group :test do end group :test, :development do + gem 'bullet', '~> 4.14.6' gem 'factory_girl_rails', '~> 1.7' gem 'rspec-rails', '~> 2.13.2' gem 'spork-rails', '~> 3.2.1' diff --git a/Gemfile.lock b/Gemfile.lock index f00c26061..b9e0f3380 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,6 +60,9 @@ GEM bootstrap-sass (2.3.1.2) sass (~> 3.2) builder (3.0.4) + bullet (4.14.6) + activesupport (>= 3.0.0) + uniform_notifier (~> 1.9.0) capistrano (2.15.4) highline net-scp (>= 1.0.0) @@ -285,6 +288,7 @@ GEM multi_json (~> 1.0, >= 1.0.2) unicode (0.4.4) unidecoder (1.1.2) + uniform_notifier (1.9.0) vpim (13.11.11) webrat (0.7.3) nokogiri (>= 1.2.0) @@ -302,6 +306,7 @@ DEPENDENCIES acts_as_versioned! annotate (~> 2.5.0) bootstrap-sass (~> 2.3.1.2) + bullet (~> 4.14.6) capistrano (~> 2.15.4) charlock_holmes (~> 0.6.9.4) coffee-rails (~> 3.2.1) diff --git a/config/environments/development.rb b/config/environments/development.rb index dbf8d7b2a..b334a1e19 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -46,4 +46,12 @@ Alaveteli::Application.configure do # with SQLite, MySQL, and PostgreSQL) config.active_record.auto_explain_threshold_in_seconds = 0.5 + if AlaveteliConfiguration.use_bullet_in_development + config.after_initialize do + Bullet.enable = true + Bullet.bullet_logger = true + Bullet.console = true + Bullet.add_footer = true + end + end end diff --git a/config/general.yml-example b/config/general.yml-example index df140136c..a6980b71c 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -673,6 +673,14 @@ PUBLIC_BODY_LIST_FALLBACK_TO_DEFAULT_LOCALE: false # --- USE_MAILCATCHER_IN_DEVELOPMENT: true +# Bullet is a tool to help to kill N+1 queries and unused eager loading +# https://github.com/flyerhzm/bullet +# +# USE_BULLET_IN_DEVELOPMENT - Boolean (default: false) +# +# --- +USE_BULLET_IN_DEVELOPMENT: false + # Use memcached to cache HTML fragments for better performance. This will # only have an effect in environments where # config.action_controller.perform_caching is set to true diff --git a/lib/configuration.rb b/lib/configuration.rb index c983152e0..89f148602 100644 --- a/lib/configuration.rb +++ b/lib/configuration.rb @@ -86,7 +86,8 @@ module AlaveteliConfiguration :USE_MAILCATCHER_IN_DEVELOPMENT => true, :UTILITY_SEARCH_PATH => ["/usr/bin", "/usr/local/bin"], :VARNISH_HOST => '', - :WORKING_OR_CALENDAR_DAYS => 'working' + :WORKING_OR_CALENDAR_DAYS => 'working', + :USE_BULLET_IN_DEVELOPMENT => false } end |