Sha256: 4d5bd76f967d0253a262dea93209eeb7968bcacba0815c8bf6fbdda55c958e33

Contents?: true

Size: 363 Bytes

Versions: 2

Compression:

Stored size: 363 Bytes

Contents

module FileHelpers

  # Creates a YAML config file at the specified path.
  def create_yaml_file(path, options)
    create_file(path, YAML::dump(options))
  end

  def create_file(path, contents)
    dir = File.dirname(path)

    FileUtils.mkdir_p(dir) unless File.directory?(dir)

    File.open(path, 'w') do |file|
      file.write(contents)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tomatoharvest-0.1.1 spec/support/file_helpers.rb
tomatoharvest-0.1.0 spec/support/file_helpers.rb