-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.rb
60 lines (51 loc) · 2.08 KB
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Redmine connection data
HOST = 'https://host/redmine/'
API_KEY = 'someapikey'
# User conversion from Redmine => Gitlab, e.g. {15 => 1, 19 => 2}
USER_CONVERSION = {}
DEFAULT_ACCOUNT = 1
# Custom features in Redmine (id)
CUSTOM_FEATURES = []
### Default values ###
HASH = 'redmine'
TARGET_TYPE = 'Issue'
DEBUG_ERROR = 4
DEBUG_WARNING = 3
DEBUG_STATUS = 2
DEBUG_DEBUG = 1
PRIORITIES = {3 => 'Low', 4 => 'Normal', 5 => 'High', 6 => 'Urgent', 7 => 'Immediate'}
OPEN_VALUES = ['New', 'In Progress', 'Feedback', 'Resolved']
CLOSED_VALUES = ['Closed', 'Rejected']
### Debug ###
DEBUG_STATE = DEBUG_DEBUG
def messenger(location, args)
message = case location
when 'connection_true' then
[DEBUG_DEBUG, "Connection with #{args[0]} is established"]
when 'connection_false' then
[DEBUG_ERROR, "Connection with #{args[0]} failed"]
when 'found_project' then
[DEBUG_DEBUG, "Found Gitlab project: #{args[0]} from Redmine project: #{args[1]}"]
when 'not_found_project' then
[DEBUG_WARNING, "No Gitlab project found with the name: #{args[0]}"]
when 'found_user' then
[DEBUG_DEBUG, "Gitlab user: #{args[0]} found for Redmine user: #{args[1]} (#{args[2]})"]
when 'not_found_user' then
[DEBUG_WARNING, "No Gitlab user found for: #{args[0]} (#{args[1]}), using default account!"]
when 'new_issue' then
[DEBUG_DEBUG, "Created new issue: #{args}"]
when 'issue_errors' then
[DEBUG_ERROR, "#{args}"]
when 'new_labels' then
[DEBUG_DEBUG, "Adding labels: #{args[0]} to issue #{args[1]}"]
when 'progress' then
[DEBUG_STATUS, "#{args[0]}"]
when 'journal_not_found' then
[DEBUG_DEBUG, "Journal (#{args[0]}), was not transferred"]
else
[DEBUG_ERROR, "Error no message found for: #{location}, with args: #{args}"]
end
if message[0] >= DEBUG_STATE
puts message[1]
end
end