Class: RedmineCLI::Subcommands::Issue
Overview
All methods for working with issues, e.g. listing, linking, updating…
Instance Method Summary
collapse
erb, message, print_object_list, print_prompt_message
Instance Method Details
#complete(id) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/redmine_cli/subcommands/issue.rb', line 41
def complete(id)
issue = Models::Issue.find(id)
invoke(Conf, 'status_complete', []) unless Config['statuses'] && Config['statuses']['complete']
assign_to = if options[:assign]
InputParser.parse_user(options[:assign], project: issue.project).id
else
issue.author.id
end
invoke(:update, [id], ['-d', '100', '-s', Config['statuses']['complete'], '-c', '-a', assign_to])
rescue ActiveResource::ResourceNotFound
puts m(:not_found)
end
|
#create ⇒ Object
88
89
90
91
92
93
94
95
|
# File 'lib/redmine_cli/subcommands/issue.rb', line 88
def create
self.class.include Helpers::Issue::Create
@issue = Models::Issue.new
set_attributes
@issue.save
puts 'Done.'
end
|
#list(id = 'current') ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/redmine_cli/subcommands/issue.rb', line 17
def list(id = 'current')
fail('new config') if Config.new?
user = InputParser.parse_user(id)
puts erb('issue/list', issues: user.issues)
rescue UserNotFound
puts "User #{m(:not_found)}"
end
|
#show(id) ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/redmine_cli/subcommands/issue.rb', line 29
def show(id)
puts erb 'issue/show',
issue: Models::Issue.find(id),
journals_limit: options[:limit],
comments_only: options[:comments_only]
rescue ActiveResource::ResourceNotFound puts m(:not_found)
end
|
#update(id) ⇒ Object
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/redmine_cli/subcommands/issue.rb', line 72
def update(id)
self.class.include Helpers::Issue::Update
issue = Models::Issue.find(id)
if update_issue(issue) puts m(issue.save ? :success : :error)
else
@errors.each { |e| puts e }
end
rescue ActiveResource::ResourceNotFound
puts m(:not_found)
end
|