Sha256: 4ab719fe1f08bf1b25b700e1bba23e0293f4835e26356b17c900e606466daac4

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

# sqa/lib/sqa/init.rb

module SQA
	class << self
		@@config 	= nil
		@@av 			= ApiKeyManager::RateLimited.new(
									api_keys: 		ENV['AV_API_KEYS'],
									delay: 				true,
									rate_count: 	ENV['AV_RATE_CNT'] ||  5,
									rate_period: 	ENV['AV_RATE_PER'] || 60
								)

		# Initializes the SQA modules
		# returns the configuration
		#
		def init(argv=ARGV)
			if argv.is_a? String
				argv = argv.split()
			end


			# Ran at SQA::Config elaboration time
			# @@config = Config.new

			if defined? CLI
				CLI.run(argv)
			else
				# There are no real command line parameters
				# because the sqa gem is being required within
				# the context of a larger program.
			end

			config.data_dir = homify(config.data_dir)

			config
		end

		def av() 								= @@av

		def debug?() 						= @@config.debug?
		def verbose?() 					= @@config.verbose?

		def homify(filepath) 		= filepath.gsub(/^~/, Nenv.home)
		def data_dir() 					= Pathname.new(config.data_dir)
		def config()            = @@config

		def config=(an_object)
			@@config = an_object
		end
	end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sqa-0.0.22 lib/sqa/init.rb
sqa-0.0.21 lib/sqa/init.rb
sqa-0.0.20 lib/sqa/init.rb
sqa-0.0.19 lib/sqa/init.rb
sqa-0.0.18 lib/sqa/init.rb
sqa-0.0.17 lib/sqa/init.rb