diff options
author | Alex Legler <a3li@gentoo.org> | 2009-05-03 19:24:16 +0200 |
---|---|---|
committer | Alex Legler <a3li@gentoo.org> | 2009-05-03 19:24:45 +0200 |
commit | 38383c9380f40b07f928214ddcd2b5ff81475672 (patch) | |
tree | bd0b1a47ad395f3043dce7b1137337b7b42c1606 /lib/glsamaker | |
parent | Moving new-request logic into the glsa model (diff) | |
download | glsamaker-38383c9380f40b07f928214ddcd2b5ff81475672.tar.gz glsamaker-38383c9380f40b07f928214ddcd2b5ff81475672.tar.bz2 glsamaker-38383c9380f40b07f928214ddcd2b5ff81475672.zip |
Adding a very basic diff view, courtesy to Redmine
Diffstat (limited to 'lib/glsamaker')
-rw-r--r-- | lib/glsamaker/bugs.rb | 15 | ||||
-rw-r--r-- | lib/glsamaker/diff.rb | 34 |
2 files changed, 49 insertions, 0 deletions
diff --git a/lib/glsamaker/bugs.rb b/lib/glsamaker/bugs.rb new file mode 100644 index 0000000..b190bdc --- /dev/null +++ b/lib/glsamaker/bugs.rb @@ -0,0 +1,15 @@ +# ===GLSAMaker v2 +# Copyright (C) 2009 Alex Legler <a3li@gentoo.org> +# Copyright (C) 2009 Pierre-Yves Rofes <py@gentoo.org> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# For more information, see the LICENSE file. + +module Glsamaker + module Bugs + end +end
\ No newline at end of file diff --git a/lib/glsamaker/diff.rb b/lib/glsamaker/diff.rb new file mode 100644 index 0000000..1e694a1 --- /dev/null +++ b/lib/glsamaker/diff.rb @@ -0,0 +1,34 @@ +# ===GLSAMaker v2 +# Copyright (C) 2009 Alex Legler <a3li@gentoo.org> +# Copyright (C) 2009 Pierre-Yves Rofes <py@gentoo.org> +# Copyright (C) 2006-2007 Jean-Philippe Lang +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# For more information, see the LICENSE file. + +require 'diff' + +module Glsamaker + # Module providing diff support + module Diff + + # DiffContainer represents a set of diffs + class DiffContainer + attr_reader :diff, :words, :content_to, :content_from + + def initialize(content_to, content_from) + @content_to = content_to || "" + @content_from = content_from || "" + @words = @content_to.split(/(\s+)/) + @words = @words.select {|word| word != ' '} + words_from = @content_from.split(/(\s+)/) + words_from = words_from.select {|word| word != ' '} + @diff = words_from.diff @words + end + end + end +end
\ No newline at end of file |