Class: R10K::Deployment

Inherits:
Object
  • Object
show all
Defined in:
lib/r10k/deployment.rb,
lib/r10k/deployment/config.rb,
lib/r10k/deployment/source.rb,
lib/r10k/deployment/basedir.rb,
lib/r10k/deployment/environment.rb,
lib/r10k/deployment/config/loader.rb

Defined Under Namespace

Classes: Basedir, Config, Environment, Source

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Deployment

Returns a new instance of Deployment.



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

def initialize(config)
  @config = config

  load_environments
end

Class Method Details

.load_config(path) ⇒ R10K::Deployment

Generate a deployment object based on a config

Parameters:

  • path (String)

    The path to the deployment config

Returns:



15
16
17
18
# File 'lib/r10k/deployment.rb', line 15

def self.load_config(path)
  config = R10K::Deployment::Config.new(path)
  new(config)
end

Instance Method Details

#environmentsArray<R10K::Deployment::Environment>

Lazily load all environments

This instantiates the @_environments instance variable, but should not be used directly as it could be legitimately unset if we’re doing lazy loading.

Returns:



54
55
56
57
# File 'lib/r10k/deployment.rb', line 54

def environments
  load_environments if @_environments.nil?
  @_environments
end

#fetch_sourcesObject



26
27
28
29
30
31
# File 'lib/r10k/deployment.rb', line 26

def fetch_sources
  sources.each do |source|
    source.fetch_remote
  end
  load_environments
end

#sourcesArray<R10K::Deployment::Source>

Lazily load all sources

This instantiates the @_sources instance variable, but should not be used directly as it could be legitimately unset if we’re doing lazy loading.

Returns:



41
42
43
44
# File 'lib/r10k/deployment.rb', line 41

def sources
  load_sources if @_sources.nil?
  @_sources
end