Class: ServerRegistryClient::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/server-registry-client/cli.rb

Instance Method Summary collapse

Instance Method Details

#add_serverObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/server-registry-client/cli.rb', line 13

def add_server
	require_server_option
	require_server_hostname_or_ip_address

	server = construct_server_from_options

	categories = parse_csv(options[:categories])

	client = construct_client
	client.add_server_to_categories(server, categories)
end

#remove_serverObject



48
49
50
51
52
53
54
55
56
# File 'lib/server-registry-client/cli.rb', line 48

def remove_server
	require_server_option
	require_server_hostname_or_ip_address

	server = construct_server_from_options

	client = construct_client
	client.remove_servers_like(server)
end

#remove_server_from_categoryObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/server-registry-client/cli.rb', line 30

def remove_server_from_category
	require_server_option
	require_server_hostname_or_ip_address

	server = construct_server_from_options

	categories = parse_csv(options[:categories])

	client = construct_client
	categories.each do |category_name|
		client.remove_server_from_category(server, category_name)
	end
end