module ServState

Constants

VERSION

Public Class Methods

greeting(options) click to toggle source
# File lib/ServState.rb, line 32
def self.greeting(options)
  puts " ____                   ____  _        _       "
  puts "/ ___|  ___ _ ____   __/ ___|| |_ __ _| |_ ___ "
  puts "\\___ \\ / _ \\ '__\\ \\ / /\\___ \\| __/ _` | __/ _ \\"
  puts " ___) |  __/ |   \\ V /  ___) | || (_| | ||  __/"
  puts "|____/ \\___|_|    \\_/  |____/ \\__\\__,_|\\__\\___|"
  puts "\nPORT: #{options[:port]}"
  if(options[:pass])
    puts "PASSWORD: #{options[:pass]}"
  else
    puts "WITHOUT PASSWORD"
  end
  puts "\n"*3
end
run(&block) click to toggle source
# File lib/ServState.rb, line 47
def self.run &block
  Application.set_settings &block
  Application.run!
end
run!() click to toggle source
# File lib/ServState.rb, line 7
def self.run!

  defaults = {
    port: 8080,
    pass: nil
  }
  
  cl_options = Slop.parse(help: true) do
    banner 'Usage: servstate [options]'
    on 'pass=', 'Password to login.'
    on 'port=', 'Set port.'
  end

  cl_hash = cl_options.to_hash.reject {|k,v| v.nil? }

  options = defaults.merge(cl_hash)

  greeting(options)

  run do
    port options[:port]
    password options[:pass]
  end
end