Module: Vial
- Defined in:
- lib/vial.rb,
lib/vial/dsl.rb,
lib/vial/erb.rb,
lib/vial/config.rb,
lib/vial/loader.rb,
lib/vial/railtie.rb,
lib/vial/version.rb,
lib/vial/compiler.rb,
lib/vial/registry.rb,
lib/vial/sequence.rb,
lib/vial/validator.rb,
lib/vial/definition.rb,
lib/vial/explain_id.rb,
lib/vial/explicit_id.rb,
lib/vial/yaml_emitter.rb,
lib/vial/fixture_analyzer.rb,
lib/vial/fixture_id_standardizer.rb
Defined Under Namespace
Modules: DSL, ExplainId
Classes: Compiler, Config, Definition, Erb, ExplicitId, FixtureAnalyzer, FixtureIdStandardizer, Loader, Railtie, Registry, Sequence, SequenceRef, ValidationError, Validator, YamlEmitter
Constant Summary
collapse
- VERSION =
"0.2026.8.6.0"
Class Method Summary
collapse
Class Method Details
.build_box ⇒ Object
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/vial.rb', line 78
def self.build_box
box = if defined?(Ruby::Box) && ENV['RUBY_BOX'] == '1'
Ruby::Box.new
else
Module.new
end
host_vial = self
box.singleton_class.define_method(:vial) do |name, **options, &block|
host_vial.define(name, **options, &block)
end
box
end
|
.clean!(**options) ⇒ Object
74
75
76
|
# File 'lib/vial.rb', line 74
def self.clean!(**options)
Compiler.new(config: config, **options).clean!
end
|
.compile!(dry_run: false, only: nil, **options) ⇒ Object
70
71
72
|
# File 'lib/vial.rb', line 70
def self.compile!(dry_run: false, only: nil, **options)
Compiler.new(config: config, **options).compile!(dry_run: dry_run, only: only)
end
|
.config ⇒ Object
45
46
47
|
# File 'lib/vial.rb', line 45
def self.config
@config ||= Config.new
end
|
49
50
51
52
|
# File 'lib/vial.rb', line 49
def self.configure
yield(config) if block_given?
config
end
|
.define(name, **options, &block) ⇒ Object
66
67
68
|
# File 'lib/vial.rb', line 66
def self.define(name, **options, &block)
registry.define(name, **options, &block)
end
|
.last_loaded_files ⇒ Object
58
59
60
|
# File 'lib/vial.rb', line 58
def self.last_loaded_files
@last_loaded_files ||= []
end
|
.load_sources!(source_paths: config.source_paths) ⇒ Object
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/vial.rb', line 93
def self.load_sources!(source_paths: config.source_paths)
reset_registry!
@last_loaded_files = []
box = build_box
Array(source_paths).each do |path|
next unless File.directory?(path)
Dir[File.join(path, '**', '*.vial.rb')].sort.each do |file|
@last_loaded_files << file
Loader.new(file, box: box).load
end
end
registry
end
|
.registry ⇒ Object
54
55
56
|
# File 'lib/vial.rb', line 54
def self.registry
@registry ||= Registry.new
end
|
.reset_registry! ⇒ Object
62
63
64
|
# File 'lib/vial.rb', line 62
def self.reset_registry!
@registry = Registry.new
end
|
.version ⇒ Object
41
42
43
|
# File 'lib/vial.rb', line 41
def self.version
VERSION
end
|