Sha256: 5530b75feec0a18b54cbbd515f9a838daf2fbb787a9e3d7586aac8bd8e9c590b
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'yaml' module PuppetfileFixturesGenerator # Giant hack of a class because puppetlabs_spec_helper doesn't have # a good library implmentation to read .fixtures.yml. If that # changes in the future this class will be rewritten. class Fixtures # def initialize(fixtures_file, modules = nil, symlink_name = nil) @fixtures = Pathname.new(fixtures_file) @modules = modules @module_hash = { 'fixtures' => {} } @symlink_name = symlink_name end def modules_hash YAML.safe_load(@fixtures.read) end # def write(fixtures_pn = @fixtures) return 'Cannot write empty modules' if @modules.nil? # create hash of modules @module_hash['fixtures'] = @modules symlink_builder(@symlink_name) # convert hash to yaml yaml = @module_hash.to_yaml # write yaml fixtures_pn.write(yaml) end private # def symlink_builder(name) return if name.nil? @module_hash['fixtures']['symlinks'] = { name => '#{source_dir}' } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
puppetfile_fixtures_generator-0.2.1 | lib/puppetfile_fixtures_generator/fixtures.rb |