Class: Codebot::Options::Network
- Inherits:
-
Thor
- Object
- Thor
- Codebot::Options::Network
- Defined in:
- lib/codebot/options/network.rb
Overview
A class that handles the codebot network command.
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
Ensures that thor uses the correct exit code.
-
.shared_authentication_options ⇒ Object
Sets shared options for authenticating to the IRC network.
-
.shared_connection_options ⇒ Object
Sets shared options for connecting to the IRC network.
-
.shared_propery_options ⇒ Object
Sets shared options for specifying properties belonging to the Network class.
Instance Method Summary collapse
-
#create(name) ⇒ Object
Creates a new network with the specified name.
-
#destroy(name) ⇒ Object
Destroys the network with the specified name.
-
#list(search = nil) ⇒ Object
Lists all networks, or networks with names containing the given search term.
-
#update(name) ⇒ Object
Updates the network with the specified name.
Class Method Details
.exit_on_failure? ⇒ Boolean
Ensures that thor uses the correct exit code.
104 105 106 |
# File 'lib/codebot/options/network.rb', line 104 def self.exit_on_failure? true end |
.shared_authentication_options ⇒ Object
Sets shared options for authenticating to the IRC network.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/codebot/options/network.rb', line 25 def self. # Not a boolean to prevent thor from generating --no-disable-sasl flag option :disable_sasl, type: :string, banner: '', desc: 'Disable SASL authentication' option :sasl_username, desc: 'Set the username for SASL authentication' option :sasl_password, desc: 'Set the password for SASL authentication' option :disable_nickserv, type: :string, banner: '', desc: 'Disable NickServ authentication' option :nickserv_username, desc: 'Set the username for NickServ authentication' option :nickserv_password, desc: 'Set the password for NickServ authentication' end |
.shared_connection_options ⇒ Object
Sets shared options for connecting to the IRC network.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/codebot/options/network.rb', line 12 def self. option :host, aliases: '-H', desc: 'Set the server hostname or address' option :port, type: :numeric, aliases: '-p', desc: 'Set the port to connect to' option :secure, type: :boolean, aliases: '-s', desc: 'Connect securely using TLS' option :server_password, desc: 'Set the server password' option :nick, aliases: '-N', desc: 'Set the nickname' end |
.shared_propery_options ⇒ Object
Sets shared options for specifying properties belonging to the Network class.
42 43 44 45 46 47 48 49 |
# File 'lib/codebot/options/network.rb', line 42 def self. option :bind, aliases: '-b', desc: 'Bind to the specified IP address or host' option :modes, aliases: '-m', desc: 'Set user modes' end |
Instance Method Details
#create(name) ⇒ Object
Creates a new network with the specified name.
57 58 59 60 61 |
# File 'lib/codebot/options/network.rb', line 57 def create(name) Options.with_core(, true) do |core| NetworkManager.new(core.config).create(.merge(name: name)) end end |
#destroy(name) ⇒ Object
Destroys the network with the specified name.
95 96 97 98 99 |
# File 'lib/codebot/options/network.rb', line 95 def destroy(name) Options.with_core(, true) do |core| NetworkManager.new(core.config).destroy(name, ) end end |
#list(search = nil) ⇒ Object
Lists all networks, or networks with names containing the given search term.
84 85 86 87 88 |
# File 'lib/codebot/options/network.rb', line 84 def list(search = nil) Options.with_core(, true) do |core| NetworkManager.new(core.config).list(search) end end |
#update(name) ⇒ Object
Updates the network with the specified name.
72 73 74 75 76 |
# File 'lib/codebot/options/network.rb', line 72 def update(name) Options.with_core(, true) do |core| NetworkManager.new(core.config).update(name, ) end end |