Class: R10K::Deployment::Basedir Private

Inherits:
Object
  • Object
show all
Includes:
Util::Purgeable
Defined in:
lib/r10k/deployment/basedir.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Represents a directory containing environments

Instance Method Summary collapse

Methods included from Util::Purgeable

#current_contents, #pending_contents, #purge!, #stale_contents

Constructor Details

#initialize(path, deployment) ⇒ Basedir

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Basedir.



12
13
14
15
# File 'lib/r10k/deployment/basedir.rb', line 12

def initialize(path,deployment)
  @path       = path
  @deployment = deployment
end

Instance Method Details

#desired_contentsArray<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

This implements a required method for the Purgeable mixin

List all environments that should exist in this basedir

Returns:

  • (Array<String>)


29
30
31
32
33
34
35
36
# File 'lib/r10k/deployment/basedir.rb', line 29

def desired_contents
  @deployment.sources.inject([])do |list, source|
    if source.managed_directory == @path
      list += source.desired_contents
    end
    list
  end
end

#managed_directoryString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

This implements a required method for the Purgeable mixin

Return the path of the basedir

Returns:

  • (String)


22
23
24
# File 'lib/r10k/deployment/basedir.rb', line 22

def managed_directory
  @path
end