Sha256: 87215fcf0fc7ac4b3cc6b6f7b996c1d3350c369863a1d4574fc8298801b057bc

Contents?: true

Size: 1.37 KB

Versions: 16

Compression:

Stored size: 1.37 KB

Contents

# encoding: ascii-8bit

# Copyright 2014 Ball Aerospace & Technologies Corp.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt

require 'cosmos'

module Cosmos
  # This class reads the Script Runner configuration file
  class ScriptRunnerConfig
    # Processes the config file
    def initialize(filename)
      return unless filename
      parser = ConfigParser.new("http://cosmosrb.com/docs/tools/#script-runner-configuration")
      parser.parse_file(filename) do |keyword, params|
        case keyword
        when 'LINE_DELAY'
          parser.verify_num_parameters(1, 1, "#{keyword} <Delay in Seconds>")
          ScriptRunnerFrame.line_delay = params[0].to_f
        when 'MONITOR_LIMITS'
          parser.verify_num_parameters(0, 0, keyword)
          ScriptRunnerFrame.monitor_limits = true
        when 'PAUSE_ON_RED'
          parser.verify_num_parameters(0, 0, keyword)
          ScriptRunnerFrame.monitor_limits = true
          ScriptRunnerFrame.pause_on_red = true
        else
          # blank config.lines will have a nil keyword and should not raise an exception
          raise parser.error("Unknown keyword '#{keyword}'") if keyword
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cosmos-4.3.0-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.3.0 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.4-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.4 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.3-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.3 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.2-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.2 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.1-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.1 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.0-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.2.0 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.1.1-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.1.1 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.1.0-java lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-4.1.0 lib/cosmos/tools/script_runner/script_runner_config.rb