Class: Jenkins2::CLI::ListRoles

Inherits:
Jenkins2::CLI show all
Defined in:
lib/jenkins2/cli/role_strategy.rb

Overview

Provides list-roles command in CLI. Requires role-strategy plugin enabled.

Instance Attribute Summary

Attributes inherited from Jenkins2::CLI

#errors, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Jenkins2::CLI

#call, class_to_command, #initialize, #parse, subcommands

Constructor Details

This class inherits a constructor from Jenkins2::CLI

Class Method Details

.descriptionObject



7
8
9
# File 'lib/jenkins2/cli/role_strategy.rb', line 7

def self.description
	'List all global roles in role-strategy plugin.'
end

Instance Method Details

#runObject



11
12
13
14
15
# File 'lib/jenkins2/cli/role_strategy.rb', line 11

def run
	jc.roles.list.collect do |role, users|
		"#{role}: #{users.join(',')}"
	end.join("\n")
end