Patch #5404 » 5404_fix_redmine_on_jruby_stable.diff
| app/helpers/timelog_helper.rb | ||
|---|---|---|
| 57 | 57 | 
    if value.to_s.empty?  | 
| 58 | 58 | 
      		data.select {|row| row[criteria].blank? }
   | 
| 59 | 59 | 
    else  | 
| 60 | 
        	data.select {|row| row[criteria] == value}
   | 
|
| 60 | 
        	data.select {|row| row[criteria].to_s == value.to_s}
   | 
|
| 61 | 61 | 
    end  | 
| 62 | 62 | 
    end  | 
| 63 | 63 | 
     | 
| app/models/workflow.rb | ||
|---|---|---|
| 32 | 32 | 
    trackers.each do |tracker|  | 
| 33 | 33 | 
    t = []  | 
| 34 | 34 | 
    roles.each do |role|  | 
| 35 | 
            row = counts.detect {|c| c['role_id'] == role.id.to_s && c['tracker_id'] == tracker.id.to_s}
   | 
|
| 35 | 
            row = counts.detect {|c| c['role_id'].to_s == role.id.to_s && c['tracker_id'].to_s == tracker.id.to_s}
   | 
|
| 36 | 36 | 
    t << [role, (row.nil? ? 0 : row['c'].to_i)]  | 
| 37 | 37 | 
    end  | 
| 38 | 38 | 
    result << [tracker, t]  | 
| config/initializers/jdbc.rb | ||
|---|---|---|
| 1 | 
    # This file was generated by the "jdbc" generator, which is provided  | 
|
| 2 | 
    # by the activerecord-jdbc-adapter gem.  | 
|
| 3 | 
    #  | 
|
| 4 | 
    # This file allows the JDBC drivers to be hooked into ActiveRecord  | 
|
| 5 | 
    # such that you don't have to change anything else in your Rails  | 
|
| 6 | 
    # application.  | 
|
| 7 | 
    require 'jdbc_adapter' if defined?(JRUBY_VERSION)  | 
|
| config/initializers/jruby_compat.rb | ||
|---|---|---|
| 1 | 
    if defined?(JRUBY_VERSION)  | 
|
| 2 | 
    ::JdbcSpec::PostgreSQL.class_eval do  | 
|
| 3 | 
    def table_alias_length  | 
|
| 4 | 
          @table_alias_length ||= (postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to_i : 63)
   | 
|
| 5 | 
    end  | 
|
| 6 | 
    end  | 
|
| 7 | ||
| 8 | 
    ::JdbcSpec::SQLite3::Column.class_eval do  | 
|
| 9 | 
    def type_cast_with_correct_date_handling(value)  | 
|
| 10 | 
    return nil if value.nil?  | 
|
| 11 | 
    case type  | 
|
| 12 | 
    when :datetime, :time  | 
|
| 13 | 
    JdbcSpec::SQLite3::Column.cast_to_time(value)  | 
|
| 14 | 
    when :date  | 
|
| 15 | 
    JdbcSpec::SQLite3::Column.cast_to_date(value)  | 
|
| 16 | 
    else  | 
|
| 17 | 
    type_cast_without_correct_date_handling(value)  | 
|
| 18 | 
    end  | 
|
| 19 | 
    end  | 
|
| 20 | 
    alias_method_chain :type_cast, :correct_date_handling  | 
|
| 21 | ||
| 22 | 
    def type_cast_code_with_correct_date_handling(var_name)  | 
|
| 23 | 
    case type  | 
|
| 24 | 
    when :datetime, :time  | 
|
| 25 | 
            "JdbcSpec::SQLite3::Column.cast_to_time(#{var_name})"
   | 
|
| 26 | 
    when :date  | 
|
| 27 | 
            "JdbcSpec::SQLite3::Column.cast_to_date(#{var_name})"
   | 
|
| 28 | 
    else  | 
