Class: Wright::Provider::File

Inherits:
Wright::Provider show all
Defined in:
lib/wright/provider/file.rb

Overview

File provider. Used as a provider for Resource::File.

Constant Summary

Constants inherited from Wright::Provider

PROVIDER_DIR

Instance Method Summary collapse

Methods inherited from Wright::Provider

#initialize, #updated?

Constructor Details

This class inherits a constructor from Wright::Provider

Instance Method Details

#createvoid

This method returns an undefined value.

Creates or updates the file.

Raises:

  • (Errno::EISDIR)

    if there is already a directory with the specified name



19
20
21
22
23
24
25
# File 'lib/wright/provider/file.rb', line 19

def create
  fail_if_directory
  file = @resource.name
  unless_uptodate(:create, "file already created: '#{file}'") do
    create_file
  end
end

#removevoid

This method returns an undefined value.

Removes the file.

Raises:

  • (Errno::EISDIR)

    if there is a directory with the specified name



32
33
34
35
36
37
38
# File 'lib/wright/provider/file.rb', line 32

def remove
  fail_if_directory
  file = @resource.name
  unless_uptodate(:remove, "file already removed: '#{file}'") do
    remove_file
  end
end