From d3730b071365dd3dbfa0b8ec4433e1f18a93c969 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Wed, 9 Sep 2015 14:54:34 +0100 Subject: Fix highlighting of deleted lines in diffs. --- config/initializers/rouge_diff_lexer.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 config/initializers/rouge_diff_lexer.rb (limited to 'config') diff --git a/config/initializers/rouge_diff_lexer.rb b/config/initializers/rouge_diff_lexer.rb new file mode 100644 index 00000000000..fdb2d7b748e --- /dev/null +++ b/config/initializers/rouge_diff_lexer.rb @@ -0,0 +1,24 @@ +# Here until https://github.com/jneen/rouge/pull/297 is merged into Rouge and the gem is updated in GitLab. +module Rouge + module Lexers + class Diff + def self.analyze_text(text) + return 1 if text.start_with?('Index: ') + return 1 if text.start_with?('diff ') + return 0.9 if text.start_with?('--- ') + end + + state :root do + rule(/^ .*\n/, Text) + rule(/^---\n/, Text) + rule(/^\+.*\n/, Generic::Inserted) + rule(/^-+.*\n/, Generic::Deleted) + rule(/^!.*\n/, Generic::Strong) + rule(/^@.*\n/, Generic::Subheading) + rule(/^([Ii]ndex|diff).*\n/, Generic::Heading) + rule(/^=.*\n/, Generic::Heading) + rule(/.*\n/, Text) + end + end + end +end -- cgit v1.2.1 From 0d66d4d342c72d141578d746aad766a6234fc872 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Wed, 9 Sep 2015 15:19:58 +0100 Subject: Fix reading session_expire_delay when application settings are not yet created and migrations are not yet done --- config/initializers/session_store.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index 6d274cd95a1..88651394d1d 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -2,7 +2,12 @@ require 'gitlab/current_settings' include Gitlab::CurrentSettings -Settings.gitlab['session_expire_delay'] = current_application_settings.session_expire_delay + +# allow it to fail: it may to do so when create_from_defaults is executed before migrations are actually done +begin + Settings.gitlab['session_expire_delay'] = current_application_settings.session_expire_delay +rescue +end Gitlab::Application.config.session_store( :redis_store, # Using the cookie_store would enable session replay attacks. -- cgit v1.2.1 From e20529cec4f6de0c2c1589da99abb8714ea1c1c1 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 10 Sep 2015 13:38:43 -0700 Subject: Bump rouge to 1.10.1 --- config/initializers/rouge_diff_lexer.rb | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 config/initializers/rouge_diff_lexer.rb (limited to 'config') diff --git a/config/initializers/rouge_diff_lexer.rb b/config/initializers/rouge_diff_lexer.rb deleted file mode 100644 index fdb2d7b748e..00000000000 --- a/config/initializers/rouge_diff_lexer.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Here until https://github.com/jneen/rouge/pull/297 is merged into Rouge and the gem is updated in GitLab. -module Rouge - module Lexers - class Diff - def self.analyze_text(text) - return 1 if text.start_with?('Index: ') - return 1 if text.start_with?('diff ') - return 0.9 if text.start_with?('--- ') - end - - state :root do - rule(/^ .*\n/, Text) - rule(/^---\n/, Text) - rule(/^\+.*\n/, Generic::Inserted) - rule(/^-+.*\n/, Generic::Deleted) - rule(/^!.*\n/, Generic::Strong) - rule(/^@.*\n/, Generic::Subheading) - rule(/^([Ii]ndex|diff).*\n/, Generic::Heading) - rule(/^=.*\n/, Generic::Heading) - rule(/.*\n/, Text) - end - end - end -end -- cgit v1.2.1