Class: TestDiff::Config
- Inherits:
-
Object
- Object
- TestDiff::Config
- Includes:
- Singleton
- Defined in:
- lib/test_diff/config.rb
Overview
Holds all the configuration details
Instance Attribute Summary collapse
-
#current_tracking_filename ⇒ Object
Returns the value of attribute current_tracking_filename.
-
#map_subfolder ⇒ Object
Returns the value of attribute map_subfolder.
- #storage ⇒ Object
-
#test_pattern ⇒ Object
Returns the value of attribute test_pattern.
- #test_runner ⇒ Object
- #version_control ⇒ Object
-
#working_directory ⇒ Object
Returns the value of attribute working_directory.
Class Method Summary collapse
Instance Method Summary collapse
- #current_tracking_file ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #logger ⇒ Object
- #map_folder ⇒ Object
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
12 13 14 |
# File 'lib/test_diff/config.rb', line 12 def initialize reset end |
Instance Attribute Details
#current_tracking_filename ⇒ Object
Returns the value of attribute current_tracking_filename.
7 8 9 |
# File 'lib/test_diff/config.rb', line 7 def current_tracking_filename @current_tracking_filename end |
#map_subfolder ⇒ Object
Returns the value of attribute map_subfolder.
7 8 9 |
# File 'lib/test_diff/config.rb', line 7 def map_subfolder @map_subfolder end |
#storage ⇒ Object
32 33 34 |
# File 'lib/test_diff/config.rb', line 32 def storage @storage ||= Storage.new(map_folder) end |
#test_pattern ⇒ Object
Returns the value of attribute test_pattern.
7 8 9 |
# File 'lib/test_diff/config.rb', line 7 def test_pattern @test_pattern end |
#test_runner ⇒ Object
36 37 38 |
# File 'lib/test_diff/config.rb', line 36 def test_runner @test_runner ||= TestRunner::Rspec.new end |
#version_control ⇒ Object
27 28 29 30 |
# File 'lib/test_diff/config.rb', line 27 def version_control @version_control ||= VersionControl::Git.new(working_directory, File.read(current_tracking_file)) end |
#working_directory ⇒ Object
Returns the value of attribute working_directory.
7 8 9 |
# File 'lib/test_diff/config.rb', line 7 def working_directory @working_directory end |
Class Method Details
.method_missing(method, *args) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/test_diff/config.rb', line 53 def self.method_missing(method, *args) if instance.respond_to?(method) instance.send(method, *args) else super end end |
.respond_to_missing?(method, *args) ⇒ Boolean
61 62 63 |
# File 'lib/test_diff/config.rb', line 61 def self.respond_to_missing?(method, *args) super && instance.respond_to?(method) end |
Instance Method Details
#current_tracking_file ⇒ Object
49 50 51 |
# File 'lib/test_diff/config.rb', line 49 def current_tracking_file "#{map_folder}/#{current_tracking_filename}" end |
#logger ⇒ Object
40 41 42 43 |
# File 'lib/test_diff/config.rb', line 40 def logger require 'logger' @logger ||= Logger.new($stdout) end |
#map_folder ⇒ Object
45 46 47 |
# File 'lib/test_diff/config.rb', line 45 def map_folder "#{working_directory}/#{map_subfolder}" end |
#reset ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/test_diff/config.rb', line 16 def reset self.working_directory = '.' self.map_subfolder = 'test_diff_coverage' self.current_tracking_filename = 'sha' self.test_pattern = /spec.rb\z/ @version_control = nil @storage = nil @test_runner = nil @logger = nil end |