OSDN Git Service

Project linguist integration
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 20 Apr 2012 22:26:22 +0000 (01:26 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 20 Apr 2012 22:26:22 +0000 (01:26 +0300)
Gemfile
Gemfile.lock
app/models/snippet.rb
app/models/tree.rb
config/initializers/gitlabhq/20_grit_ext.rb

diff --git a/Gemfile b/Gemfile
index 8bf737a..b6c35ac 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -19,7 +19,7 @@ gem "therubyracer"
 gem "faker"
 gem "seed-fu"
 gem "linguist", "~> 1.0.0", :git => "https://github.com/github/linguist.git"
-gem "pygments.rb", "0.2.7"
+gem "pygments.rb", "0.2.11"
 gem "thin"
 gem "unicorn"
 gem "git"
index 221e814..c852a8b 100644 (file)
@@ -180,7 +180,7 @@ GEM
       coderay (~> 1.0.5)
       method_source (~> 0.7)
       slop (>= 2.4.4, < 3)
-    pygments.rb (0.2.7)
+    pygments.rb (0.2.11)
       rubypython (~> 0.5.3)
     pyu-ruby-sasl (0.0.3.3)
     rack (1.4.1)
@@ -342,7 +342,7 @@ DEPENDENCIES
   mysql2
   omniauth-ldap
   pry
-  pygments.rb (= 0.2.7)
+  pygments.rb (= 0.2.11)
   rails (= 3.2.1)
   rails-footnotes
   rake
index ae25e8a..17d2341 100644 (file)
@@ -1,5 +1,5 @@
 class Snippet < ActiveRecord::Base
-  include Utils::Colorize
+  include Linguist::BlobHelper
 
   belongs_to :project
   belongs_to :author, :class_name => "User"
@@ -38,8 +38,20 @@ class Snippet < ActiveRecord::Base
     ]
   end
 
-  def colorize
-    system_colorize(content, file_name)
+  def data
+    content
+  end
+
+  def size
+    0
+  end
+
+  def name 
+    file_name
+  end
+
+  def mode 
+    nil
   end
 
   def expired?
index 6040680..9d60f83 100644 (file)
@@ -1,5 +1,5 @@
 class Tree
-  include Utils::FileHelper
+   include Linguist::BlobHelper
   attr_accessor :path, :tree, :project, :ref
 
   delegate :contents,
index 4c6be1e..13e692c 100644 (file)
@@ -1,4 +1,5 @@
 require 'grit'
+require 'pygments'
 
 Grit::Blob.class_eval do
   include Linguist::BlobHelper