Sha256: 5689f312bc7f1eb292c5ca95ed50bfb894c8ee3a1f97551a8b80718b4042ceeb

Contents?: true

Size: 965 Bytes

Versions: 4

Compression:

Stored size: 965 Bytes

Contents

module NFAgent
  RBConfig = Config

  class Config < SVUtil::Config
    @@test_mode = false

    def self.test_mode?
      @@test_mode
    end

    class << self
      def validate
        unless dump_dir and File.exists?(dump_dir) and File.directory?(dump_dir)
          raise "Dump dir (#{dump_dir}) must exist and be a directory"
        end
        super
      end

      def process_options
        parse_options do |opts|
          opts.on("-k", "--client-key [key]", "Service client key") do |key|
            Config.client_key = key
            end
          opts.on("-l", "--debug-log [log-file]", "Debug Log File") do |log|
            Config.log_file = log
          end
          opts.on("-D", "--dump-dir [dir]", "Dump directory for failed chunks") do |dir|
            Config.dump_dir = dir
          end
          opts.on("-T", "--test", "Run connection tests") do
            @@test_mode = true
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nfagent-0.9.31 lib/nfagent/config.rb
nfagent-0.9.19 lib/nfagent/config.rb
nfagent-0.9.17 lib/nfagent/config.rb
nfagent-0.9.15 lib/nfagent/config.rb