Merge remote-tracking branch 'upstream/master' into unstable
This commit is contained in:
commit
3a16f3f5b1
|
@ -31,7 +31,7 @@ class Change < ActiveRecord::Base
|
|||
|
||||
def from_path
|
||||
# TODO: shouldn't access Changeset#to_utf8 directly
|
||||
self.path = Changeset.to_utf8(read_attribute(:from_path), changeset_repository_encoding)
|
||||
self.from_path = Changeset.to_utf8(read_attribute(:from_path), changeset_repository_encoding)
|
||||
end
|
||||
|
||||
def init_path
|
||||
|
|
|
@ -405,6 +405,11 @@ class Issue < ActiveRecord::Base
|
|||
!due_date.nil? && (due_date < Date.today) && !status.is_closed?
|
||||
end
|
||||
|
||||
# Returns true if the issue is due today and not closed
|
||||
def due_today?
|
||||
!due_date.nil? && (due_date == Date.today) && !status.is_closed?
|
||||
end
|
||||
|
||||
# Is the amount of work done less than it should for the due date
|
||||
def behind_schedule?
|
||||
return false if start_date.nil? || due_date.nil?
|
||||
|
@ -560,6 +565,7 @@ class Issue < ActiveRecord::Base
|
|||
s = "issue status-#{status.position} priority-#{priority.position}"
|
||||
s << ' closed' if closed?
|
||||
s << ' overdue' if overdue?
|
||||
s << ' due-today' if due_today?
|
||||
s << ' child' if child?
|
||||
s << ' parent' unless leaf?
|
||||
s << ' created-by-me' if User.current.logged? && author_id == User.current.id
|
||||
|
|
|
@ -72,6 +72,9 @@ Rails::Initializer.run do |config|
|
|||
# It will automatically turn deliveries on
|
||||
config.action_mailer.perform_deliveries = false
|
||||
|
||||
# Insert vendor/chiliproject_plugins at the top of the plugin load paths
|
||||
config.plugin_paths.insert(0, File.join(Rails.root, "vendor", "chiliproject_plugins"))
|
||||
|
||||
# Use redmine's custom plugin locater
|
||||
require File.join(RAILS_ROOT, "lib/redmine_plugin_locator")
|
||||
config.plugin_locators << RedminePluginLocator
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
# See doc/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
# Patches active_support/core_ext/load_error.rb to support 1.9.3 LoadError message
|
||||
if RUBY_VERSION >= '1.9.3'
|
||||
MissingSourceFile::REGEXPS << [/^cannot load such file -- (.+)$/i, 1]
|
||||
end
|
||||
|
||||
require 'active_record'
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
#-- encoding: UTF-8
|
||||
#-- copyright
|
||||
# ChiliProject is a project management system.
|
||||
|
@ -12,8 +13,6 @@
|
|||
# See doc/COPYRIGHT.rdoc for more details.
|
||||
#++
|
||||
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# == Synopsis
|
||||
#
|
||||
# Reads an email from standard input and forward it to a Redmine server
|
||||
|
|
|
@ -38,11 +38,13 @@ module ChiliProject
|
|||
end
|
||||
|
||||
def self.revision
|
||||
revision = `git rev-parse HEAD`
|
||||
if revision.present?
|
||||
revision.strip[0..8]
|
||||
else
|
||||
nil
|
||||
@revision ||= begin
|
||||
git = Redmine::Scm::Adapters::GitAdapter
|
||||
git_dir = Rails.root.join('.git')
|
||||
|
||||
if File.directory? git_dir
|
||||
git.send(:shellout, "#{git.sq_bin} --git-dir='#{git_dir}' rev-parse --short=9 HEAD") { |io| io.read }.to_s.chomp
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -19,10 +19,10 @@ module Redmine
|
|||
module Adapters
|
||||
class GitAdapter < AbstractAdapter
|
||||
|
||||
SCM_GIT_REPORT_LAST_COMMIT = true
|
||||
SCM_GIT_REPORT_LAST_COMMIT = true unless defined?(SCM_GIT_REPORT_LAST_COMMIT)
|
||||
|
||||
# Git executable name
|
||||
GIT_BIN = Redmine::Configuration['scm_git_command'] || "git"
|
||||
GIT_BIN = Redmine::Configuration['scm_git_command'] || "git" unless defined?(GIT_BIN)
|
||||
|
||||
# raised if scm command exited with error, e.g. unknown revision.
|
||||
class ScmCommandAborted < CommandFailed; end
|
||||
|
@ -176,7 +176,7 @@ module Redmine
|
|||
from_to << "#{identifier_from}.." if identifier_from
|
||||
from_to << "#{identifier_to}" if identifier_to
|
||||
cmd_args << from_to if !from_to.empty?
|
||||
cmd_args << "--since=#{options[:since].strftime("%Y-%m-%d %H:%M:%S")}" if options[:since]
|
||||
cmd_args << "--since='#{options[:since].strftime("%Y-%m-%d %H:%M:%S")}'" if options[:since]
|
||||
cmd_args << "--" << scm_iconv(@path_encoding, 'UTF-8', path) if path && !path.empty?
|
||||
|
||||
scm_cmd *cmd_args do |io|
|
||||
|
|
|
@ -115,4 +115,29 @@ class JournalTest < ActiveSupport::TestCase
|
|||
assert_equal "Test setting fields on Journal from Issue", @issue.last_journal.notes
|
||||
assert_equal @issue.author, @issue.last_journal.user
|
||||
end
|
||||
|
||||
test "subclasses of journaled models should have journal of parent type" do
|
||||
Ticket = Class.new(Issue)
|
||||
|
||||
project = Project.generate!
|
||||
ticket = Ticket.new do |t|
|
||||
t.project = project
|
||||
t.subject = "Test initial journal"
|
||||
t.tracker = project.trackers.first
|
||||
t.author = User.generate!
|
||||
t.description = "Some content"
|
||||
end
|
||||
|
||||
begin
|
||||
oldstdout = $stdout
|
||||
$stdout = StringIO.new
|
||||
ticket.save!
|
||||
assert $stdout.string.empty?, "No errors should be logged to stdout."
|
||||
ensure
|
||||
$stdout = oldstdout
|
||||
end
|
||||
|
||||
journal = ticket.journals.first
|
||||
assert_equal IssueJournal, journal.class
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Install ChiliProject plugins here and they will be automatically loaded.
|
|
@ -32,6 +32,10 @@ module Redmine
|
|||
end
|
||||
|
||||
module ClassMethods
|
||||
attr_writer :journal_class_name
|
||||
def journal_class_name
|
||||
defined?(@journal_class_name) ? @journal_class_name : superclass.journal_class_name
|
||||
end
|
||||
|
||||
def plural_name
|
||||
self.name.underscore.pluralize
|
||||
|
@ -55,6 +59,8 @@ module Redmine
|
|||
def acts_as_journalized(options = {}, &block)
|
||||
activity_hash, event_hash, journal_hash = split_option_hashes(options)
|
||||
|
||||
self.journal_class_name = journal_hash.delete(:class_name) || "#{name.gsub("::", "_")}Journal"
|
||||
|
||||
acts_as_activity(activity_hash)
|
||||
|
||||
return if journaled?
|
||||
|
@ -77,13 +83,13 @@ module Redmine
|
|||
|
||||
(journal_hash[:except] ||= []) << self.primary_key << inheritance_column <<
|
||||
:updated_on << :updated_at << :lock_version << :lft << :rgt
|
||||
|
||||
prepare_journaled_options(journal_hash)
|
||||
has_many :journals, journal_hash.merge({:class_name => journal_class.name,
|
||||
:foreign_key => "journaled_id"}), &block
|
||||
|
||||
has_many :journals, journal_hash, &block
|
||||
end
|
||||
|
||||
def journal_class
|
||||
journal_class_name = "#{name.gsub("::", "_")}Journal"
|
||||
if Object.const_defined?(journal_class_name)
|
||||
Object.const_get(journal_class_name)
|
||||
else
|
||||
|
|
|
@ -63,11 +63,12 @@ module Redmine::Acts::Journalized
|
|||
options.symbolize_keys!
|
||||
options.reverse_merge!(Configuration.options)
|
||||
options.reverse_merge!(
|
||||
:class_name => 'Journal',
|
||||
:dependent => :delete_all
|
||||
:class_name => journal_class_name,
|
||||
:dependent => :delete_all,
|
||||
:foreign_key => "journaled_id"
|
||||
)
|
||||
options.reverse_merge!(
|
||||
:order => "#{options[:class_name].constantize.table_name}.version ASC"
|
||||
:order => "#{journal_class.table_name}.version ASC"
|
||||
)
|
||||
|
||||
class_inheritable_accessor :vestal_journals_options
|
||||
|
|
Loading…
Reference in New Issue