Method: RSpecPuppetSupport.git

Defined in:
lib/puppet-check/rspec_puppet_support.rb

.git(git_url, args = '') ⇒ Object

download external module dependency with git



88
89
90
91
92
93
94
95
96
97
98
# File 'lib/puppet-check/rspec_puppet_support.rb', line 88

def self.git(git_url, args = '')
  private_class_method :method
  # establish path to clone module to
  path = "spec/fixtures/modules/#{File.basename(git_url, '.git')}"
  # is the module present and already cloned with git? do a pull; otherwise, do a clone
  begin
    File.directory?("#{path}/.git") ? spawn("git -C #{path} pull") : spawn("git clone #{args} #{git_url} #{path}")
  rescue Errno::ENOENT
    warn 'git is not installed and cannot be used to retrieve dependency modules'
  end
end