Class: Project

Inherits:
Object
  • Object
show all
Defined in:
lib/teuton/utils/project.rb

Class Method Summary collapse

Class Method Details

.add_input_params(projectpath, options) ⇒ Object

Preprocess input options:

  • Convert input case options String to an Array of integers

  • Read color input option



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/teuton/utils/project.rb', line 55

def self.add_input_params(projectpath, options)
  value[:options].merge! options
  Rainbow.enabled = value[:options]["color"]

  finder = NameFileFinder.new(value[:options])
  finder.find_filenames_for(projectpath)
  value[:project_path] = finder.project_path
  value[:script_path] = finder.script_path
  value[:config_path] = finder.config_path
  value[:test_name] = finder.test_name

  unless value[:options]["case"].nil?
    numbers = value[:options]["case"].split(",")
    value[:options]["case"] = numbers.collect!(&:to_i)
  end
end

.debug?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/teuton/utils/project.rb', line 32

def self.debug?
  value[:debug]
end

.initObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/teuton/utils/project.rb', line 4

def self.init
  @project = {}
  @project[:running_basedir] = Dir.getwd
  @project[:output_basedir] = "var"
  @project[:name] = "teuton"
  @project[:format] = :txt
  @project[:debug] = false
  @project[:options] = {
    "color" => true,
    "lang" => "en",
    "panel" => false,
    "quiet" => false
  }
  @project[:verbose] = true
  @project[:global] = {} # Hash of Global configuration params
  @project[:ialias] = {} # Hash of Internal alias
  @project[:macros] = {} # Hash of macros
  @project[:groups] = [] # Array of groups
  @project[:uses] = [] # TODO: Array of used files
  @project[:hall_of_fame] = []
end

.nameObject



36
37
38
# File 'lib/teuton/utils/project.rb', line 36

def self.name
  value[:name]
end

.quiet?Boolean

Returns:

  • (Boolean)


40
41
42
43
44
45
# File 'lib/teuton/utils/project.rb', line 40

def self.quiet?
  return true if value[:options]["quiet"]
  return true unless value[:verbose]

  false
end

.valueObject



26
27
28
# File 'lib/teuton/utils/project.rb', line 26

def self.value
  @project
end

.verboseObject



47
48
49
# File 'lib/teuton/utils/project.rb', line 47

def self.verbose
  value[:verbose]
end