6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ matrix:
env: PUPPET_VERSION=5.0
- rvm: 2.5.1
env: PUPPET_VERSION=5.0
- rvm: 2.5.1
env: PUPPET_VERSION=6.0
bundler_args: --without system_tests development
before_install:
- if [ $TRAVIS_RUBY_VERSION = 2.1.9 ] ; then
gem install -v 1.17.3 bundler --no-rdoc --no-ri;
fi
sudo: false
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## [5.0.0](https://github.com/theforeman/puppet-git/tree/5.0.0) (2019-01-10)

[Full Changelog](https://github.com/theforeman/puppet-git/compare/4.1.1...5.0.0)

**Breaking changes:**

- Use the correct type on $source [\#51](https://github.com/theforeman/puppet-git/pull/51) ([ekohl](https://github.com/ekohl))

**Implemented enhancements:**

- Support Puppet 6 [\#49](https://github.com/theforeman/puppet-git/pull/49) ([ekohl](https://github.com/ekohl))

**Closed issues:**

- git::repo usage example and definition don't match - I can't clone a repo right now [\#50](https://github.com/theforeman/puppet-git/issues/50)

**Merged pull requests:**

- Convert documentation to puppet-strings [\#53](https://github.com/theforeman/puppet-git/pull/53) ([ekohl](https://github.com/ekohl))

## [4.1.1](https://github.com/theforeman/puppet-git/tree/4.1.1) (2018-10-15)

[Full Changelog](https://github.com/theforeman/puppet-git/compare/4.1.0...4.1.1)
Expand Down
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ gem 'rspec-puppet', '~> 2.3'
gem 'rspec-puppet-facts', '>= 1.7'
gem 'puppetlabs_spec_helper', '>= 2.1.1'
gem 'puppet-lint', '>= 2'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-classes_and_types_beginning_with_digits-check'
gem 'puppet-lint-empty_string-check'
gem 'puppet-lint-file_ensure-check'
Expand All @@ -26,9 +25,9 @@ gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-version_comparison-check'
gem 'simplecov'
gem 'github_changelog_generator', {"git"=>"https://github.com/skywinder/github-changelog-generator", "ref"=>"20ee04ba1234e9e83eb2ffb5056e23d641c7a018", "groups"=>["development"]}
gem 'github_changelog_generator', {"git"=>"https://github.com/skywinder/github-changelog-generator", "ref"=>"20ee04ba1234e9e83eb2ffb5056e23d641c7a018", "groups"=>["development"]} if RUBY_VERSION >= '2.2.2'
gem 'puppet-blacksmith', '>= 4.1.0', {"groups"=>["development"]}
gem 'beaker', '>= 4.0.0', {"groups"=>["system_tests"]}
gem 'beaker', '>= 4.2.0', {"groups"=>["system_tests"]}
gem 'beaker-docker', {"groups"=>["system_tests"]}
gem 'beaker-hostgenerator', '>= 1.1.10', {"groups"=>["system_tests"]}
gem 'beaker-puppet', {"groups"=>["system_tests"]}
Expand All @@ -37,7 +36,6 @@ gem 'beaker-module_install_helper', {"groups"=>["system_tests"]}
gem 'beaker-puppet_install_helper', {"groups"=>["system_tests"]}
gem 'metadata-json-lint'
gem 'kafo_module_lint'
gem 'rgen'
gem 'parallel_tests'

# vim:ft=ruby
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Installs and configures git.

Part of the Foreman installer: http://github.com/theforeman/foreman-installer
Part of the Foreman installer: https://github.com/theforeman/foreman-installer

# Contributing

Expand All @@ -12,7 +12,7 @@ Part of the Foreman installer: http://github.com/theforeman/foreman-installer

# More info

See http://theforeman.org or at #theforeman irc channel on freenode
See https://theforeman.org or at #theforeman irc channel on freenode

Copyright (c) 2010-2013 Ohad Levy and their respective owners

Expand Down
18 changes: 6 additions & 12 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# =Class: git
# Sets up requirements for git
#
# Sets up requirements for git. See git::repo for more information on how to
# use this module.
# @see git::repo on how to use this module.
#
# == Parameters:
# @param bin The path to the git binary
#
# $bin:: The path to the git binary
# @param package Override the name of the git package(s) to include.
#
# $package:: Override the name of the git package(s) to include.
#
# $package_ensure:: Override the git package ensure
#
# == Usage:
#
# Example: Override the git version
# @param package_ensure Override the git package ensure
#
# @example Override the git version
# class { 'git':
# package_ensure => '2.1.0',
# }
Expand Down
42 changes: 24 additions & 18 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
# = Definition: git::repo
# Check out a git repository
#
# == Parameters:
# @param target
# Target folder
#
# $target:: Target folder. Required.
# @param bare
# Create a bare repository
#
# $bare:: Create a bare repository. Defaults to false.
# @param source
# Source to clone from. If not specified, no remote will be used.
#
# $source:: Source to clone from. If not specified, no remote will be used.
# @param user
# Owner of the repository
#
# $user:: Owner of the repository. Defaults to root.
# @param group
# Group of the repository
#
# $group:: Group of the repository. Defaults to root.
# @param mode
# Mode of the repository root
#
# $mode:: Mode of the repository root. Defaults to 0755.
# @param workdir
# The working directory while executing git
#
# $workdir:: The working directory while executing git
# @param args
# Optional arguments to the git command
#
# $args:: Optional arguments to the git command
#
# $bin:: Git binary
#
# == Usage:
# @param bin
# Git binary
#
# @example Clone a git repository
# git::repo {'mygit':
# target => '/home/user/puppet-git',
# source => 'git://github.com/theforeman/puppet-git.git',
# source => 'https://github.com/theforeman/puppet-git.git',
# user => 'user',
# }
#
define git::repo (
String $target,
Boolean $bare = false,
Boolean $source = false,
Optional[String] $source = undef,
String $user = 'root',
String $group = 'root',
String $mode = '0755',
Stdlib::Absolutepath $workdir = '/tmp',
Optional[String] $args = undef,
String $bin = $::git::bin,
String $bin = $git::bin,
) {
require ::git
require git

$args_real = $bare ? {
true => "${args} --bare",
Expand Down
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-git",
"version": "4.1.1",
"version": "5.0.0",
"author": "theforeman",
"summary": "git installation and configuration",
"license": "GPL-3.0+",
Expand All @@ -21,7 +21,7 @@
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 4.9.0 < 6.0.0"
"version_requirement": ">= 4.9.0 < 7.0.0"
}
],
"operatingsystem_support": [
Expand Down
15 changes: 0 additions & 15 deletions spec/acceptance/nodesets/vagrant_libvirt/centos-6.yml

This file was deleted.

15 changes: 0 additions & 15 deletions spec/acceptance/nodesets/vagrant_libvirt/centos-7.yml

This file was deleted.

15 changes: 0 additions & 15 deletions spec/acceptance/nodesets/vagrant_libvirt/debian-8.yml

This file was deleted.

15 changes: 0 additions & 15 deletions spec/acceptance/nodesets/vagrant_libvirt/debian-9.yml

This file was deleted.

41 changes: 30 additions & 11 deletions spec/defines/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

let(:title) { 'mygit' }

context 'with minimal parameters' do
context 'with inherited parameters' do
let :pre_condition do
'include ::git'
'include git'
end

let(:params) do
Expand All @@ -22,13 +22,32 @@

binary = ['DragonflyBSD', 'FreeBSD'].include?(facts[:osfamily]) ? '/usr/local/bin/git' : '/usr/bin/git'

it do
should contain_exec('git_repo_for_mygit').with(
'command' => "#{binary} init /tmp/somerepo",
'creates' => '/tmp/somerepo/.git',
'cwd' => '/tmp',
'user' => 'root',
)
context 'with minimal parameters' do
it do
should contain_exec('git_repo_for_mygit').with(
'command' => "#{binary} init /tmp/somerepo",
'creates' => '/tmp/somerepo/.git',
'cwd' => '/tmp',
'user' => 'root',
)
end
end

context 'with source' do
let(:params) { super().merge(source: 'https://git.example.com/repo.git') }

context 'full repo' do
it do should contain_exec('git_repo_for_mygit')
.with_command("#{binary} clone --recursive https://git.example.com/repo.git /tmp/somerepo")
end
end

context 'bare repo' do
let(:params) { super().merge(bare: true) }
it do should contain_exec('git_repo_for_mygit')
.with_command("#{binary} clone --bare --recursive https://git.example.com/repo.git /tmp/somerepo")
end
end
end
end

Expand All @@ -37,7 +56,7 @@
{
:target => '/tmp/somerepo.git',
:bare => true,
:source => false,
:source => 'https://git.example.com/repo.git',
:user => 'root',
:workdir => '/tmp',
:args => '-c core.sharedRepository=true',
Expand All @@ -47,7 +66,7 @@

it do
should contain_exec('git_repo_for_mygit').with(
'command' => "git init -c core.sharedRepository=true --bare /tmp/somerepo.git",
'command' => "git clone -c core.sharedRepository=true --bare --recursive https://git.example.com/repo.git /tmp/somerepo.git",
'creates' => '/tmp/somerepo.git/objects',
'cwd' => '/tmp',
'user' => 'root',
Expand Down
6 changes: 6 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# This file is managed centrally by modulesync
# https://github.com/theforeman/foreman-installer-modulesync

RSpec.configure do |c|
c.mock_with :rspec
end

require 'puppetlabs_spec_helper/module_spec_helper'

require 'rspec-puppet-facts'
Expand Down Expand Up @@ -62,3 +66,5 @@ def verify_concat_fragment_exact_contents(subject, title, expected_lines)
content = subject.resource('concat::fragment', title).send(:parameters)[:content]
expect(content.split(/\n/).reject { |line| line =~ /(^#|^$|^\s+#)/ }).to match_array(expected_lines)
end

Dir["./spec/support/**/*.rb"].sort.each { |f| require f }
9 changes: 9 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
ENV['PUPPET_INSTALL_TYPE'] ||= 'agent'
ENV['BEAKER_IS_PE'] ||= 'no'
ENV['BEAKER_PUPPET_COLLECTION'] ||= 'puppet6'
ENV['BEAKER_debug'] ||= 'true'
ENV['BEAKER_setfile'] ||= 'centos7-64{hostname=centos7-64.example.com}'
ENV['BEAKER_HYPERVISOR'] ||= 'docker'

require 'beaker-puppet'
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
Expand Down Expand Up @@ -44,3 +51,5 @@

include_examples 'a idempotent resource'
end

Dir["./spec/support/acceptance/**/*.rb"].sort.each { |f| require f }