Class: Jenkins2::CLI::CreateNode

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

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



26
27
28
# File 'lib/jenkins2/cli/nodes.rb', line 26

def self.description
	'Create a new node by reading stdin for an XML configuration.'
end

Instance Method Details

#add_optionsObject



30
31
32
33
34
35
# File 'lib/jenkins2/cli/nodes.rb', line 30

def add_options
	parser.separator 'Mandatory arguments:'
	parser.on '-n', '--name NAME', 'Name of the node.' do |n|
		options[:name] = n
	end
end

#runObject



37
38
39
40
# File 'lib/jenkins2/cli/nodes.rb', line 37

def run
	jc.computer(options[:name]).create and
		jc.computer(options[:name]).update($stdin.read)
end