Class: R10K::Environment::Git

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Includes:
Logging
Defined in:
lib/r10k/environment/git.rb

Overview

This class implements an environment based on a Git branch.

Since:

  • 1.3.0

Constant Summary

Constants included from Logging

Logging::LOG_LEVELS

Instance Attribute Summary collapse

Attributes inherited from Base

#basedir, #dirname, #name, #path, #puppetfile

Instance Method Summary collapse

Methods included from Logging

debug_formatter, default_formatter, default_outputter, #logger, #logger_name, parse_level

Methods inherited from Base

#accept, #modules, #status

Constructor Details

#initialize(name, basedir, dirname, options = {}) ⇒ Git

Initialize the given SVN environment.

Parameters:

  • name (String)

    The unique name describing this environment.

  • basedir (String)

    The base directory where this environment will be created.

  • dirname (String)

    The directory name for this environment.

  • options (Hash) (defaults to: {})

    An additional set of options for this environment.

  • options (String) (defaults to: {})

    :remote The URL to the remote git repository

  • options (String) (defaults to: {})

    :ref The git reference to use for this environment

Since:

  • 1.3.0



35
36
37
38
39
40
41
# File 'lib/r10k/environment/git.rb', line 35

def initialize(name, basedir, dirname, options = {})
  super
  @remote = options[:remote]
  @ref    = options[:ref]

  @repo = R10K::Git::StatefulRepository.new(@ref, @remote, @basedir, @dirname)
end

Instance Attribute Details

#refObject (readonly)

Since:

  • 1.3.0



19
20
21
# File 'lib/r10k/environment/git.rb', line 19

def ref
  @ref
end

#remoteObject (readonly)

Since:

  • 1.3.0



15
16
17
# File 'lib/r10k/environment/git.rb', line 15

def remote
  @remote
end

#repoObject (readonly)

Since:

  • 1.3.0



24
25
26
# File 'lib/r10k/environment/git.rb', line 24

def repo
  @repo
end

Instance Method Details

#syncvoid

This method returns an undefined value.

Clone or update the given Git environment.

If the environment is being created for the first time, it will automatically update all modules to ensure that the environment is complete.

Since:

  • 1.3.0



50
51
52
53
# File 'lib/r10k/environment/git.rb', line 50

def sync
  @repo.sync
  @synced = true
end