Class: Binpacker::Config
- Inherits:
-
Object
show all
- Defined in:
- lib/binpacker/config.rb,
sig/binpacker/config.rbs
Constant Summary
collapse
- DEFAULTS =
{
"test_runner" => "rspec",
"workers" => "auto",
"test_granularity" => "file",
"timing_file" => "binpacker.timings",
"test_pattern" => "spec/**/*_spec.rb",
"test_exclude" => [],
"report_file" => nil,
"scheduler" => {
"strategy" => "static",
"steal_enabled" => false,
"algorithm" => "multifit"
}
}.freeze
- CI_ENV_VARS =
%w[CI GITHUB_ACTIONS GITLAB_CI JENKINS_HOME].freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(profile: nil, config_path: nil) ⇒ Config
Returns a new instance of Config.
27
28
29
30
31
32
|
# File 'lib/binpacker/config.rb', line 27
def initialize(profile: nil, config_path: nil)
@config_path = config_path || find_config
@raw = load_config
@profile = resolve_profile(profile)
@merged = build_profile(@profile)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/binpacker/config.rb', line 34
def method_missing(name, *)
key = name.to_s
if @merged.key?(key)
@merged[key]
else
super
end
end
|
Instance Attribute Details
#profile ⇒ String
Returns the value of attribute profile.
8
9
10
|
# File 'lib/binpacker/config.rb', line 8
def profile
@profile
end
|
Instance Method Details
#report_file ⇒ String?
10
|
# File 'sig/binpacker/config.rbs', line 10
def report_file: () -> String?
|
#respond_to_missing?(name) ⇒ Boolean
43
44
45
|
# File 'lib/binpacker/config.rb', line 43
def respond_to_missing?(name, *)
@merged.key?(name.to_s) || super
end
|
#scheduler ⇒ Object
47
48
49
|
# File 'lib/binpacker/config.rb', line 47
def scheduler
@merged["scheduler"]
end
|
#test_exclude ⇒ Array[String]
8
|
# File 'sig/binpacker/config.rbs', line 8
def test_exclude: () -> Array[String]
|
#test_granularity ⇒ String
9
|
# File 'sig/binpacker/config.rbs', line 9
def test_granularity: () -> String
|
#test_pattern ⇒ String
7
|
# File 'sig/binpacker/config.rbs', line 7
def test_pattern: () -> String
|
#test_runner ⇒ String
5
|
# File 'sig/binpacker/config.rbs', line 5
def test_runner: () -> String
|
#timing_file ⇒ String
6
|
# File 'sig/binpacker/config.rbs', line 6
def timing_file: () -> String
|
#worker_count ⇒ Integer
51
52
53
54
55
|
# File 'lib/binpacker/config.rb', line 51
def worker_count
workers = @merged["workers"]
return Etc.nprocessors if workers == "auto"
Integer(workers)
end
|