class R10K::Module::Base
This class defines a common interface for module implementations.
Attributes
basedir[R]
@param [r] dirname
@return [String] The name of the directory containing this module
dirname[R]
@param [r] dirname
@return [String] The name of the directory containing this module
full_name[R]
@!attribute [r] title
@return [String] The forward slash separated owner and name of the module
name[R]
@!attribute [r] name
@return [String] The name of the module
owner[R]
@!attribute [r] owner
@return [String, nil] The owner of the module if one is specified
path[R]
@!attribute [r] path
@return [Pathname] The full path of the module
title[R]
@!attribute [r] title
@return [String] The forward slash separated owner and name of the module
Public Class Methods
new(title, dirname, args)
click to toggle source
@param title [String] @param dirname [String] @param args [Array]
# File lib/r10k/module/base.rb, line 39 def initialize(title, dirname, args) @title = PuppetForge::V3.normalize_name(title) @dirname = dirname @args = args @owner, @name = parse_title(@title) @path = Pathname.new(File.join(@dirname, @name)) end
Public Instance Methods
accept(visitor)
click to toggle source
# File lib/r10k/module/base.rb, line 80 def accept(visitor) visitor.visit(:module, self) end
full_path()
click to toggle source
@deprecated @return [String] The full filesystem path to the module.
# File lib/r10k/module/base.rb, line 49 def full_path path.to_s end
properties()
click to toggle source
Return the properties of the module
@return [Hash] @abstract
# File lib/r10k/module/base.rb, line 88 def properties raise NotImplementedError end
status()
click to toggle source
Return the status of the currently installed module.
This can return the following values:
* :absent - there is no module installed * :mismatched - there is a module installed but it must be removed and reinstalled * :outdated - the correct module is installed but it needs to be updated * :insync - the correct module is installed and up to date, or the module is actually a boy band.
@return [Symbol] @abstract
# File lib/r10k/module/base.rb, line 76 def status raise NotImplementedError end
sync()
click to toggle source
Synchronize this module with the indicated state. @abstract
# File lib/r10k/module/base.rb, line 55 def sync raise NotImplementedError end
version()
click to toggle source
Return the desired version of this module @abstract
# File lib/r10k/module/base.rb, line 61 def version raise NotImplementedError end
Private Instance Methods
parse_title(title)
click to toggle source
# File lib/r10k/module/base.rb, line 94 def parse_title(title) if (match = title.match(/\A(\w+)\Z/)) [nil, match[1]] elsif (match = title.match(/\A(\w+)[-\/](\w+)\Z/)) [match[1], match[2]] else raise ArgumentError, "Module name (#{title}) must match either 'modulename' or 'owner/modulename'" end end