Class: Cwmp::Acs
- Inherits:
-
Object
- Object
- Cwmp::Acs
- Defined in:
- lib/cwmp/acs.rb
Instance Method Summary collapse
-
#initialize(port) ⇒ Acs
constructor
A new instance of Acs.
- #start ⇒ Object
- #start_cli ⇒ Object
Constructor Details
Instance Method Details
#start ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/cwmp/acs.rb', line 89 def start @web = Thread.new do Thin::Logging.silent = true Rack::Handler::Thin.run @app, :Port => @port end Thread.new do while true do sleep 1 Readline.clear_rl puts "i" Readline.restore end end start_cli end |
#start_cli ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/cwmp/acs.rb', line 64 def start_cli list = [ 'GetParameterValues', 'SetParameterValues', 'Reboot', 'FactoryReset', 'Download', 'AddObject', 'DeleteObject', 'help', 'quit', "waitMessage" ].sort comp = proc { |s| list.grep(/^#{Regexp.escape(s)}/) } ::Readline.completion_append_character = " " ::Readline.completion_proc = comp while line = ::Readline.readline('> ', true) case line when "quit" puts "Bye" exit(0) when "help" help when "list" puts "list" end end end |