|
| 29 | 
    type_cast_code_without_correct_date_handling(var_name)  | 
|
| 30 | 
    end  | 
|
| 31 | 
    end  | 
|
| 32 | 
    alias_method_chain :type_cast_code, :correct_date_handling  | 
|
| 33 | ||
| 34 | 
    def self.cast_to_date(value)  | 
|
| 35 | 
    return value if value.is_a? Date  | 
|
| 36 | 
    time = cast_to_time(value)  | 
|
| 37 | 
    Date.new(time.year, time.month, time.day)  | 
|
| 38 | 
    end  | 
|
| 39 | 
    end  | 
|
| 40 | 
     | 
|
| 41 | 
    ::JdbcSpec::SQLite3.class_eval do  | 
|
| 42 | 
    def quote_with_date_support(value, column = nil)  | 
|
| 43 | 
    if value.respond_to?(:to_date) && column && column.type == :date  | 
|
| 44 | 
    quote_without_date_support(value.to_date, column)  | 
|
| 45 | 
    else  | 
|
| 46 | 
    quote_without_date_support(value, column)  | 
|
| 47 | 
    end  | 
|
| 48 | 
    end  | 
|
| 49 | 
    alias_method_chain :quote, :date_support  | 
|
| 50 | 
    end  | 
|
| 51 | 
    end  | 
|
| lib/redcloth3.rb | ||
|---|---|---|
| 384 | 384 | 
    (?::(\S+?))?  | 
| 385 | 385 | 
    (\w|[^\s\-].*?[^\s\-])  | 
| 386 | 386 | 
                    #{rcq}
   | 
| 387 | 
    (?=[[:punct:]]|\s|\)|$)/x  | 
|
| 387 | 
                    (?=[[:punct:]]|<|\s|\)|$)/x
   | 
|
| 388 | 388 | 
    else  | 
