class R10K::Module::Tarball
This class defines a tarball source module implementation
Attributes
tarball[R]
@!attribute [r] tarball
@api private @return [R10K::Tarball]
Public Class Methods
implement?(name, args)
click to toggle source
# File lib/r10k/module/tarball.rb, line 10 def self.implement?(name, args) args.is_a?(Hash) && args[:type].to_s == 'tarball' rescue false end
new(name, dirname, opts, environment=nil)
click to toggle source
Calls superclass method
R10K::Module::Base::new
# File lib/r10k/module/tarball.rb, line 27 def initialize(name, dirname, opts, environment=nil) super setopts(opts, { # Standard option interface :source => :self, :version => :checksum, :type => ::R10K::Util::Setopts::Ignore, :overrides => :self, # Type-specific options :checksum => :self, }) @tarball = R10K::Tarball.new(name, @source, checksum: @checksum) end
statically_defined_version(name, args)
click to toggle source
# File lib/r10k/module/tarball.rb, line 16 def self.statically_defined_version(name, args) args[:version] || args[:checksum] end
Public Instance Methods
cachedir()
click to toggle source
Tarball caches are files, not directories. An important purpose of this method is to indicate where the cache “path” is, for locking/parallelism, so for the Tarball module type, the relevant path location is returned.
@return [String] The path this module will cache its tarball source to
# File lib/r10k/module/tarball.rb, line 98 def cachedir tarball.cache_path end
properties()
click to toggle source
Return the properties of the module
@return [Hash] @abstract
# File lib/r10k/module/tarball.rb, line 85 def properties { :expected => version, :actual => ((state = status) == :insync) ? version : state, :type => :tarball, } end
status()
click to toggle source
Return the status of the currently installed module.
@return [Symbol]
# File lib/r10k/module/tarball.rb, line 46 def status if not path.exist? :absent elsif not (tarball.cache_valid? && tarball.insync?(path.to_s)) :mismatched else :insync end end
sync(opts={})
click to toggle source
Synchronize this module with the indicated state. @param [Hash] opts Deprecated @return [Boolean] true if the module was updated, false otherwise
# File lib/r10k/module/tarball.rb, line 59 def sync(opts={}) tarball.get unless tarball.cache_valid? if should_sync? case status when :absent tarball.unpack(path.to_s) when :mismatched path.rmtree tarball.unpack(path.to_s) end maybe_delete_spec_dir true else false end end
version()
click to toggle source
Return the desired version of this module
# File lib/r10k/module/tarball.rb, line 77 def version @checksum || '(present)' end