lib/r10k/deployment.rb in r10k-1.2.4 vs lib/r10k/deployment.rb in r10k-1.3.0rc1
- old
+ new
@@ -1,15 +1,18 @@
+require 'yaml'
require 'r10k'
-require 'r10k/deployment/source'
-require 'r10k/deployment/config'
+require 'r10k/source'
-require 'yaml'
-
module R10K
class Deployment
# Model a full installation of module directories and modules.
+ require 'r10k/deployment/environment'
+ require 'r10k/deployment/basedir'
+ require 'r10k/deployment/source'
+ require 'r10k/deployment/config'
+
# Generate a deployment object based on a config
#
# @param path [String] The path to the deployment config
# @return [R10K::Deployment] The deployment loaded with the given config
def self.load_config(path)
@@ -17,28 +20,24 @@
new(config)
end
def initialize(config)
@config = config
-
- load_environments
end
- def fetch_sources
- sources.each do |source|
- source.fetch_remote
- end
- load_environments
+ def preload!
+ sources.each(&:preload!)
end
+ alias fetch_sources preload!
# 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.
#
- # @return [Array<R10K::Deployment::Source>] All repository sources
+ # @return [Array<R10K::Source::Base>] All repository sources
# specified in the config
def sources
load_sources if @_sources.nil?
@_sources
end
@@ -47,11 +46,11 @@
#
# This instantiates the @_environments instance variable, but should not be
# used directly as it could be legitimately unset if we're doing lazy
# loading.
#
- # @return [Array<R10K::Deployment::Environment>] All enviroments across
+ # @return [Array<R10K::Environment::Base>] All enviroments across
# all sources
def environments
load_environments if @_environments.nil?
@_environments
end
@@ -59,10 +58,10 @@
private
def load_sources
sources = @config.setting(:sources)
@_sources = sources.map do |(name, hash)|
- R10K::Deployment::Source.vivify(name, hash)
+ R10K::Source.from_hash(name, hash)
end
end
def load_environments
@_environments = []