kulesa / redmine_better_gantt_chart

Better Gantt Chart for Redmine
194 stars 89 forks source link

Is the gantt_chart compatible with activesupport-4.2.0? #120

Open hpduy17 opened 9 years ago

hpduy17 commented 9 years ago

I have upgraded my redmine to lastest version(3.0.1). Bundle have installed 'activesupport-4.2.0' , but when I run the command 'rake db:migrate RAILS_ENV=production' , It response:

LoadError: cannot load such file -- active_support/basic_object /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:inblock in require' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in load_dependency' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:inrequire' /home/redmine/redmine-3.0.1/plugins/redmine_better_gantt_chart/lib/redmine_better_gantt_chart/active_record/callback_extensions_for_rails3.rb:1:in <top (required)>' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:inrequire' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in block in require' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:inload_dependency' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:360:inrequire_or_load' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:494:in load_missing_constant' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:184:inconst_missing' /home/redmine/redmine-3.0.1/plugins/redmine_better_gantt_chart/init.rb:8:in block in <top (required)>' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:441:ininstance_exec' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:441:in block in make_lambda' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:189:incall' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:189:in block in simple' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:190:incall' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:190:in block in simple' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:incall' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:92:in _run_callbacks' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:734:in_run_prepare_callbacks' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/callbacks.rb:81:in run_callbacks' /home/redmine/.gem/ruby/1.9.1/gems/actionpack-4.2.0/lib/action_dispatch/middleware/reloader.rb:83:inprepare!' /home/redmine/.gem/ruby/1.9.1/gems/actionpack-4.2.0/lib/action_dispatch/middleware/reloader.rb:55:in prepare!' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/application/finisher.rb:50:inblock in module:Finisher' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:30:in instance_exec' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:30:inrun' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:55:in block in run_initializers' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/initializable.rb:54:inrun_initializers' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/application.rb:352:in initialize!' /home/redmine/redmine-3.0.1/config/environment.rb:14:in<top (required)>' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in require' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:inblock in require' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in load_dependency' /home/redmine/.gem/ruby/1.9.1/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:inrequire' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/application.rb:328:in require_environment!' /home/redmine/.gem/ruby/1.9.1/gems/railties-4.2.0/lib/rails/application.rb:443:inblock in run_tasks_blocks' Tasks: TOP => db:migrate => environment

yonisolo commented 9 years ago

