forked from bladerunnerlabs/blade-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
31 lines (24 loc) · 620 Bytes
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true
# ConfigFileException - exception class for configuration file
class ConfigFileException < StandardError
def initialize(msg)
super
end
end
# BTestConfigFile - class to handle configuration
class BTestConfig
BTEST_VERSION = '0.1'
def self.config_file(msg, default_file = '')
if ARGV.empty?
config_file = default_file if File.exist?(default_file)
end
if ARGV.length >= 1
config_file = ARGV[0] if File.exist?(ARGV[0])
end
raise ConfigFileException, msg if config_file.nil?
config_file
end
def self.version
BTEST_VERSION
end
end