Sha256: cd29415f426e1278d2b0173d3b307871305434c7c3578abf579fa5237ac3dfac
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true require 'singleton' require 'inifile' require 'rainbow' # Global parameters class Application include Singleton VERSION = '2.1.6' # Application version NAME = 'asker' # Application name GEM = 'asker-tool' # Gem name attr_reader :config ## # Initialize Application singleton def initialize reset end ## # Initialize config values from external "config.ini" file. # rubocop:disable Metrics/AbcSize # rubocop:disable Metrics/MethodLength def reset filename = File.join(Dir.pwd, 'config.ini') unless File.exist? filename filename = File.join(File.dirname(__FILE__), 'files', 'config.ini') end begin @config = IniFile.load(filename) rescue StandardError => e puts e.display puts Rainbow('[ERROR] Revise configuration file:').red.bright puts Rainbow(" #{filename}").red.bright exit 1 end stages = @config['questions']['stages'].split(',') @config['questions']['stages'] = stages.map(&:to_sym) Rainbow.enabled = false Rainbow.enabled = true if @config['global']['color'].downcase == 'yes' end # rubocop:enable Metrics/MethodLength # rubocop:enable Metrics/AbcSize end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
asker-tool-2.1.6 | lib/asker/application.rb |