Sha256: 74f9b74d65d6764b0b1f41a63b81c99fd2400af48693c8a926999564e46aa78d

Contents?: true

Size: 940 Bytes

Versions: 21

Compression:

Stored size: 940 Bytes

Contents

require 'optimus-runner/version'
require 'daemons'
require 'optimus-runner/server/appium_server_manager'


module Gandalf
  class Optimus_Runner
    attr_reader :options, :optimus_runner_sm, :scheduler

    def initialize(options)
      @options = options
      @optimus_runner_sm = OptimusRunnerSM.new
      @scheduler = Rufus::Scheduler.new
      logger = Logger.new(STDOUT)
      logger.level = Logger::WARN
      logger.info "Starting Optimus runner..."
    end


    def run!
      @scheduler.interval '5s', :first_in => 0.1 do
        logger.info "Is Optimus runner idle? #{@optimus_runner_sm.idle?}"
        @optimus_runner_sm.create if @optimus_runner_sm.idle?
        @optimus_runner_sm.add if @optimus_runner_sm.new_device_added?
        @optimus_runner_sm.remove if @optimus_runner_sm.device_removed?
        @optimus_runner_sm.restart if @optimus_runner_sm.session_terminated?
      end
      @scheduler.join
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
optimus-runner-1.2.0 lib/optimus-runner.rb
optimus-runner-1.1.4 lib/optimus-runner.rb
optimus-runner-1.1.3 lib/optimus-runner.rb
optimus-runner-1.1.2 lib/optimus-runner.rb
optimus-runner-1.1.1 lib/optimus-runner.rb
optimus-runner-1.1.0 lib/optimus-runner.rb
optimus-runner-1.0.2 lib/optimus-runner.rb
optimus-runner-0.15.0 lib/optimus-runner.rb
optimus-runner-0.14.0 lib/optimus-runner.rb
optimus-runner-0.13.0 lib/optimus-runner.rb
optimus-runner-0.12.0 lib/optimus-runner.rb
optimus-runner-0.11.0 lib/optimus-runner.rb
optimus-runner-0.10.0 lib/optimus-runner.rb
optimus-runner-0.9.0 lib/optimus-runner.rb
optimus-runner-0.8.0 lib/optimus-runner.rb
optimus-runner-0.7.0 lib/optimus-runner.rb
optimus-runner-0.6.0 lib/optimus-runner.rb
optimus-runner-0.5.0 lib/optimus-runner.rb
optimus-runner-0.4.0 lib/optimus-runner.rb
optimus-runner-0.3.0 lib/optimus-runner.rb