class R10K::Environment::Tarball
Attributes
tarball[R]
@!attribute [r] tarball
@api private @return [R10K::Tarball]
Public Class Methods
new(name, basedir, dirname, options = {})
click to toggle source
Initialize the given tarball environment.
@param name [String] The unique name describing this environment. @param basedir [String] The base directory where this environment will be created. @param dirname [String] The directory name for this environment. @param options [Hash] An additional set of options for this environment.
@param options [String] :source Where to get the tarball from @param options [String] :version The sha256 digest of the tarball
Calls superclass method
R10K::Environment::WithModules::new
# File lib/r10k/environment/tarball.rb, line 25 def initialize(name, basedir, dirname, options = {}) super setopts(options, { # Standard option interface :type => ::R10K::Util::Setopts::Ignore, :source => :self, :version => :checksum, # Type-specific options :checksum => :self, }) @tarball = R10K::Tarball.new(name, @source, checksum: @checksum) end
Public Instance Methods
desired_contents()
click to toggle source
Returns an array of the full paths to all the content being managed. @note This implements a required method for the Purgeable mixin @return [Array<String>]
Calls superclass method
R10K::Environment::WithModules#desired_contents
# File lib/r10k/environment/tarball.rb, line 73 def desired_contents desired = [] desired += @tarball.paths.map { |entry| File.join(@full_path, entry) } desired += super end
path()
click to toggle source
# File lib/r10k/environment/tarball.rb, line 40 def path @path ||= Pathname.new(File.join(@basedir, @dirname)) end
signature()
click to toggle source
# File lib/r10k/environment/tarball.rb, line 64 def signature @checksum || @tarball.cache_checksum end
status()
click to toggle source
# File lib/r10k/environment/tarball.rb, line 54 def status if not path.exist? :absent elsif not (tarball.cache_valid? && tarball.insync?(path.to_s, ignore_untracked_files: true)) :mismatched else :insync end end
sync()
click to toggle source
# File lib/r10k/environment/tarball.rb, line 44 def sync tarball.get unless tarball.cache_valid? case status when :absent, :mismatched tarball.unpack(path.to_s) # Untracked files left behind from previous extractions are expected to # be deleted by r10k's purge facility. end end