Commit 1477a6c8aaecbde1f2b5903cccb267d632212ee4
1 parent
f2808191
Exists in
master
and in
4 other branches
moved from albino -> pygments.rb
Showing
7 changed files
with
21 additions
and
17 deletions
Show diff stats
Gemfile
@@ -15,7 +15,7 @@ gem 'therubyracer' | @@ -15,7 +15,7 @@ gem 'therubyracer' | ||
15 | gem 'faker' | 15 | gem 'faker' |
16 | gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git' | 16 | gem 'seed-fu', :git => 'git://github.com/mbleigh/seed-fu.git' |
17 | gem "inifile" | 17 | gem "inifile" |
18 | -gem "albino", :git => "git://github.com/gitlabhq/albino.git" | 18 | +gem "pygments.rb", "0.2.3" |
19 | gem "kaminari" | 19 | gem "kaminari" |
20 | gem "thin" | 20 | gem "thin" |
21 | gem "git" | 21 | gem "git" |
Gemfile.lock
@@ -5,13 +5,6 @@ GIT | @@ -5,13 +5,6 @@ GIT | ||
5 | annotate (2.4.1.beta1) | 5 | annotate (2.4.1.beta1) |
6 | 6 | ||
7 | GIT | 7 | GIT |
8 | - remote: git://github.com/gitlabhq/albino.git | ||
9 | - revision: 118380924969f3a856659f86ea1f40c1ba7bfcb1 | ||
10 | - specs: | ||
11 | - albino (1.3.3) | ||
12 | - posix-spawn (>= 0.3.6) | ||
13 | - | ||
14 | -GIT | ||
15 | remote: git://github.com/gitlabhq/grit.git | 8 | remote: git://github.com/gitlabhq/grit.git |
16 | revision: ff015074ef35bd94cba943f9c0f98e161ab5851c | 9 | revision: ff015074ef35bd94cba943f9c0f98e161ab5851c |
17 | specs: | 10 | specs: |
@@ -72,6 +65,7 @@ GEM | @@ -72,6 +65,7 @@ GEM | ||
72 | ZenTest (= 4.5) | 65 | ZenTest (= 4.5) |
73 | awesome_print (0.4.0) | 66 | awesome_print (0.4.0) |
74 | bcrypt-ruby (3.0.1) | 67 | bcrypt-ruby (3.0.1) |
68 | + blankslate (2.1.2.4) | ||
75 | builder (3.0.0) | 69 | builder (3.0.0) |
76 | capybara (1.0.1) | 70 | capybara (1.0.1) |
77 | mime-types (>= 1.16) | 71 | mime-types (>= 1.16) |
@@ -138,6 +132,8 @@ GEM | @@ -138,6 +132,8 @@ GEM | ||
138 | orm_adapter (0.0.5) | 132 | orm_adapter (0.0.5) |
139 | polyglot (0.3.2) | 133 | polyglot (0.3.2) |
140 | posix-spawn (0.3.6) | 134 | posix-spawn (0.3.6) |
135 | + pygments.rb (0.2.3) | ||
136 | + rubypython (>= 0.5.1) | ||
141 | rack (1.3.2) | 137 | rack (1.3.2) |
142 | rack-cache (1.0.3) | 138 | rack-cache (1.0.3) |
143 | rack (>= 0.4) | 139 | rack (>= 0.4) |
@@ -189,6 +185,9 @@ GEM | @@ -189,6 +185,9 @@ GEM | ||
189 | ruby-debug-base19 (>= 0.11.19) | 185 | ruby-debug-base19 (>= 0.11.19) |
190 | ruby_core_source (0.1.5) | 186 | ruby_core_source (0.1.5) |
191 | archive-tar-minitar (>= 0.5.2) | 187 | archive-tar-minitar (>= 0.5.2) |
188 | + rubypython (0.5.1) | ||
189 | + blankslate (>= 2.1.2.3) | ||
190 | + ffi (~> 1.0.7) | ||
192 | rubyzip (0.9.4) | 191 | rubyzip (0.9.4) |
193 | sass (3.1.7) | 192 | sass (3.1.7) |
194 | sass-rails (3.1.1) | 193 | sass-rails (3.1.1) |
@@ -242,7 +241,6 @@ PLATFORMS | @@ -242,7 +241,6 @@ PLATFORMS | ||
242 | 241 | ||
243 | DEPENDENCIES | 242 | DEPENDENCIES |
244 | acts_as_list | 243 | acts_as_list |
245 | - albino! | ||
246 | annotate! | 244 | annotate! |
247 | autotest | 245 | autotest |
248 | autotest-rails | 246 | autotest-rails |
@@ -260,6 +258,7 @@ DEPENDENCIES | @@ -260,6 +258,7 @@ DEPENDENCIES | ||
260 | jquery-rails | 258 | jquery-rails |
261 | kaminari | 259 | kaminari |
262 | launchy | 260 | launchy |
261 | + pygments.rb (= 0.2.3) | ||
263 | rails (= 3.1.0) | 262 | rails (= 3.1.0) |
264 | rails-footnotes (>= 3.7.5.rc4) | 263 | rails-footnotes (>= 3.7.5.rc4) |
265 | rspec-rails | 264 | rspec-rails |
app/models/snippet.rb
@@ -32,8 +32,7 @@ class Snippet < ActiveRecord::Base | @@ -32,8 +32,7 @@ class Snippet < ActiveRecord::Base | ||
32 | end | 32 | end |
33 | 33 | ||
34 | def colorize | 34 | def colorize |
35 | - ft = handle_file_type(file_name) | ||
36 | - Albino.colorize(content, ft, :html, 'utf-8', "linenos=True") | 35 | + system_colorize(content, file_name) |
37 | end | 36 | end |
38 | end | 37 | end |
39 | # == Schema Information | 38 | # == Schema Information |
app/views/projects/_tree_file.html.haml
app/views/projects/empty.html.erb
1 | +<% bash_lexer = Pygments::Lexer[:bash] %> | ||
1 | <div class=""> | 2 | <div class=""> |
2 | <div class="git-empty"> | 3 | <div class="git-empty"> |
3 | <h2>Git global setup:</h2> | 4 | <h2>Git global setup:</h2> |
@@ -6,7 +7,7 @@ git config --global user.name "#{current_user.name}" | @@ -6,7 +7,7 @@ git config --global user.name "#{current_user.name}" | ||
6 | git config --global user.email "#{current_user.email}" | 7 | git config --global user.email "#{current_user.email}" |
7 | eos | 8 | eos |
8 | %> | 9 | %> |
9 | - <%= raw Albino.colorize(setup_str, :bash) %> | 10 | + <%= raw bash_lexer.highlight(setup_str) %> |
10 | <br /> | 11 | <br /> |
11 | <br /> | 12 | <br /> |
12 | <h2>Next steps:</h2> | 13 | <h2>Next steps:</h2> |
@@ -21,7 +22,7 @@ git remote add origin #{@project.url_to_repo} | @@ -21,7 +22,7 @@ git remote add origin #{@project.url_to_repo} | ||
21 | git push -u origin master | 22 | git push -u origin master |
22 | eos | 23 | eos |
23 | %> | 24 | %> |
24 | - <%= raw Albino.colorize(repo_setup_str, :bash) %> | 25 | + <%= raw bash_lexer.highlight(repo_setup_str) %> |
25 | 26 | ||
26 | <br /><br /> | 27 | <br /><br /> |
27 | <h2>Existing Git Repo?</h2> | 28 | <h2>Existing Git Repo?</h2> |
@@ -31,7 +32,7 @@ git remote add origin #{@project.url_to_repo} | @@ -31,7 +32,7 @@ git remote add origin #{@project.url_to_repo} | ||
31 | git push -u origin master | 32 | git push -u origin master |
32 | eos | 33 | eos |
33 | %> | 34 | %> |
34 | - <%= raw Albino.colorize(exist_repo_setup_str, :bash) %> | 35 | + <%= raw bash_lexer.highlight(exist_repo_setup_str) %> |
35 | 36 | ||
36 | <br /><br /> | 37 | <br /><br /> |
37 | <h2>Remove this project?</h2> | 38 | <h2>Remove this project?</h2> |
config/initializers/grit_ext.rb
lib/utils.rb
@@ -18,8 +18,12 @@ module Utils | @@ -18,8 +18,12 @@ module Utils | ||
18 | 18 | ||
19 | module Colorize | 19 | module Colorize |
20 | def colorize | 20 | def colorize |
21 | - ft = handle_file_type(name, mime_type) | ||
22 | - Albino.colorize(data, ft, :html, 'utf-8', "linenos=True") | 21 | + system_colorize(data, name) |
22 | + end | ||
23 | + | ||
24 | + def system_colorize(data, file_name) | ||
25 | + ft = handle_file_type(file_name) | ||
26 | + Pygments.highlight(data, :lexer => ft, :options => { :encoding => 'utf-8', :linenos => 'True' }) | ||
23 | end | 27 | end |
24 | 28 | ||
25 | def handle_file_type(file_name, mime_type = nil) | 29 | def handle_file_type(file_name, mime_type = nil) |