| 389 | 389 | 
                    /(#{rcq})
   | 
| 390 | 390 | 
                    (#{C})
   | 
| lib/redmine/scm/adapters/abstract_adapter.rb | ||
|---|---|---|
| 190 | 190 | 
    begin  | 
| 191 | 191 | 
    IO.popen(cmd, "r+") do |io|  | 
| 192 | 192 | 
    io.close_write  | 
| 193 | 
    block.call(io) if block_given?  | 
|
| 193 | 
    if block_given?  | 
|
| 194 | 
    block.call(io)  | 
|
| 195 | 
    while(io.gets); end  | 
|
| 196 | 
    end  | 
|
| 194 | 197 | 
    end  | 
| 195 | 198 | 
    rescue Errno::ENOENT => e  | 
| 196 | 199 | 
    msg = strip_credential(e.message)  | 
| lib/redmine/themes.rb | ||
|---|---|---|
| 54 | 54 | 
    private  | 
| 55 | 55 | 
     | 
| 56 | 56 | 
    def self.scan_themes  | 
| 57 | 
          dirs = Dir.glob("#{RAILS_ROOT}/public/themes/*").select do |f|
   | 
|
| 57 | 
          dirs = Dir.glob("#{Rails.public_path}/themes/*").select do |f|
   | 
|
| 58 | 58 | 
    # A theme should at least override application.css  | 
| 59 | 59 | 
            File.directory?(f) && File.exist?("#{f}/stylesheets/application.css")
   | 
| 60 | 60 | 
    end  | 
| lib/tasks/jdbc.rake | ||
|---|---|---|
| 1 | 
    # This file was generated by the "jdbc" generator, which is provided  | 
|
| 2 | 
    # by the activerecord-jdbc-adapter gem.  | 
|
| 3 | 
    #  | 
|
| 4 | 
    # This file allows you to use Rails' various db:* tasks with JDBC.  | 
|
| 5 | 
    if defined?(JRUBY_VERSION)  | 
|
| 6 | 
    require 'jdbc_adapter'  | 
|
| 7 | 
    require 'jdbc_adapter/rake_tasks'  | 
|
| 8 | 
    end  | 
|
| test/functional/timelog_controller_test.rb | ||
|---|---|---|
| 111 | 111 | 
        t = TimeEntry.find_by_comments('Some work on TimelogControllerTest')
   | 
| 112 | 112 | 
    assert_not_nil t  | 
| 113 | 113 | 
    assert_equal 11, t.activity_id  | 
| 114 | 
        assert_equal 7.3, t.hours
   | 
|
| 114 | 
        assert_equal '7.3', '%.1f' % t.hours
   | 
|
| 115 | 115 | 
    assert_equal 3, t.user_id  | 
| 116 | 116 | 
    assert_equal i, t.issue  | 
| 117 | 117 | 
    assert_equal i.project, t.project  | 
| test/test_helper.rb | ||
|---|---|---|
| 75 | 75 | 
    yield  | 
| 76 | 76 | 
        saved_settings.each {|k, v| Setting[k] = v}
   | 
| 77 | 77 | 
    end  | 
| 78 | ||
| 79 | 
    def self.find_executable(name)  | 
|
| 80 | 
    ENV['PATH'].split(File::PATH_SEPARATOR).detect do |p|  | 
|
| 81 | 
    File.executable?(File.join(p, name))  | 
|
| 82 | 
    end  | 
|
| 83 | 
    end  | 
|
| 78 | 84 | 
    end  | 
| test/unit/changeset_test.rb | ||
|---|---|---|
| 129 | 129 | 
    end  | 
| 130 | 130 | 
     | 
| 131 | 131 | 
    def test_invalid_utf8_sequences_in_comments_should_be_stripped  | 
| 132 | 
    if defined?(JRUBY_VERSION) and # only in JRuby  | 
|
| 133 | 
               (!Gem::Version.correct?('1.5.0.RC1') or # following version check works only in Rubygems >= 1.3.6 - shipped with JRuby > 1.4.x
   | 
|
| 134 | 
                Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('1.5.0.RC1'))
   | 
|
| 135 | 
    puts "JRuby's Iconv //IGNORE support is insufficient before 1.5.0.RC1"  | 
|
| 136 | 
    return  | 
|
| 137 | 
    end  | 
|
| 132 | 138 | 
    c = Changeset.new  | 
| 133 | 139 | 
        c.comments = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
   | 
| 134 | 140 | 
    assert_equal "Texte encod en ISO-8859-1.", c.comments  | 
| test/unit/subversion_adapter_test.rb | ||
|---|---|---|
| 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 | 
    require 'mkmf'  | 
|
| 19 | ||
| 20 | 18 | 
    require File.dirname(__FILE__) + '/../test_helper'  | 
| 21 | 19 | |
| 22 | 20 | 
    class SubversionAdapterTest < ActiveSupport::TestCase  | 
| 23 | 
     | 
|
| 24 | 
      if find_executable0('svn')
   | 
|
| 21 | ||
| 22 | 
      if find_executable('svn')
   | 
|
| 25 | 23 | 
    def test_client_version  | 
| 26 | 24 | 
    v = Redmine::Scm::Adapters::SubversionAdapter.client_version  | 
| 27 | 25 | 
    assert v.is_a?(Array)  | 
| vendor/plugins/engines/lib/engines.rb | ||
|---|---|---|
| 48 | 48 | 
    # The name of the public directory to mirror public engine assets into.  | 
| 49 | 49 | 
    # Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>.  | 
| 50 | 50 | 
    mattr_accessor :public_directory  | 
| 51 | 
      self.public_directory = File.join(RAILS_ROOT, 'public', 'plugin_assets')
   | 
|
| 51 | 
      self.public_directory = File.join(Rails.public_path, 'plugin_assets')
   | 
|
| 52 | 52 | |
| 53 | 53 | 
    # The table in which to store plugin schema information. Defaults to  | 
| 54 | 54 | 
    # "plugin_schema_info".  |