Class: Application
- Inherits:
-
Object
- Object
- Application
- Includes:
- Singleton
- Defined in:
- lib/asker/application.rb
Overview
Global parameters
Constant Summary collapse
- VERSION =
'2.2.2'
- NAME =
'asker'
- GEM =
'asker-tool'
- CONFIGFILE =
'asker.ini'
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
17 18 19 |
# File 'lib/asker/application.rb', line 17 def initialize reset end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
15 16 17 |
# File 'lib/asker/application.rb', line 15 def config @config end |
Instance Method Details
#reset ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/asker/application.rb', line 21 def reset filename = File.join(Dir.pwd, CONFIGFILE) filename = File.join(File.dirname(__FILE__), 'files', CONFIGFILE) unless File.exist? filename 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 |