public
Description: A no-frills Merb wiki extracted from wiki.merbivore.com
Homepage: http://github.com/meekish/collective
Clone URL: git://github.com/meekish/collective.git
Search Repo:
Add a generate a diff unified between several version. But there are no 
Spec, It s bad, needed quickly
shingara (author)
Mon Jun 02 14:13:17 -0700 2008
commit  2297726af960c694c188f5c1a72a6868444701e2
tree    0242dbfc9f1e8e603a8d36c9808c4e69bf852a1e
parent  8afabf024cbcb90b18d16ba4b02ffb23b5366628
...
39
40
41
 
 
 
 
 
 
 
42
43
44
...
39
40
41
42
43
44
45
46
47
48
49
50
51
0
@@ -39,6 +39,13 @@ class Version < DataMapper::Base
0
   def self.recent(number = 10)
0
     all(:limit => number, :order => 'id DESC', :spam => false)
0
   end
0
+
0
+ # Generate the diff between the version and another
0
+ # send by params
0
+ # You can define the format, by default is unified
0
+ def diff(other_version, format=:unified)
0
+ Diff.cs_diff(content, other_version.content)
0
+ end
0
   
0
 private
0
   def linkify_bracketed_phrases(string)
...
25
26
27
28
 
29
30
31
...
37
38
39
 
 
 
 
40
41
42
...
25
26
27
 
28
29
30
31
...
37
38
39
40
41
42
43
44
45
46
0
@@ -25,7 +25,7 @@ use_test :rspec
0
 dependencies 'iconv', 'merb-action-args', 'merb-assets', 'merb_has_flash',
0
              'merb-haml', 'merb_helpers', 'merb_http_basic_auth',
0
              'merb-parts', 'uri'
0
-
0
+
0
 # dependency "RedCloth", "> 3.0"
0
 # OR
0
 # dependencies "RedCloth" => "> 3.0", "ruby-aes-cext" => "= 1.0"
0
@@ -37,6 +37,10 @@ dependencies 'iconv', 'merb-action-args', 'merb-assets', 'merb_has_flash',
0
 require 'redcloth'
0
 require 'viking'
0
 
0
+#Require needed for Diff module (/lib/diff.rb)
0
+require 'diff/lcs'
0
+require 'diff/lcs/hunk'
0
+
0
 # Load initializers
0
 Dir[Merb.root / 'config' / 'initializers' / '*.rb'].each do |initializer|
0
   load(initializer)

Comments

    No one has commented yet.