Module: TeutonClient

Defined in:
lib/teuton-client.rb

Overview

This module main methods to run Teuton Client

Class Method Summary collapse

Class Method Details

.initExit status

Create default configuration file ‘teuton-client.yaml’.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/teuton-client.rb', line 46

def self.init
  src = File.join(File.dirname(__FILE__), 'teuton-client', 'files',
        Application::CONFIGFILE)
  dest = File.join(Application::CONFIGFILE)
  if File.exists? dest
    puts "teuton-client => " + Rainbow("File \'#{dest}\' exists!").red
    exit 1
  end
  FileUtils.cp(src, dest)
  puts "teuton-client => " + Rainbow("Init \'#{dest}\' done!").yellow
  exit 0
end

.run(args) ⇒ Exit status

Run Teuton Client



14
15
16
17
18
# File 'lib/teuton-client.rb', line 14

def self.run(args)
  hostname, port = InputLoader.read_configuration(args)
  connect_to_server(hostname, port)
  exit 0
end

.show_helpExit status

Show TeutonClient help.



23
24
25
26
27
28
29
30
31
32
# File 'lib/teuton-client.rb', line 23

def self.show_help
  puts "Usage:"
  puts "    teuton-client [help|version] [IP PORT]"
  puts "Params:"
  puts "    help    , Show this help"
  puts "    init    , Create \'#{Application::CONFIGFILE}\' config file"
  puts "    IP PORT , Teuton server IP and/or PORT"
  puts "    version , Show current version"
  exit 0
end

.show_versionExit status

Show TeutonClient version



37
38
39
40
41
# File 'lib/teuton-client.rb', line 37

def self.show_version
  puts "teuton-client => " +
       Rainbow("version #{Application::VERSION}").cyan
  exit 0
end