lib/nanoc/base/repos/config_loader.rb in nanoc-4.3.4 vs lib/nanoc/base/repos/config_loader.rb in nanoc-4.3.5
- old
+ new
@@ -35,14 +35,22 @@
# Determine path
filename = self.class.config_filename_for_cwd
raise NoConfigFileFoundError if filename.nil?
# Read
- apply_parent_config(
- Nanoc::Int::Configuration.new(YAML.load_file(filename)),
- [filename],
- ).with_defaults
+ config =
+ apply_parent_config(
+ Nanoc::Int::Configuration.new(hash: YAML.load_file(filename)),
+ [filename],
+ ).with_defaults
+
+ # Load environment
+ if Nanoc::Feature.enabled?(Nanoc::Feature::ENVIRONMENTS)
+ config.with_environment
+ else
+ config
+ end
end
# @api private
def apply_parent_config(config, processed_paths = [])
parent_path = config[:parent_config_file]
@@ -58,10 +66,10 @@
if processed_paths.include?(parent_path)
raise CyclicalConfigFileError.new(parent_path)
end
# Load
- parent_config = Nanoc::Int::Configuration.new(YAML.load_file(parent_path))
+ parent_config = Nanoc::Int::Configuration.new(hash: YAML.load_file(parent_path))
full_parent_config = apply_parent_config(parent_config, processed_paths + [parent_path])
full_parent_config.merge(config.without(:parent_config_file))
end
end
end