Method: R10K::Module::Forge#status

Defined in:
lib/r10k/module/forge.rb

#statusSymbol

Determine the status of the forge module.

Returns:

  • (Symbol)

    :absent If the directory doesn’t exist

  • (Symbol)

    :mismatched If the module is not a forge module, or isn’t the right forge module

  • (Symbol)

    :outdated If the installed module is older than expected

  • (Symbol)

    :insync If the module is in the desired state



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/r10k/module/forge.rb', line 90

def status
  if not self.exist?
    # The module is not installed
    return :absent
  elsif not File.exist?(@path + 'metadata.json')
    # The directory exists but doesn't have a metadata file; it probably
    # isn't a forge module.
    return :mismatched
  end

  # The module is present and has a metadata file, read the metadata to
  # determine the state of the module.
  .read(@path + 'metadata.json')

  if not @title.tr('/','-') == .full_module_name.tr('/','-')

    # This is a forge module but the installed module is a different author
    # than the expected author.
    return :mismatched
  end

  if expected_version && (expected_version != .version)
    return :outdated
  end

  return :insync
end