Retour à un diff plus léger, qui risque moins les soucis de mémoire en production (car appel de diff système fork un process supplémentaire, qui double la mémoire utilisée)

This commit is contained in:
echarp 2014-10-26 16:21:00 +01:00
parent 7e29bb43c8
commit 5daed4a832
3 changed files with 14 additions and 8 deletions

View File

@ -67,7 +67,7 @@ gem 'email_validator'
# Email address obfuscation # Email address obfuscation
gem 'actionview-encoded_mail_to' gem 'actionview-encoded_mail_to'
# To display a patched diff for event descriptions # To display a patched diff for event descriptions
gem 'diffy' gem 'differ', github: 'genuitytech/differ', branch: 'add_patch_format'
# A generic library to administrate the tool # A generic library to administrate the tool
gem 'activeadmin', github: 'gregbell/active_admin' gem 'activeadmin', github: 'gregbell/active_admin'

View File

@ -6,9 +6,16 @@ GIT
jquery-rails jquery-rails
rails (>= 3.2.2) rails (>= 3.2.2)
GIT
remote: git://github.com/genuitytech/differ.git
revision: ff1a29ab2fa87620149e001d07aa48bef92de850
branch: add_patch_format
specs:
differ (0.1.2)
GIT GIT
remote: git://github.com/gregbell/active_admin.git remote: git://github.com/gregbell/active_admin.git
revision: 8b6586c23a623b3281c136b057d856cc8fb5457e revision: 944af76ace89f941a7baa92775854d2e1d0e6dba
specs: specs:
activeadmin (1.0.0.pre) activeadmin (1.0.0.pre)
arbre (~> 1.0, >= 1.0.2) arbre (~> 1.0, >= 1.0.2)
@ -96,7 +103,7 @@ GEM
builder (3.2.2) builder (3.2.2)
celluloid (0.16.0) celluloid (0.16.0)
timers (~> 4.0.0) timers (~> 4.0.0)
chunky_png (1.3.2) chunky_png (1.3.3)
coderay (1.1.0) coderay (1.1.0)
coffee-rails (4.1.0) coffee-rails (4.1.0)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
@ -128,7 +135,6 @@ GEM
thread_safe (~> 0.1) thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
devise-i18n (0.11.2) devise-i18n (0.11.2)
diffy (3.0.7)
docile (1.1.5) docile (1.1.5)
em-websocket (0.5.1) em-websocket (0.5.1)
eventmachine (>= 0.12.9) eventmachine (>= 0.12.9)
@ -193,7 +199,7 @@ GEM
inherited_resources (1.4.1) inherited_resources (1.4.1)
has_scope (~> 0.6.0.rc) has_scope (~> 0.6.0.rc)
responders (~> 1.0.0.rc) responders (~> 1.0.0.rc)
jbuilder (2.2.3) jbuilder (2.2.4)
activesupport (>= 3.0.0, < 5) activesupport (>= 3.0.0, < 5)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-rails (3.1.2) jquery-rails (3.1.2)
@ -304,7 +310,7 @@ GEM
select2-rails (3.5.9.1) select2-rails (3.5.9.1)
thor (~> 0.14) thor (~> 0.14)
sexp_processor (4.4.4) sexp_processor (4.4.4)
simple_calendar (1.1.5) simple_calendar (1.1.6)
rails (>= 3.0) rails (>= 3.0)
simple_oauth (0.2.0) simple_oauth (0.2.0)
simplecov (0.9.1) simplecov (0.9.1)
@ -379,7 +385,7 @@ DEPENDENCIES
compass-rails compass-rails
devise devise
devise-i18n devise-i18n
diffy differ!
email_validator email_validator
font-awesome-rails font-awesome-rails
geocoder geocoder

View File

@ -10,7 +10,7 @@
- prev = render file: '/events/show' - prev = render file: '/events/show'
- @event = former - @event = former
= raw Diffy::Diff.new prev, new = Differ.diff(new, prev).format_as(:patch).gsub(/\[\d{1,2}m/, '')
\ \
- if @current_user - if @current_user
= edit_moderation_url @event = edit_moderation_url @event