Class: Dude::Gitlab::MoveIssue
- Inherits:
-
Base
- Object
- Base
- Dude::Gitlab::MoveIssue
show all
- Defined in:
- lib/dude/gitlab/move_issue.rb
Constant Summary
collapse
- DEFAULT_LABELS =
['To Do', 'Doing', 'To Verify'].freeze
Constants included
from Settings
Settings::CONFIG_FILE
Instance Attribute Summary
Attributes included from Service
#options
Instance Method Summary
collapse
Methods inherited from Base
#check_input_data, #configure_gitlab, #initialize, #issue_exists?, #project_id, #throw_error
Methods included from Settings
#file, #read, #settings
Methods included from Service
included, #initialize
Instance Method Details
#all_issue_labels ⇒ Object
20
21
22
|
# File 'lib/dude/gitlab/move_issue.rb', line 20
def all_issue_labels
::Gitlab.issue(project_id, options[:issue_id]).labels
end
|
#call ⇒ Object
6
7
8
9
10
|
# File 'lib/dude/gitlab/move_issue.rb', line 6
def call
check_input_data
move_issue
print_message
end
|
#default_issue_labels ⇒ Object
24
25
26
|
# File 'lib/dude/gitlab/move_issue.rb', line 24
def default_issue_labels
all_issue_labels.reject {|e| DEFAULT_LABELS.include?(e)}
end
|
#labels_options ⇒ Object
16
17
18
|
# File 'lib/dude/gitlab/move_issue.rb', line 16
def labels_options
{ labels: new_issue_labels }
end
|
#move_issue ⇒ Object
12
13
14
|
# File 'lib/dude/gitlab/move_issue.rb', line 12
def move_issue
::Gitlab.edit_issue(project_id, options[:issue_id], labels_options)
end
|
#new_issue_labels ⇒ Object
28
29
30
|
# File 'lib/dude/gitlab/move_issue.rb', line 28
def new_issue_labels
default_issue_labels.push(options[:label]).join(',')
end
|
#print_message ⇒ Object
32
33
34
|
# File 'lib/dude/gitlab/move_issue.rb', line 32
def print_message
puts "Issue ##{options[:issue_id]} moved to '#{options[:label]}'".colorize(:green)
end
|