module Halite::Converter::Chef

Converter module for cookbook-specific files. These are copied verbatim from the chef/ directory in the gem.

@since 1.0.0 @api private

Public Class Methods

write(gem_data, output_path) click to toggle source

Copy all files in the chef/ directory in the gem.

@param gem_data [Halite::Gem] Gem to generate from. @param output_path [String] Output path for the cookbook. @return [void]

# File lib/halite/converter/chef.rb, line 33
def self.write(gem_data, output_path)
  gem_data.each_file('chef') do |path, rel_path|
    dir_path = File.dirname(rel_path)
    FileUtils.mkdir_p(File.join(output_path, dir_path)) unless dir_path == '.'
    FileUtils.copy(path, File.join(output_path, rel_path), preserve: true)
  end
end