Sha256: f164ef7c0c10f115b91643d3e8c60dcdb88fd838a39ea8cf1f95d2fb736ed1c0

Contents?: true

Size: 697 Bytes

Versions: 11

Compression:

Stored size: 697 Bytes

Contents

require 'erb'

class ConfigBuilder::Loader::YAML_ERB < ConfigBuilder::Loader::YAML

  # Load configuration from a YAML file with ERB interpolation first
  #
  # @param file_path [String]
  #
  # @example the following config file will be processed by ERB first so it can
  # determine whether to use the environment variable 'VAGRANT_MANIFEST' or the
  # default value 'init.pp' for the puppet manifest file.
  #
  # ---
  #   provisioner:
  #     - type: puppet
  #       manifest_file: <%= ENV['VAGRANT_MANIFEST'] || 'init.pp' >
  #
  # @return [Hash]
  def yamlfile(file_path)
    ::YAML.load(::ERB.new(File.read(file_path)).result)
  end

  ConfigBuilder::Loader.register(:yaml_erb, self)
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
vagrant-config_builder-1.3.0 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-1.2.0 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-1.1.0 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-1.0.0 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-1.0.0.rc1 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-0.15.1 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-0.15.0 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-0.14.0 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-0.13.0 lib/config_builder/loader/yaml_erb.rb
vagrant-masonry-0.13.0 lib/config_builder/loader/yaml_erb.rb
vagrant-config_builder-0.12.0 lib/config_builder/loader/yaml_erb.rb