Sha256: bf8fd0b81221abe12cf402124629b5812c63e569747d7378fd5ae401bbd04eff

Contents?: true

Size: 719 Bytes

Versions: 8

Compression:

Stored size: 719 Bytes

Contents

# encoding: UTF-8

module Rivet
  module Utils
    def self.die(level = 'fatal', message)
      Rivet::Log.write(level, message)
      exit 1
    end

    def self.list_groups(directory)
      config_file_names = Dir.glob(File.join(directory,'*.rb'))
      config_file_names.map! {|f| File.basename(f,'.rb')}
      config_file_names.sort!
      Rivet::Log.info "Available groups in #{directory}:"
      config_file_names.each { |n| Rivet::Log.info n }
    end

    def self.get_config(client_type, name, directory)
      dsl_file = File.join(directory, "#{name}.rb")
      klass = Rivet.const_get("#{client_type.capitalize}Config")
      klass.from_file(dsl_file, directory) if File.exists?(dsl_file)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rivet-3.2.0 lib/rivet/utils.rb
rivet-3.1.0 lib/rivet/utils.rb
rivet-3.0.5 lib/rivet/utils.rb
rivet-3.0.4 lib/rivet/utils.rb
rivet-3.0.3 lib/rivet/utils.rb
rivet-3.0.2 lib/rivet/utils.rb
rivet-3.0.1 lib/rivet/utils.rb
rivet-3.0.0 lib/rivet/utils.rb