Class: R10K::Deployment::Basedir

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

Instance Method Summary collapse

Methods included from Util::Purgeable

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

Constructor Details

#initialize(path, deployment) ⇒ Basedir

Represents a directory containing environments



10
11
12
13
# File 'lib/r10k/deployment/basedir.rb', line 10

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

Instance Method Details

#desired_contentsArray<String>

Note:

This implements a required method for the Purgeable mixin

List all environments that should exist in this basedir

Returns:

  • (Array<String>)


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

def desired_contents
  @keepers = []
  @deployment.sources.each do |source|
    next unless source.managed_directory == @path
    @keepers += source.desired_contents
  end
  @keepers
end

#managed_directoryString

Note:

This implements a required method for the Purgeable mixin

Return the path of the basedir

Returns:

  • (String)


20
21
22
# File 'lib/r10k/deployment/basedir.rb', line 20

def managed_directory
  @path
end