redmine_remotes 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/redmine_remotes/tableless/remote_issue_fetch/base/_local_issue.rb +2 -13
- data/app/models/remote_issue_status.rb +0 -11
- data/app/models/remote_tracker.rb +5 -0
- data/app/models/remote_tracker/find_issue_local_status.rb +40 -0
- data/lib/redmine_remotes/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fe74fdd135a685b96165bd9ed58d166cfb9ba5b28535eca5bc25f12a730e656
|
4
|
+
data.tar.gz: ceb58f6cebd35a0db510929df86cac7465be85f1de0f79717e2fda174fe69b90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77dbf10449d5d38021cf698ab65ce4225cf33377e6e5a3b4cf25ca52bba04f9216959c83a26b8cfacd25a703f887d0cb597fe0b4b28b56737c3f9baa2b89effb
|
7
|
+
data.tar.gz: 61dcddd64c24be40ed2dfacf389f535c1c56beab448b17cd817bce2e3164000b2ea190cdb195a7cfedd0f7bf59890ccdd5bc6f566870608c362a9c1e4962e633
|
@@ -54,19 +54,8 @@ module RedmineRemotes
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def local_issue_status
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
def local_issue_status_from_remote_tracker
|
61
|
-
::RemoteIssueStatus.find_local_issue_status(
|
62
|
-
provider_issue.status_name,
|
63
|
-
remote_tracker,
|
64
|
-
local_tracker
|
65
|
-
)
|
66
|
-
end
|
67
|
-
|
68
|
-
def local_issue_status_from_local_tracker
|
69
|
-
local_tracker.default_status
|
57
|
+
remote_tracker.try(:find_local_issue_status, local_tracker, provider_issue.status_name,
|
58
|
+
true)
|
70
59
|
end
|
71
60
|
|
72
61
|
def local_issue_description
|
@@ -13,15 +13,4 @@ class RemoteIssueStatus < ActiveRecord::Base
|
|
13
13
|
validates :remote_tracker, presence: true
|
14
14
|
validates :local_tracker, presence: true
|
15
15
|
validates :local_issue_status, presence: true
|
16
|
-
|
17
|
-
class << self
|
18
|
-
def find_local_issue_status(remote_name, remote_tracker, local_tracker)
|
19
|
-
record = ::RemoteIssueStatus.where(
|
20
|
-
remote_name: remote_name_sanitize(remote_name),
|
21
|
-
remote_tracker: remote_tracker,
|
22
|
-
local_tracker: local_tracker
|
23
|
-
).first
|
24
|
-
record ? record.local_issue_status : nil
|
25
|
-
end
|
26
|
-
end
|
27
16
|
end
|
@@ -27,6 +27,11 @@ class RemoteTracker < ActiveRecord::Base
|
|
27
27
|
validates :password, presence: true
|
28
28
|
validates :default_local_user, presence: true
|
29
29
|
|
30
|
+
def find_local_issue_status(local_tracker, remote_status_name, register_not_found = false)
|
31
|
+
::RemoteTracker::FindIssueLocalStatus.new(self, local_tracker, remote_status_name,
|
32
|
+
register_not_found).result
|
33
|
+
end
|
34
|
+
|
30
35
|
def to_s
|
31
36
|
"#{root_url} [#{profile_label}, #{username}]"
|
32
37
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
class RemoteTracker < ActiveRecord::Base
|
6
|
+
class FindIssueLocalStatus
|
7
|
+
common_constructor :remote_tracker, :local_tracker, :remote_status_name, :register_not_found
|
8
|
+
|
9
|
+
# @return [Tracker]
|
10
|
+
def result
|
11
|
+
result_by_remote_issue_status || result_by_register_not_found || result_by_local_issue_status
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def result_by_register_not_found
|
17
|
+
return nil unless register_not_found
|
18
|
+
|
19
|
+
::RemoteIssueStatus.create!(
|
20
|
+
remote_issue_status_find_attributes.merge(local_issue_status: result_by_local_issue_status)
|
21
|
+
).local_issue_status
|
22
|
+
end
|
23
|
+
|
24
|
+
def result_by_remote_issue_status
|
25
|
+
::RemoteIssueStatus.where(remote_issue_status_find_attributes).first.try(:local_issue_status)
|
26
|
+
end
|
27
|
+
|
28
|
+
def result_by_local_issue_status
|
29
|
+
local_tracker.default_status
|
30
|
+
end
|
31
|
+
|
32
|
+
def remote_issue_status_find_attributes
|
33
|
+
{
|
34
|
+
remote_name: ::RemoteIssueStatus.remote_name_sanitize(remote_status_name),
|
35
|
+
remote_tracker: remote_tracker,
|
36
|
+
local_tracker: local_tracker
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redmine_remotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Henrique Bogoni
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- app/models/remote_issue.rb
|
140
140
|
- app/models/remote_issue_status.rb
|
141
141
|
- app/models/remote_tracker.rb
|
142
|
+
- app/models/remote_tracker/find_issue_local_status.rb
|
142
143
|
- app/models/remote_tracker/remote.rb
|
143
144
|
- app/models/remote_tracker_setting.rb
|
144
145
|
- app/models/remote_user.rb
|