退役SEのつれづれ日記

定年退役SEが、つれづれなる想いをしたためています。
(旧名:『システムノヲニワソト』)

[redmine][plugin]redimne_issue_todo_listsの導入と検証

2018-12-05 | Weblog
redimne_issue_todo_listsを導入してみました。
このpluginは、いくつかのチケット(issue)を纏めて管理するもののようで、
親子関係だけの管理では無く複数をまとめられる点が良いかもしれません。
では、まず紹介サイトとソースを。
(参考)
https://www.redmine.org/plugins/redmine_issue_todo_lists
https://github.com/canidas/redmine_issue_todo_lists
日本語の情報は少ないです。
早速導入してみます。
[root@hogehoge /]# docker exec -it redmine-container /bin/bash
[root@ac214042296a /]# cd /opt/redmine/apps/redmine/htdocs/plugins/
[root@ac214042296a plugins]# git clone https://github.com/canidas/redmine_issue_todo_lists.git
Cloning into 'redmine_issue_todo_lists'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 182 (delta 0), reused 5 (delta 0), pack-reused 175
Receiving objects: 100% (182/182), 98.46 KiB | 489.00 KiB/s, done.
Resolving deltas: 100% (79/79), done.
[root@ac214042296a plugins]# export PATH=$PATH:/opt/redmine/ruby/bin
[root@ac214042296a plugins]# export RAILS_ENV=production
[root@ac214042296a plugins]# cd ..
[root@ac214042296a htdocs]# bundle exec rake --trace redmine:plugins:migrate NAME=redmine_issue_todo_lists
/opt/redmine/apps/redmine/htdocs/plugins/redmine_glossary/init.rb:6: warning: already initialized constant FCSV
/opt/redmine/apps/redmine/htdocs/plugins/redmine_contacts/init.rb:29: warning: previous definition of FCSV was here
** Invoke redmine:plugins:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:plugins:migrate
Migrating redmine_issue_todo_lists (Issue To-do Lists Plugin)...
== 1 CreateTodoLists: migrating ===============================================
-- create_table(:issue_todo_lists)
   -> 0.1969s
-- create_table(:issue_todo_list_items)
   -> 0.0310s
== 1 CreateTodoLists: migrated (0.2290s) ======================================

== 2 RemoveClosedIssues: migrating ============================================
-- add_column(:issue_todo_lists, :remove_closed_issues, :boolean, {:default=>false, :null=>false})
   -> 0.0439s
== 2 RemoveClosedIssues: migrated (0.0441s) ===================================

== 3 ProjectIdentifierToId: migrating =========================================
-- add_column(:issue_todo_lists, :project_id, :integer, {:null=>true, :after=>:id})
   -> 0.0293s
-- execute("      UPDATE issue_todo_lists issue_todo_lists SET project_id = (\n        SELECT id FROM projects WHERE identifier = issue_todo_lists.project_identifier LIMIT 1\n      )\n")
   -> 0.0008s
-- remove_column(:issue_todo_lists, :project_identifier)
   -> 0.0312s
== 3 ProjectIdentifierToId: migrated (0.0801s) ================================

** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:schema:dump
[root@ac214042296a htdocs]# systemctl restart redmine

エラーは出ずに導入は終わりましたが、プラグインを有効にした後に画面遷移でエラー。
I, [2018-12-03T23:03:32.873753 #28350]  INFO -- : Started GET "/redmine/projects/docker-project/issues" for 121.103.46.192 at 2018-12-03 23:03:32 +0900
I, [2018-12-03T23:03:32.878085 #28350]  INFO -- : Processing by IssuesController#index as HTML
・・・
I, [2018-12-03T23:03:35.100669 #28350]  INFO -- : Completed 500 Internal Server Error in 2222ms (ActiveRecord: 26.0ms)
F, [2018-12-03T23:03:35.105037 #28350] FATAL -- :
ActionView::Template::Error (undefined method `array_of_issue_tags?' for #<#:0x00007f5a37b05a48>):
    31:   <% end %>
    32:   " class="hascontextmenu <%= cycle('odd', 'even') %> <%= issue.css_classes %> <%= level > 0 ? "idnt idnt-#{level}" : nil %>">
    33:     <%= check_box_tag("ids[]", issue.id, false, :id => nil) %>
    34:     <% query.inline_columns.each do |column| %>
    35:     <%= content_tag('td', column_content(column, issue), :class => column.css_classes) %>
    36:     <% end %>
    37:   
  plugins/redmine_tagging/lib/redmine_tagging/patches/queries_helper_patch.rb:11:in `column_content_with_tags'
  app/views/issues/_list.html.erb:34:in `block (3 levels) in _app_views_issues__list_html_erb__705215416691266827_70012618638540'
  app/views/issues/_list.html.erb:33:in `each'
・・・
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

ここからが大変でした。
Google先生に聞いてみたものの、質問のページが二個ほど検索で引っかかる程度で、
何らヒントもありませんでした。
そこで、ダメもとで飛ばしているステップを実行してみました。
 bundle install/db:migrate/db:migrate_plugins
[root@ac214042296a htdocs]# bundle install --no-deployment --without development test postgresql sqlite
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Your Gemfile lists the gem redmine_crm (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Fetching gem metadata from http://rubygems.org/..............
・・・
Using redmine_extensions 0.2.12
Bundle complete! 51 Gemfile dependencies, 74 gems now installed.
Gems in the groups development, test, postgresql and sqlite were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
[root@ac214042296a htdocs]# bundle exec rake --trace db:migrate
/opt/redmine/apps/redmine/htdocs/plugins/redmine_glossary/init.rb:6: warning: already initialized constant FCSV
/opt/redmine/apps/redmine/htdocs/plugins/redmine_contacts/init.rb:29: warning: previous definition of FCSV was here
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20161220091118 AddIndexOnIssuesParentId: migrating =========================
-- add_index(:issues, :parent_id)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:

Index name 'index_issues_on_parent_id' on table 'issues' already exists
/opt/redmine/ruby/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:954:in `add_index_options'
・・・
/opt/redmine/ruby/bin/bundle:23:in `load'
/opt/redmine/ruby/bin/bundle:23:in `<main>'

Caused by:
ArgumentError: Index name 'index_issues_on_parent_id' on table 'issues' already exists
/opt/redmine/ruby/lib/ruby/gems/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:954:in `add_index_options'
・・・
/opt/redmine/ruby/bin/bundle:23:in `load'
/opt/redmine/ruby/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
Install missing gem executables with `bundle install`
[root@ac214042296a htdocs]# bundle exec rake --trace db:migrate_plugins
/opt/redmine/apps/redmine/htdocs/plugins/redmine_glossary/init.rb:6: warning: already initialized constant FCSV
/opt/redmine/apps/redmine/htdocs/plugins/redmine_contacts/init.rb:29: warning: previous definition of FCSV was here
** Invoke db:migrate_plugins (first_time)
** Invoke redmine:plugins:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute redmine:plugins:migrate
・・・
Migrating redmine_issue_todo_lists (Issue To-do Lists Plugin)...
・・・
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:schema:dump
** Execute db:migrate_plugins

Note: The rake task db:migrate_plugins has been deprecated, please use the replacement version redmine:plugins:migrate
[root@ac214042296a htdocs]# systemctl restart redmine

結果、なんとか動いてくれています。

(参考画面)
https://github.com/canidas/redmine_issue_todo_lists/tree/master/screenshots
チケットの上下の移動はできますが、コンテキストメニューは表示できていません。

(実行結果)