Sha256: 5f407af0537536387072fac234c13c423361e294f54c25f4dfefaec0e4769c46

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'singleton'

# This Singleton contains application params
class Application
  include Singleton

  VERSION = '2.1.5dev' # Application version
  NAME = 'teuton'   # Application name

  attr_reader   :letter
  attr_reader   :running_basedir, :output_basedir
  attr_reader   :default
  attr_accessor :options
  attr_accessor :verbose
  attr_accessor :global, :ialias
  attr_accessor :checks, :groups, :uses
  attr_accessor :hall_of_fame
  attr_accessor :project_path, :script_path, :config_path, :test_name

  def initialize
    reset
  end

  def reset
    @letter = { good: '.', bad: 'F', error: '?', none: ' ' }
    @running_basedir = Dir.getwd
    @output_basedir = 'var'
    @default = { name: 'teuton', format: :txt, debug: false }
    @options = { 'lang' => 'en' }
    @verbose = true

    @global = {}
    @ialias = {}
    @checks = {}
    @groups = []
    @uses = [] # TODO
    @hall_of_fame = []
  end

  def debug
    @default[:debug]
  end

  def name
    @default[:name]
  end

  def quiet?
    return true if Application.instance.options['quiet']
    return true unless Application.instance.verbose
    false
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
teuton-2.1.5dev lib/teuton/application.rb