@@ -1,99 +1,99 | |||
|
1 | 1 | source 'https://rubygems.org' |
|
2 | 2 | |
|
3 | 3 | gem "rails", "3.2.13" |
|
4 | 4 | gem "jquery-rails", "~> 2.0.2" |
|
5 | 5 | gem "i18n", "~> 0.6.0" |
|
6 |
gem "coderay", "~> 1.0. |
|
|
6 | gem "coderay", "~> 1.0.9" | |
|
7 | 7 | gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] |
|
8 | 8 | gem "builder", "3.0.0" |
|
9 | 9 | |
|
10 | 10 | # Optional gem for LDAP authentication |
|
11 | 11 | group :ldap do |
|
12 | 12 | gem "net-ldap", "~> 0.3.1" |
|
13 | 13 | end |
|
14 | 14 | |
|
15 | 15 | # Optional gem for OpenID authentication |
|
16 | 16 | group :openid do |
|
17 | 17 | gem "ruby-openid", "~> 2.1.4", :require => "openid" |
|
18 | 18 | gem "rack-openid" |
|
19 | 19 | end |
|
20 | 20 | |
|
21 | 21 | # Optional gem for exporting the gantt to a PNG file, not supported with jruby |
|
22 | 22 | platforms :mri, :mingw do |
|
23 | 23 | group :rmagick do |
|
24 | 24 | # RMagick 2 supports ruby 1.9 |
|
25 | 25 | # RMagick 1 would be fine for ruby 1.8 but Bundler does not support |
|
26 | 26 | # different requirements for the same gem on different platforms |
|
27 | 27 | gem "rmagick", ">= 2.0.0" |
|
28 | 28 | end |
|
29 | 29 | end |
|
30 | 30 | |
|
31 | 31 | platforms :jruby do |
|
32 | 32 | # jruby-openssl is bundled with JRuby 1.7.0 |
|
33 | 33 | gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0' |
|
34 | 34 | gem "activerecord-jdbc-adapter", "1.2.5" |
|
35 | 35 | end |
|
36 | 36 | |
|
37 | 37 | # Include database gems for the adapters found in the database |
|
38 | 38 | # configuration file |
|
39 | 39 | require 'erb' |
|
40 | 40 | require 'yaml' |
|
41 | 41 | database_file = File.join(File.dirname(__FILE__), "config/database.yml") |
|
42 | 42 | if File.exist?(database_file) |
|
43 | 43 | database_config = YAML::load(ERB.new(IO.read(database_file)).result) |
|
44 | 44 | adapters = database_config.values.map {|c| c['adapter']}.compact.uniq |
|
45 | 45 | if adapters.any? |
|
46 | 46 | adapters.each do |adapter| |
|
47 | 47 | case adapter |
|
48 | 48 | when 'mysql2' |
|
49 | 49 | gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw] |
|
50 | 50 | gem "activerecord-jdbcmysql-adapter", :platforms => :jruby |
|
51 | 51 | when 'mysql' |
|
52 | 52 | gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw] |
|
53 | 53 | gem "activerecord-jdbcmysql-adapter", :platforms => :jruby |
|
54 | 54 | when /postgresql/ |
|
55 | 55 | gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw] |
|
56 | 56 | gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby |
|
57 | 57 | when /sqlite3/ |
|
58 | 58 | gem "sqlite3", :platforms => [:mri, :mingw] |
|
59 | 59 | gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby |
|
60 | 60 | when /sqlserver/ |
|
61 | 61 | gem "tiny_tds", "~> 0.5.1", :platforms => [:mri, :mingw] |
|
62 | 62 | gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw] |
|
63 | 63 | else |
|
64 | 64 | warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems") |
|
65 | 65 | end |
|
66 | 66 | end |
|
67 | 67 | else |
|
68 | 68 | warn("No adapter found in config/database.yml, please configure it first") |
|
69 | 69 | end |
|
70 | 70 | else |
|
71 | 71 | warn("Please configure your config/database.yml first") |
|
72 | 72 | end |
|
73 | 73 | |
|
74 | 74 | group :development do |
|
75 | 75 | gem "rdoc", ">= 2.4.2" |
|
76 | 76 | gem "yard" |
|
77 | 77 | end |
|
78 | 78 | |
|
79 | 79 | group :test do |
|
80 | 80 | gem "shoulda", "~> 3.3.2" |
|
81 | 81 | gem "mocha", ">= 0.14", :require => 'mocha/api' |
|
82 | 82 | if RUBY_VERSION >= '1.9.3' |
|
83 | 83 | gem "capybara", "~> 2.1.0" |
|
84 | 84 | gem "selenium-webdriver" |
|
85 | 85 | end |
|
86 | 86 | end |
|
87 | 87 | |
|
88 | 88 | local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") |
|
89 | 89 | if File.exists?(local_gemfile) |
|
90 | 90 | puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v` |
|
91 | 91 | instance_eval File.read(local_gemfile) |
|
92 | 92 | end |
|
93 | 93 | |
|
94 | 94 | # Load plugins' Gemfiles |
|
95 | 95 | Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file| |
|
96 | 96 | puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` |
|
97 | 97 | #TODO: switch to "eval_gemfile file" when bundler >= 1.2.0 will be required (rails 4) |
|
98 | 98 | instance_eval File.read(file), file |
|
99 | 99 | end |
@@ -1,56 +1,55 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2013 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | module Redmine |
|
19 | 19 | module SyntaxHighlighting |
|
20 | 20 | |
|
21 | 21 | class << self |
|
22 | 22 | attr_reader :highlighter |
|
23 | 23 | delegate :highlight_by_filename, :highlight_by_language, :to => :highlighter |
|
24 | 24 | |
|
25 | 25 | def highlighter=(name) |
|
26 | 26 | if name.is_a?(Module) |
|
27 | 27 | @highlighter = name |
|
28 | 28 | else |
|
29 | 29 | @highlighter = const_get(name) |
|
30 | 30 | end |
|
31 | 31 | end |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | module CodeRay |
|
35 | 35 | require 'coderay' |
|
36 | require 'coderay/helpers/file_type' | |
|
37 | 36 | |
|
38 | 37 | class << self |
|
39 | 38 | # Highlights +text+ as the content of +filename+ |
|
40 | 39 | # Should not return line numbers nor outer pre tag |
|
41 | 40 | def highlight_by_filename(text, filename) |
|
42 | 41 | language = ::CodeRay::FileType[filename] |
|
43 | 42 | language ? ::CodeRay.scan(text, language).html(:break_lines => true) : ERB::Util.h(text) |
|
44 | 43 | end |
|
45 | 44 | |
|
46 | 45 | # Highlights +text+ using +language+ syntax |
|
47 | 46 | # Should not return outer pre tag |
|
48 | 47 | def highlight_by_language(text, language) |
|
49 | 48 | ::CodeRay.scan(text, language).html(:wrap => :span) |
|
50 | 49 | end |
|
51 | 50 | end |
|
52 | 51 | end |
|
53 | 52 | end |
|
54 | 53 | |
|
55 | 54 | SyntaxHighlighting.highlighter = 'CodeRay' |
|
56 | 55 | end |
General Comments 0
You need to be logged in to leave comments.
Login now