Class: OyenCov::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/oyencov/configuration.rb

Constant Summary collapse

ENV_PARAMETERS =
%w[
  API_KEY
  API_URL
  MODE
  RELEASE
  TEST_REPORTING_DIR
  TEST_RESULTSET_PATH
  PROGRAM_NAME
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
26
27
# File 'lib/oyencov/configuration.rb', line 18

def initialize
  reset_to_defaults
  ENV_PARAMETERS.each do |key|
    if (envvar_value = ENV["OYENCOV_#{key}"])
      instance_variable_set(
        :"@#{key.downcase}", envvar_value
      )
    end
  end
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def api_key
  @api_key
end

#api_urlObject (readonly)

Returns the value of attribute api_url.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def api_url
  @api_url
end

#excluding_file_pathsObject (readonly)

Returns the value of attribute excluding_file_paths.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def excluding_file_paths
  @excluding_file_paths
end

#including_file_pathsObject (readonly)

Returns the value of attribute including_file_paths.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def including_file_paths
  @including_file_paths
end

#modeObject (readonly)

Returns the value of attribute mode.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def mode
  @mode
end

#process_typeObject (readonly)

Returns the value of attribute process_type.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def process_type
  @process_type
end

#program_nameObject (readonly)

Returns the value of attribute program_name.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def program_name
  @program_name
end

#releaseObject (readonly)

Returns the value of attribute release.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def release
  @release
end

#test_reporting_dirObject (readonly)

Returns the value of attribute test_reporting_dir.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def test_reporting_dir
  @test_reporting_dir
end

#test_resultset_pathObject (readonly)

Returns the value of attribute test_resultset_path.



16
17
18
# File 'lib/oyencov/configuration.rb', line 16

def test_resultset_path
  @test_resultset_path
end

Instance Method Details

#reset_to_defaultsObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/oyencov/configuration.rb', line 29

def reset_to_defaults
  @api_key = nil
  @api_url = "https://telemetry-api.oyencov.com"
  @mode = ENV["OYENCOV_ENV"] || ENV["RAILS_ENV"]
  @including_file_paths = %w[app lib]
  @excluding_file_paths = []
  @release = suggest_release
  @process_type = suggest_process_type
  @test_reporting_dir = "coverage/"
  @test_resultset_path = "coverage/oyencov-resultset.json"
end