Module: Deployment::Methods::Fileops

Defined in:
lib/depengine/dsl/fileops.rb

Instance Method Summary collapse

Instance Method Details

#check_filelist(list, target) ⇒ Object

Check for the existence of all files in a given list in a given directory.

Parameters:

  • list - a CSV list of filenames to check for

  • target - the directory to check in.

Both are prefixed with the recipes :deploy_home.



48
49
50
51
# File 'lib/depengine/dsl/fileops.rb', line 48

def check_filelist(list, target)
  Processor.check_filelist(File.join($recipe_config[:deploy_home], list), \
                           File.join($recipe_config[:deploy_home], target))
end

#chmod(file, mode, options = {}) ⇒ Object

Changes permission modes on a given name/path.
The path will be prefixed with the recipes :deploy_home.

Parameters:

  • file - the file to change mode on

  • mode - the new file permission mode (e.g. “644”)

  • options
    • a hash with additional parameters. This is optional.



25
26
27
28
# File 'lib/depengine/dsl/fileops.rb', line 25

def chmod(file, mode, options = {})
  Processor.chmod(File.join($recipe_config[:deploy_home], file), \
                  mode, options)
end

#copy(source, target, options = {}) ⇒ Object

Copies a file or directory from a given source to a given target.
Both are prefixed with the recipes :deploy_home.



6
7
8
9
10
# File 'lib/depengine/dsl/fileops.rb', line 6

def copy(source, target, options = {})
  Processor.copy(File.join($recipe_config[:deploy_home], source), \
                 File.join($recipe_config[:deploy_home], target), \
                 options)
end

#mkdir(directory) ⇒ Object

Recursively creates a directory with a given name/path.
The path will be prefixed with the recipes :deploy_home.



14
15
16
# File 'lib/depengine/dsl/fileops.rb', line 14

def mkdir(directory)
  Processor.mkdir(File.join($recipe_config[:deploy_home], directory))
end

Creates a link from a given file to a given target.
The target be prefixed with the recipes :deploy_home.



38
39
40
# File 'lib/depengine/dsl/fileops.rb', line 38

def mklink(source, target)
  Processor.mklink(source, File.join($recipe_config[:deploy_home], target))
end

#remove(file) ⇒ Object

Removes a given name/path.
The path will be prefixed with the recipes :deploy_home.



32
33
34
# File 'lib/depengine/dsl/fileops.rb', line 32

def remove(file)
  Processor.remove(File.join($recipe_config[:deploy_home], file))
end