Sha256: 842aaed52a84a8d012799cfacc5acf5ee69f224a0295f23c05913f50dc7c1ddf

Contents?: true

Size: 1.33 KB

Versions: 27

Compression:

Stored size: 1.33 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)
      parser = ConfigParser.new
      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 # class ScriptRunnerConfig

end # module Cosmos

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
cosmos-3.9.2 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.9.1 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.8.3 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.8.2 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.8.1 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.8.0 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.7.1 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.7.0 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.6.3 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.6.2 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.6.1 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.6.0 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.5.3 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.5.2 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.5.0 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.4.2 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.4.1 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.4.0 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.3.3 lib/cosmos/tools/script_runner/script_runner_config.rb
cosmos-3.3.2 lib/cosmos/tools/script_runner/script_runner_config.rb