Project

General

Profile

Patch #5404 » 5404_fix_redmine_on_jruby_trunk.diff

Gregor Schmidt, 2010-04-29 20:21

View differences:

app/helpers/timelog_helper.rb
if value.to_s.empty?
data.select {|row| row[criteria].blank? }
else
data.select {|row| row[criteria] == value}
data.select {|row| row[criteria].to_s == value.to_s}
end
end
app/models/workflow.rb
trackers.each do |tracker|
t = []
roles.each do |role|
row = counts.detect {|c| c['role_id'] == role.id.to_s && c['tracker_id'] == tracker.id.to_s}
row = counts.detect {|c| c['role_id'].to_s == role.id.to_s && c['tracker_id'].to_s == tracker.id.to_s}
t << [role, (row.nil? ? 0 : row['c'].to_i)]
end
result << [tracker, t]
config/initializers/jdbc.rb
# This file was generated by the "jdbc" generator, which is provided
# by the activerecord-jdbc-adapter gem.
#
# This file allows the JDBC drivers to be hooked into ActiveRecord
# such that you don't have to change anything else in your Rails
# application.
require 'jdbc_adapter' if defined?(JRUBY_VERSION)
config/initializers/jruby_compat.rb
if defined?(JRUBY_VERSION)
::JdbcSpec::PostgreSQL.class_eval do
def table_alias_length
@table_alias_length ||= (postgresql_version >= 80000 ? select_one('SHOW max_identifier_length')['max_identifier_length'].to_i : 63)
end
end
::JdbcSpec::SQLite3::Column.class_eval do
def type_cast_with_correct_date_handling(value)
return nil if value.nil?
case type
when :datetime, :time
JdbcSpec::SQLite3::Column.cast_to_time(value)
when :date
JdbcSpec::SQLite3::Column.cast_to_date(value)
else
type_cast_without_correct_date_handling(value)
end
end
alias_method_chain :type_cast, :correct_date_handling
def type_cast_code_with_correct_date_handling(var_name)
case type
when :datetime, :time
"JdbcSpec::SQLite3::Column.cast_to_time(#{var_name})"
when :date
"JdbcSpec::SQLite3::Column.cast_to_date(#{var_name})"
else
type_cast_code_without_correct_date_handling(var_name)
end
end
alias_method_chain :type_cast_code, :correct_date_handling
def self.cast_to_date(value)
return value if value.is_a? Date
time = cast_to_time(value)
Date.new(time.year, time.month, time.day)
end
end
::JdbcSpec::SQLite3.class_eval do
def quote_with_date_support(value, column = nil)
if value.respond_to?(:to_date) && column && column.type == :date
quote_without_date_support(value.to_date, column)
else
quote_without_date_support(value, column)
end
end
alias_method_chain :quote, :date_support
end
end
lib/redcloth3.rb
(?!\-\-)
#{rcq}
(#{QTAGS_JOIN}|) # oqa
(?=[[:punct:]]|\s|\)|$)/x
(?=[[:punct:]]|<|\s|\)|$)/x
else
/(#{rcq})
(#{C})
lib/redmine/scm/adapters/abstract_adapter.rb
begin
IO.popen(cmd, "r+") do |io|
io.close_write
block.call(io) if block_given?
if block_given?
block.call(io)
while(io.gets); end
end
end
rescue Errno::ENOENT => e
msg = strip_credential(e.message)
lib/redmine/themes.rb
private
def self.scan_themes
dirs = Dir.glob("#{RAILS_ROOT}/public/themes/*").select do |f|
dirs = Dir.glob("#{Rails.public_path}/themes/*").select do |f|
# A theme should at least override application.css
File.directory?(f) && File.exist?("#{f}/stylesheets/application.css")
end
lib/tasks/jdbc.rake
# This file was generated by the "jdbc" generator, which is provided
# by the activerecord-jdbc-adapter gem.
#
# This file allows you to use Rails' various db:* tasks with JDBC.
if defined?(JRUBY_VERSION)
require 'jdbc_adapter'
require 'jdbc_adapter/rake_tasks'
end
test/functional/timelog_controller_test.rb
t = TimeEntry.find_by_comments('Some work on TimelogControllerTest')
assert_not_nil t
assert_equal 11, t.activity_id
assert_equal 7.3, t.hours
assert_equal '7.3', '%.1f' % t.hours
assert_equal 3, t.user_id
assert_equal i, t.issue
assert_equal i.project, t.project
test/test_helper.rb
return nil
end
def self.find_executable(name)
ENV['PATH'].split(File::PATH_SEPARATOR).detect do |p|
File.executable?(File.join(p, name))
end
end
# Shoulda macros
def self.should_render_404
should_respond_with :not_found
test/unit/changeset_test.rb
end
def test_invalid_utf8_sequences_in_comments_should_be_stripped
if defined?(JRUBY_VERSION) and # only in JRuby
(!Gem::Version.correct?('1.5.0.RC1') or # following version check works only in Rubygems >= 1.3.6 - shipped with JRuby > 1.4.x
Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('1.5.0.RC1'))
puts "JRuby's Iconv //IGNORE support is insufficient before 1.5.0.RC1"
return
end
c = Changeset.new
c.comments = File.read("#{RAILS_ROOT}/test/fixtures/encoding/iso-8859-1.txt")
assert_equal "Texte encod en ISO-8859-1.", c.comments
test/unit/lib/redmine/scm/adapters/subversion_adapter_test.rb
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'mkmf'
require File.dirname(__FILE__) + '/../../../../../test_helper'
class SubversionAdapterTest < ActiveSupport::TestCase
if find_executable0('svn')
if find_executable('svn')
def test_client_version
v = Redmine::Scm::Adapters::SubversionAdapter.client_version
assert v.is_a?(Array)
vendor/plugins/engines/lib/engines.rb
# The name of the public directory to mirror public engine assets into.
# Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>.
mattr_accessor :public_directory
self.public_directory = File.join(RAILS_ROOT, 'public', 'plugin_assets')
self.public_directory = File.join(Rails.public_path, 'plugin_assets')
# The table in which to store plugin schema information. Defaults to
# "plugin_schema_info".
(2-2/3)