redmine_remotes 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 62c2b4e39207c1cdbbbb7d6301abf487701667adc2d4b60bb9fca0a8bc7fd1ab
4
+ data.tar.gz: 83288f88850022c0edd4f0e06df5e9b8b7554988d0c1c9861cb4bfafcd6777c5
5
+ SHA512:
6
+ metadata.gz: 2b53804b5da56c2da06dc668ed47f72b15686b8510634c7056c27fe2e9096db0b98b2d139a612a6b07bbf46f5ad9a8c2852c38b8d9ec09e853156e0e7d848e4d
7
+ data.tar.gz: bbd2c9d1b0c691d78aabe9cf571a0b1ef0a836506826eedb1128ae3f3b4e5781642ee42f31fc6853506df730cbf82fcd8345fe01c01d79f5cb4aded2c51d107c
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoteIssueStatusesController < ApplicationController
4
+ READ_PERMISSION = 'remote_issue_status.read'
5
+ WRITE_PERMISSION = 'remote_issue_status.write'
6
+ PERMISSIONS = READ_PERMISSION
7
+
8
+ layout 'nonproject_modules'
9
+ require_permission PERMISSIONS
10
+
11
+ active_scaffold :remote_issue_status do |conf|
12
+ %i[remote_tracker local_tracker issue_status].each do |column|
13
+ conf.columns[column].form_ui = :select
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoteTrackersController < ApplicationController
4
+ READ_PERMISSION = 'remote_tracker.read'
5
+ WRITE_PERMISSION = 'remote_tracker.write'
6
+ PERMISSIONS = READ_PERMISSION
7
+
8
+ before_action :localize_options
9
+ layout 'nonproject_modules'
10
+ require_permission PERMISSIONS
11
+
12
+ active_scaffold :remote_tracker do |conf|
13
+ conf.columns = %i[profile root_url username password]
14
+ conf.columns[:password].form_ui = :password
15
+ conf.columns[:profile].form_ui = :select
16
+ %w[list show].each { |action| conf.send(action).columns.exclude :password }
17
+ end
18
+
19
+ private
20
+
21
+ def localize_options
22
+ active_scaffold_config.columns[:profile].options = {
23
+ options: ::RemoteTracker.lists.profile.options
24
+
25
+ }
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoteIssueStatus < ActiveRecord::Base
4
+ belongs_to :remote_tracker
5
+ belongs_to :local_tracker, class_name: 'Tracker'
6
+ belongs_to :issue_status
7
+
8
+ validates :remote_name, presence: true, uniqueness: { scope: %i[remote_tracker local_tracker] }
9
+ validates :remote_tracker, presence: true
10
+ validates :local_tracker, presence: true
11
+ validates :issue_status, presence: true
12
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/listable'
4
+
5
+ class RemoteTracker < ActiveRecord::Base
6
+ include ::EacRubyUtils::Listable
7
+
8
+ lists.add_string :profile, :stub
9
+
10
+ has_many :issue_statuses, class_name: 'RemoteIssueStatus', inverse_of: :remote_tracker,
11
+ dependent: :destroy
12
+
13
+ validates :profile, presence: true, inclusion: { in: lists.profile.values }
14
+ validates :root_url, presence: true, uniqueness: { scope: [:username] }
15
+ validates :username, presence: true
16
+ validates :password, presence: true
17
+
18
+ def to_s
19
+ "#{root_url} [#{profile_label}, #{username}]"
20
+ end
21
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ Redmine::Plugin.post_register ::RedmineRemotes::SLUG.to_sym do
4
+ # Source: https://github.com/esquilo-azul/redmine_nonproject_modules
5
+ requires_redmine_plugin(:redmine_nonproject_modules, version_or_higher: '0.2.1')
6
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'redmine_remotes/patches/issue_status'
4
+ require 'redmine_remotes/patches/tracker'
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ ::GroupPermission.add_permission(::RemoteTrackersController::READ_PERMISSION)
4
+ ::GroupPermission.add_permission(
5
+ ::RemoteTrackersController::WRITE_PERMISSION,
6
+ dependencies: [::RemoteTrackersController::READ_PERMISSION]
7
+ )
8
+ ::GroupPermission.add_permission(::RemoteIssueStatusesController::READ_PERMISSION)
9
+ ::GroupPermission.add_permission(
10
+ ::RemoteIssueStatusesController::WRITE_PERMISSION,
11
+ dependencies: [::RemoteIssueStatusesController::READ_PERMISSION]
12
+ )
13
+
14
+ Redmine::MenuManager.map ::RedmineRemotes::SLUG.to_sym do |menu|
15
+ menu.push_controller(:remote_trackers)
16
+ menu.push_controller(:remote_issue_statuses)
17
+ end
@@ -0,0 +1,9 @@
1
+ en:
2
+ eac_ruby_utils:
3
+ listable:
4
+ remote_tracker:
5
+ profile:
6
+ stub:
7
+ label: Stub profile
8
+ label_remote_trackers: Remote trackers
9
+ label_remote_issue_statuses: Remote issue statuses
@@ -0,0 +1,9 @@
1
+ pt-BR:
2
+ eac_ruby_utils:
3
+ listable:
4
+ remote_tracker:
5
+ profile:
6
+ stub:
7
+ label: Stub profile
8
+ label_remote_trackers: Trackers remotos
9
+ label_remote_issue_statuses: Situações de demandas remotas
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ RedmineApp::Application.routes.draw do
4
+ resources(:remote_trackers) { as_routes }
5
+ resources(:remote_issue_statuses) { as_routes }
6
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateRemoteTrackers < ActiveRecord::Migration
4
+ def change
5
+ create_table :remote_trackers do |t|
6
+ t.string :profile
7
+ t.string :root_url
8
+ t.string :username
9
+ t.string :password
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateRemoteIssueStatuses < ActiveRecord::Migration
4
+ def change
5
+ create_table :remote_issue_statuses do |t|
6
+ t.references :remote_tracker, index: true
7
+ t.references :local_tracker, index: true
8
+ t.string :remote_name
9
+ t.references :issue_status, index: true
10
+ end
11
+
12
+ add_foreign_key :remote_issue_statuses, :remote_trackers, column: :remote_tracker_id
13
+ add_foreign_key :remote_issue_statuses, :trackers, column: :local_tracker_id
14
+ add_foreign_key :remote_issue_statuses, :issue_statuses, column: :issue_status_id
15
+ end
16
+ end
data/init.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'redmine'
4
+
5
+ Redmine::Plugin.register ::RedmineRemotes::SLUG.to_sym do
6
+ name ::RedmineRemotes::NAME
7
+ author ::RedmineRemotes::AUTHOR
8
+ description ::RedmineRemotes::SUMMARY
9
+ version ::RedmineRemotes::VERSION
10
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRedmineUsability
4
+ module Patches
5
+ module IssueStatus
6
+ extend ::ActiveSupport::Concern
7
+
8
+ included do
9
+ has_many :remote_issue_status, class_name: 'RemoteIssueStatus', inverse_of: :issue_status,
10
+ dependent: :destroy
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ require_dependency 'issue_status'
17
+ patch = ::EacRedmineUsability::Patches::IssueStatus
18
+ target = ::IssueStatus
19
+ target.send(:include, patch) unless target.included_modules.include?(patch)
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EacRedmineUsability
4
+ module Patches
5
+ module Tracker
6
+ extend ::ActiveSupport::Concern
7
+
8
+ included do
9
+ has_many :remote_issue_status, class_name: 'RemoteIssueStatus', inverse_of: :local_tracker,
10
+ dependent: :destroy
11
+ end
12
+ end
13
+ end
14
+ end
15
+
16
+ require_dependency 'tracker'
17
+ patch = ::EacRedmineUsability::Patches::Tracker
18
+ target = ::Tracker
19
+ target.send(:include, patch) unless target.included_modules.include?(patch)
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RedmineRemotes
4
+ SLUG = 'redmine_remotes'
5
+ NAME = 'Redmine Remotes'
6
+ VERSION = '0.2.0'
7
+ AUTHOR = 'Eduardo Henrique Bogoni'
8
+ SUMMARY = 'Integração do Redmine com trackers diversos.'
9
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'redmine_remotes/version'
4
+
5
+ module RedmineRemotes
6
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redmine_remotes
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Eduardo Henrique Bogoni
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-09-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: eac_ruby_utils
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.10'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.10.1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.10'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.10.1
33
+ description:
34
+ email:
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - app/controllers/remote_issue_statuses_controller.rb
40
+ - app/controllers/remote_trackers_controller.rb
41
+ - app/models/remote_issue_status.rb
42
+ - app/models/remote_tracker.rb
43
+ - config/initializers/000_dependencies.rb
44
+ - config/initializers/001_patches.rb
45
+ - config/initializers/nonproject_modules.rb
46
+ - config/locales/en.yml
47
+ - config/locales/pt-BR.yml
48
+ - config/routes.rb
49
+ - db/migrate/20190531171641_create_remote_trackers.rb
50
+ - db/migrate/20190910203552_create_remote_issue_statuses.rb
51
+ - init.rb
52
+ - lib/redmine_remotes.rb
53
+ - lib/redmine_remotes/patches/issue_status.rb
54
+ - lib/redmine_remotes/patches/tracker.rb
55
+ - lib/redmine_remotes/version.rb
56
+ homepage:
57
+ licenses: []
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.7.7
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Integração do Redmine com trackers diversos.
79
+ test_files: []