I have quite the same issue witjh redmine 2.5, here is my stack trace: LoadError: cannot load such file -- active_support/basic_object /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:in require' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:inblock in require' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:232:in load_dependency' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:inrequire' /usr/share/redmine/plugins/redmine_better_gantt_chart/lib/redmine_better_gantt_chart/active_record/callback_extensions_for_rails3.rb:1:in <top (required)>' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:inrequire' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:in block in require' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:232:inload_dependency' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:in require' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:348:inrequire_or_load' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:480:in load_missing_constant' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:180:inconst_missing' /usr/share/redmine/plugins/redmine_better_gantt_chart/init.rb:8:in block in <top (required)>' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:443:ininstance_exec' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:443:in block in make_lambda' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:187:incall' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:187:in block in simple' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:501:incall' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:501:in block in call' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:501:ineach' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:501:in call' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/callbacks.rb:86:inrun_callbacks' /var/lib/gems/2.1.0/gems/actionpack-4.1.13/lib/action_dispatch/middleware/reloader.rb:83:in prepare!' /var/lib/gems/2.1.0/gems/actionpack-4.1.13/lib/action_dispatch/middleware/reloader.rb:55:inprepare!' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/application/finisher.rb:52:in block in <module:Finisher>' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/initializable.rb:30:ininstance_exec' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/initializable.rb:30:in run' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/initializable.rb:55:inblock in run_initializers' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/initializable.rb:54:in run_initializers' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/application.rb:300:ininitialize!' /usr/share/redmine/config/environment.rb:14:in <top (required)>' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:inrequire' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:in block in require' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:232:inload_dependency' /var/lib/gems/2.1.0/gems/activesupport-4.1.13/lib/active_support/dependencies.rb:247:in require' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/application.rb:276:inrequire_environment!' /var/lib/gems/2.1.0/gems/railties-4.1.13/lib/rails/application.rb:405:in `block in run_tasks_blocks' Tasks: TOP => redmine:plugins:migrate => environment

i used the debian 8.1 default package Environment: Redmine version 2.5.2.devel Ruby version 2.1.5-p273 (2014-11-13) [x86_64-linux-gnu] Rails version 4.1.13 Environment production Database adapter Mysql2

Since i saw that someone manage to run this plugin with my redmine version what's wrong with this?

oklas commented 9 years ago

Hi! This error simple fixed with the next patch. But more errors and incompatibilies there. patch:

diff --git a/lib/redmine_better_gantt_chart/active_record/callback_extensions_for_rails3.rb b/lib/redmine_better_gantt_chart/active_record/callback_extensions_for_rails3.rb
index 8ef7de1..7c6913b 100755
--- a/lib/redmine_better_gantt_chart/active_record/callback_extensions_for_rails3.rb
+++ b/lib/redmine_better_gantt_chart/active_record/callback_extensions_for_rails3.rb
@@ -1,8 +1,6 @@
-require 'active_support/basic_object'
-
 module RedmineBetterGanttChart
   module ActiveRecord
-    class WithoutCallbacks < ActiveSupport::BasicObject
+    class WithoutCallbacks < ::BasicObject
       def initialize(target, types)
         @target = target
         @types  = types

The errors descriptions is not show function names with wrong number of arguments. Errors like this:

Started GET "/projects/host/issues/gantt" for 192.168.0.2 at 2015-10-06 20:10:25 +0000
Processing by GanttsController#show as HTML
  Parameters: {"project_id"=>"host"}
  Current user: admin (id=1)
  Rendered queries/_filters.html.erb (16.0ms)
  Rendered plugins/redmine_better_gantt_chart/app/views/gantts/show.html.erb within layouts/base (62.1ms)
Completed 500 Internal Server Error in 118ms (ActiveRecord: 24.2ms)
ActionView::Template::Error (wrong number of arguments (1 for 0)):
    65: 
    66:   # Width of the entire chart
    67:   g_width = ((@gantt.work_days_in(@gantt.date_to, @gantt.date_from) + 1) * zoom).to_i
    68:   @gantt.render(:top => headers_height + 8,
    69:                 :zoom => zoom,
    70:                 :g_width => g_width,
    71:                 :subject_width => subject_width)
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'
rtwo commented 9 years ago

I could get it to "work" with the following change on top of #121

diff --git a/lib/redmine/helpers/better_gantt.rb b/lib/redmine/helpers/better_gantt.rb
index 23620d7..ca202f0 100755
--- a/lib/redmine/helpers/better_gantt.rb
+++ b/lib/redmine/helpers/better_gantt.rb
@@ -157,11 +157,9 @@ module Redmine
         ids = issues.collect(&:project).uniq.collect(&:id)
         if ids.any?
           # All issues projects and their visible ancestors
-          @projects = Project.visible.all(
-            :joins => "LEFT JOIN #{Project.table_name} child ON #{Project.table_name}.lft <= child.lft AND #
-            :conditions => ["child.id IN (?)", ids],
-            :order => "#{Project.table_name}.lft ASC"
-          ).uniq
+          @projects = Project.visible.joins("LEFT JOIN #{Project.table_name} child ON #{Project.table_name}.
+          .where("child.id in (?)", ids)
+          .order("#{Project.table_name}.lft ASC")
         else
           @projects = []
         end

I am not sure if this is still doing the same thing though. (And I am just noticing that I forgot the uniq)

rdzsjpr commented 7 years ago

I managed to get the plugin to work on Kubuntu 16.04 with the suggestions by rtwo. I first followed the #121 link and applied all the changes there, then I did the chages suggested br rtwo in his post, above. Thanks a lot!!!

comur commented 6 years ago

Hi, I also did the same to be able to install this plugin but I also had to replace a deprecated function called completed_pourcent by completed_percent in plugins/redmine_better_gantt_chart/lib/redmine/helpers/better_gantt.rb