Class: Rdm::SourceParser
- Inherits:
-
Object
- Object
- Rdm::SourceParser
- Defined in:
- lib/rdm/source_parser.rb
Defined Under Namespace
Classes: SourceValidationError
Instance Attribute Summary collapse
-
#source_path ⇒ Object
Returns the value of attribute source_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(source_path, stdout) ⇒ SourceParser
constructor
A new instance of SourceParser.
-
#parse_source_content ⇒ Rdm::Source
Parse source file and return Source object.
-
#read_and_init_source ⇒ Rdm::Source
Read source file, parse and init it’s packages and configs.
Constructor Details
#initialize(source_path, stdout) ⇒ SourceParser
Returns a new instance of SourceParser.
13 14 15 16 |
# File 'lib/rdm/source_parser.rb', line 13 def initialize(source_path, stdout) @source_path = source_path @stdout = stdout || STDOUT end |
Instance Attribute Details
#source_path ⇒ Object
Returns the value of attribute source_path.
11 12 13 |
# File 'lib/rdm/source_parser.rb', line 11 def source_path @source_path end |
Class Method Details
.read_and_init_source(source_path, stdout: nil) ⇒ Object
6 7 8 |
# File 'lib/rdm/source_parser.rb', line 6 def read_and_init_source(source_path, stdout: nil) Rdm::SourceParser.new(source_path, stdout).read_and_init_source end |
Instance Method Details
#parse_source_content ⇒ Rdm::Source
Parse source file and return Source object
39 40 41 42 43 |
# File 'lib/rdm/source_parser.rb', line 39 def parse_source_content source = Rdm::Source.new(root_path: root_path) source.instance_eval(source_content) source end |
#read_and_init_source ⇒ Rdm::Source
Read source file, parse and init it’s packages and configs
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rdm/source_parser.rb', line 21 def read_and_init_source source = parse_source_content # Setup Rdm if block = source.setup_block Rdm.setup(&block) end validate_rdm_settings! init_and_set_packages(source) init_and_set_configs(source) init_and_set_env_variables(source) source.init_with(packages: packages, configs: configs) source end |