lib/scout/command/run.rb in scout-5.4.6.alpha vs lib/scout/command/run.rb in scout-5.5.0

- old
+ new

@@ -7,28 +7,28 @@ key = @args.first # TODO: this is an awkward way to force creation of the config directory. Could use a little refactoring. configuration_directory = config_dir log.debug("Configuration directory is #{configuration_directory} ") if log # TODO: too much external logic of command doing things TO server. This should be moved into the server class. - @scout = Scout::Server.new(server, key, history, log, server_name) + @scout = Scout::Server.new(server, key, history, log, server_name, @http_proxy, @https_proxy) @scout.load_history unless $stdin.tty? log.info "Sleeping #{@scout.sleep_interval} sec" if log sleep @scout.sleep_interval end @scout.fetch_plan - log.info "streamer command=#{@scout.streamer_command}" - # Spawn streamer if directed to, or stop it. @scout.streamer_command should only be [start|stop] - if @scout.streamer_command.is_a?(String) && @scout.streamer_command.start_with?("start") || @scout.streamer_command == "stop" - tokens = @scout.streamer_command.split(",") - tokens.shift # gets rid of the "start" - streaming_key=tokens.shift - plugin_ids = tokens.map(&:to_i) - stream=Scout::Command::Stream.new(@options.merge(:streaming_key=>streaming_key,:plugin_ids=>plugin_ids), [key, @scout.streamer_command]) - stream.run + # Spawn or stop streamer as needed + if @scout.streamer_command.is_a?(String) + if @scout.streamer_command.start_with?("start") + log.info "streamer command: start" + Scout::StreamerDaemon.start_daemon(history, @scout.streamer_command) + elsif @scout.streamer_command == "stop" + log.info "streamer command: stop" + Scout::StreamerDaemon.stop_daemon(history) + end end # Check in if appropriate if @scout.new_plan || @scout.time_to_checkin? || @force if @scout.new_plan