Class: Crossover::CLI
- Inherits:
-
Thor
- Object
- Thor
- Crossover::CLI
- Defined in:
- lib/crossover/cli.rb
Instance Method Summary collapse
Instance Method Details
#client ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/crossover/cli.rb', line 10 def client begin remote_host = [:host] port = [:port] data = [:data] || Client.clean_data puts Client.post(data, remote_host, port) rescue Errno::ECONNREFUSED puts "Sorry! Connection refused by #{remote_host} on port #{port}" rescue Errno::EADDRNOTAVAIL puts "Sorry! Can't assign requested address for #{remote_host} on port #{port}" rescue Interrupt puts "\nExiting ..." end end |
#server ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/crossover/cli.rb', line 33 def server begin host = [:host] port = [:port].to_i logfile = [:logfile] max_connections = [:max_connections] @server = Server.new( port, host, max_connections, logfile, true ) @server.start @server.join rescue Errno::EADDRINUSE puts "Sorry! The port #{port} is already in use." rescue Errno::EACCES => e puts "Sorry! Ensure that you have the correct permissions as per message below:\n#{e} " rescue Interrupt puts "\nExiting ..." end end |
#version ⇒ Object
56 57 58 |
# File 'lib/crossover/cli.rb', line 56 def version puts "Crossover version #{Crossover::VERSION}" end |