Class: Coverfield::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/coverfield/config.rb

Overview

A simple config store

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Constructor



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/coverfield/config.rb', line 11

public def initialize
  @uncovered_only = false
  @skip_summary = false
  @debug = false
  @include_paths = []
  @spec_dir = 'spec/'

  # Bundler already contains a good logic to determine the apps root
  require 'bundler'
  @app_root = Bundler.root.to_s
end

Instance Attribute Details

#app_rootObject

Returns the value of attribute app_root.



3
4
5
# File 'lib/coverfield/config.rb', line 3

def app_root
  @app_root
end

#debugObject

Returns the value of attribute debug.



3
4
5
# File 'lib/coverfield/config.rb', line 3

def debug
  @debug
end

#include_pathsObject

Returns the value of attribute include_paths.



3
4
5
# File 'lib/coverfield/config.rb', line 3

def include_paths
  @include_paths
end

#skip_summaryObject

Returns the value of attribute skip_summary.



3
4
5
# File 'lib/coverfield/config.rb', line 3

def skip_summary
  @skip_summary
end

#spec_dirObject

Returns the value of attribute spec_dir.



3
4
5
# File 'lib/coverfield/config.rb', line 3

def spec_dir
  @spec_dir
end

#uncovered_onlyObject

Returns the value of attribute uncovered_only.



3
4
5
# File 'lib/coverfield/config.rb', line 3

def uncovered_only
  @uncovered_only
end

Instance Method Details

#dump_configObject

Prints all options



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/coverfield/config.rb', line 31

public def dump_config
  puts 'Options:'.blue
  puts "    Uncovered only:  #{@uncovered_only}"
  puts "    Skip summary:    #{@skip_summary}"
  puts "    Debug mode:      #{@debug}"
  puts "    Include paths:   #{@include_paths}"
  puts "    App root:        #{@app_root}"
  puts "    Spec directory:  #{@spec_dir} (= #{spec_path})"
  puts
  puts
end

#spec_pathObject

Returns the full absolute path to the spec dir



25
26
27
# File 'lib/coverfield/config.rb', line 25

public def spec_path
  @app_root + '/' + @spec_dir
end