Module: Coverband
- Defined in:
- lib/coverband/version.rb,
lib/coverband/at_exit.rb,
lib/coverband/utils/result.rb,
lib/coverband/adapters/base.rb,
lib/coverband/configuration.rb,
lib/coverband/reporters/web.rb,
lib/coverband/utils/railtie.rb,
lib/coverband/utils/results.rb,
lib/coverband/reporters/base.rb,
lib/coverband/utils/file_list.rb,
lib/coverband/collectors/delta.rb,
lib/alternative_coverband_patch.rb,
lib/coverband/utils/file_hasher.rb,
lib/coverband/utils/source_file.rb,
lib/coverband/utils/dead_methods.rb,
lib/coverband/adapters/file_store.rb,
lib/coverband/adapters/null_store.rb,
lib/coverband/collectors/coverage.rb,
lib/coverband/integrations/resque.rb,
lib/coverband/adapters/redis_store.rb,
lib/coverband/utils/html_formatter.rb,
lib/coverband/adapters/stdout_store.rb,
lib/coverband/reporters/html_report.rb,
lib/coverband/reporters/json_report.rb,
lib/coverband/utils/lines_classifier.rb,
lib/coverband/collectors/view_tracker.rb,
lib/coverband/integrations/background.rb,
lib/coverband/adapters/memcached_store.rb,
lib/coverband/collectors/route_tracker.rb,
lib/coverband/reporters/console_report.rb,
lib/coverband/adapters/hash_redis_store.rb,
lib/coverband/adapters/web_service_store.rb,
lib/coverband/collectors/abstract_tracker.rb,
lib/coverband/utils/absolute_file_converter.rb,
lib/coverband/utils/relative_file_converter.rb,
lib/coverband/collectors/translation_tracker.rb,
lib/coverband/integrations/rack_server_check.rb,
lib/coverband/integrations/report_middleware.rb,
lib/coverband/collectors/view_tracker_service.rb,
lib/coverband/utils/method_definition_scanner.rb,
lib/coverband/integrations/background_middleware.rb,
lib/coverband.rb
Overview
Defined Under Namespace
Modules: Adapters, Collectors, RailsEagerLoad, Reporters, ResqueWorker, Utils
Classes: AtExit, Background, BackgroundMiddleware, Configuration, RackServerCheck, Railtie, ReportMiddleware
Constant Summary
collapse
- VERSION =
"6.1.5"
- COVERBAND_ALTERNATE_PATCH =
true
- SERVICE_CONFIG =
"./config/coverband_service.rb"
- CONFIG_FILE =
"./config/coverband.rb"
- RUNTIME_TYPE =
:runtime
- EAGER_TYPE =
:eager_loading
- MERGED_TYPE =
:merged
- TYPES =
[RUNTIME_TYPE, EAGER_TYPE]
- ALL_TYPES =
TYPES + [:merged]
- @@configured =
false
Class Method Summary
collapse
Class Method Details
.configuration ⇒ Object
73
74
75
|
# File 'lib/coverband.rb', line 73
def self.configuration
@configuration ||= Configuration.new
end
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/coverband.rb', line 43
def self.configure(file = nil)
configuration_file = file || ENV["COVERBAND_CONFIG"]
if configuration_file.nil?
configuration_file = coverband_service? ? SERVICE_CONFIG : CONFIG_FILE
end
configuration
if block_given?
yield(configuration)
elsif File.exist?(configuration_file)
load configuration_file
else
configuration.logger.debug("using default configuration") if Coverband.configuration.verbose
end
@@configured = true
coverage_instance.reset_instance
end
|
65
66
67
|
# File 'lib/coverband.rb', line 65
def self.configured?
@@configured
end
|
.coverband_service? ⇒ Boolean
61
62
63
|
# File 'lib/coverband.rb', line 61
def self.coverband_service?
!!File.exist?(SERVICE_CONFIG)
end
|
.eager_loading_coverage ⇒ Object
95
96
97
|
# File 'lib/coverband.rb', line 95
def self.eager_loading_coverage(...)
coverage_instance.eager_loading(...)
end
|
.eager_loading_coverage! ⇒ Object
91
92
93
|
# File 'lib/coverband.rb', line 91
def self.eager_loading_coverage!
coverage_instance.eager_loading!
end
|
.report_coverage ⇒ Object
69
70
71
|
# File 'lib/coverband.rb', line 69
def self.report_coverage
coverage_instance.report_coverage
end
|
.runtime_coverage! ⇒ Object
99
100
101
|
# File 'lib/coverband.rb', line 99
def self.runtime_coverage!
coverage_instance.runtime!
end
|
.tasks_to_ignore? ⇒ Boolean
85
86
87
88
89
|
# File 'lib/coverband.rb', line 85
def self.tasks_to_ignore?
defined?(Rake) &&
Rake.respond_to?(:application) &&
(Rake&.application&.top_level_tasks || []).any? { |task| Coverband::Configuration::IGNORE_TASKS.include?(task) }
end
|
.track_key(tracker_type, key) ⇒ Boolean
Track a key with the specified tracker.
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
# File 'lib/coverband.rb', line 108
def self.track_key(tracker_type, key)
return false unless key
supported_trackers = [:view_tracker, :translations_tracker, :routes_tracker]
unless supported_trackers.include?(tracker_type)
raise ArgumentError, "Unsupported tracker type: #{tracker_type}. Must be one of: #{supported_trackers.join(', ')}"
end
begin
tracker = configuration.send(tracker_type)
return false unless tracker && tracker.respond_to?(:track_key)
tracker.track_key(key)
true
rescue => e
configuration.logger.error "Coverband: Failed to track key '#{key}' with tracker '#{tracker_type}'. Error: #{e.message}"
false
end
end
|