Class: RedmineCLI::Subcommands::Project

Inherits:
Thor
  • Object
show all
Extended by:
Helpers::Output
Includes:
Helpers::Input, Helpers::Output, RedmineRest
Defined in:
lib/redmine_cli/subcommands/project.rb

Overview

Methods for working with projects

Instance Method Summary collapse

Methods included from Helpers::Output

erb, message, print_object_list, print_prompt_message

Methods included from Helpers::Input

#ask, #ask_for_object, #ask_for_user, #ask_from_text_editor, #ask_url

Instance Method Details

#listObject



18
19
20
# File 'lib/redmine_cli/subcommands/project.rb', line 18

def list
  puts erb('id_and_name_list', list: Models::Project.all)
end

#members(project) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/redmine_cli/subcommands/project.rb', line 23

def members(project)
  project = InputParser.parse_project(project)

  users = project.members
                 .map(&:reload)
                 .sort { |a, b| a.id.to_i <=> b.id.to_i }

  puts erb('user/find', users: users)
rescue ProjectNotFound
  puts "Project #{m(:not_found)}"
end