diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index f11ed242..b8a215af 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
-# on 2023-04-19 11:23:36 UTC using RuboCop version 1.48.1.
+# on 2023-05-02 15:02:35 UTC using RuboCop version 1.48.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
@@ -31,10 +31,10 @@ Metrics/BlockLength:
Metrics/CyclomaticComplexity:
Max: 12
-# Offense count: 43
+# Offense count: 38
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Metrics/MethodLength:
- Max: 31
+ Max: 28
# Offense count: 8
# Configuration parameters: AllowedMethods, AllowedPatterns.
@@ -46,36 +46,19 @@ Naming/AccessorMethodName:
Exclude:
- 'lib/puppet/type/vcsrepo.rb'
-# Offense count: 1
+# Offense count: 6
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Exclude:
+ - 'spec/classes/manage/git_spec.rb'
+ - 'spec/classes/manage/svn_spec.rb'
- 'spec/unit/puppet/provider/vcsrepo/git_spec.rb'
-# Offense count: 15
+# Offense count: 25
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
- Exclude:
- - '**/spec/features/**/*'
- - '**/spec/requests/**/*'
- - '**/spec/routing/**/*'
- - '**/spec/system/**/*'
- - '**/spec/views/**/*'
- - 'spec/acceptance/clone_repo_spec.rb'
- - 'spec/acceptance/create_repo_spec.rb'
- - 'spec/acceptance/multiple_remotes_spec.rb'
- - 'spec/acceptance/remove_repo_spec.rb'
- - 'spec/acceptance/revision_spec.rb'
- - 'spec/acceptance/svn_paths_spec.rb'
- - 'spec/acceptance/svn_spec.rb'
- - 'spec/unit/puppet/provider/vcsrepo/bzr_spec.rb'
- - 'spec/unit/puppet/provider/vcsrepo/cvs_spec.rb'
- - 'spec/unit/puppet/provider/vcsrepo/git_spec.rb'
- - 'spec/unit/puppet/provider/vcsrepo/hg_spec.rb'
- - 'spec/unit/puppet/provider/vcsrepo/p4_spec.rb'
- - 'spec/unit/puppet/provider/vcsrepo/svn_spec.rb'
- - 'spec/unit/puppet/type/vcsrepo_spec.rb'
+ Enabled: false
# Offense count: 43
# Configuration parameters: CountAsOne.
@@ -101,13 +84,15 @@ RSpec/MultipleMemoizedHelpers:
RSpec/NestedGroups:
Max: 4
-# Offense count: 55
+# Offense count: 60
# Configuration parameters: AllowedPatterns.
# AllowedPatterns: ^expect_, ^assert_
RSpec/NoExpectationExample:
Exclude:
- 'spec/acceptance/clone_repo_spec.rb'
- 'spec/acceptance/create_repo_spec.rb'
+ - 'spec/acceptance/manage/git_spec.rb'
+ - 'spec/acceptance/manage/svn_spec.rb'
- 'spec/acceptance/multiple_remotes_spec.rb'
- 'spec/acceptance/remove_repo_spec.rb'
- 'spec/acceptance/revision_spec.rb'
diff --git a/REFERENCE.md b/REFERENCE.md
index d3486f91..723cbeca 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -4,10 +4,87 @@
## Table of Contents
+### Classes
+
+* [`vcsrepo::manage::git`](#vcsrepomanagegit): Manage the Git source code manager package
+* [`vcsrepo::manage::svn`](#vcsrepomanagesvn): Manage the Subversion source code manager package
+
### Resource types
* [`vcsrepo`](#vcsrepo): A local version control repository
+## Classes
+
+### `vcsrepo::manage::git`
+
+Manage the Git source code manager package
+
+#### Examples
+
+##### simple include
+
+```puppet
+include vcsrepo::manage::git
+```
+
+#### Parameters
+
+The following parameters are available in the `vcsrepo::manage::git` class:
+
+* [`package_name`](#package_name)
+* [`package_ensure`](#package_ensure)
+
+##### `package_name`
+
+Data type: `Variant[String[1], Array[String[1]]]`
+
+name of package to manage
+
+Default value: `'git'`
+
+##### `package_ensure`
+
+Data type: `String[1]`
+
+ensure state of the package resource
+
+Default value: `'installed'`
+
+### `vcsrepo::manage::svn`
+
+Manage the Subversion source code manager package
+
+#### Examples
+
+##### simple include
+
+```puppet
+include vcsrepo::manage::svn
+```
+
+#### Parameters
+
+The following parameters are available in the `vcsrepo::manage::svn` class:
+
+* [`package_name`](#package_name)
+* [`package_ensure`](#package_ensure)
+
+##### `package_name`
+
+Data type: `Variant[String[1], Array[String[1]]]`
+
+name of package to manage
+
+Default value: `'subversion'`
+
+##### `package_ensure`
+
+Data type: `String[1]`
+
+ensure state of the package resource
+
+Default value: `'installed'`
+
## Resource types
### `vcsrepo`
@@ -40,7 +117,7 @@ The revision of the repository
##### `skip_hooks`
-Valid values: `true`, `false`
+Valid values: ``true``, ``false``
Explicitly skip any global hooks for this repository.
@@ -52,154 +129,154 @@ The source URI for the repository
The following parameters are available in the `vcsrepo` type.
-* [`basic_auth_password`](#-vcsrepo--basic_auth_password)
-* [`basic_auth_username`](#-vcsrepo--basic_auth_username)
-* [`branch`](#-vcsrepo--branch)
-* [`compression`](#-vcsrepo--compression)
-* [`configuration`](#-vcsrepo--configuration)
-* [`conflict`](#-vcsrepo--conflict)
-* [`cvs_rsh`](#-vcsrepo--cvs_rsh)
-* [`depth`](#-vcsrepo--depth)
-* [`excludes`](#-vcsrepo--excludes)
-* [`force`](#-vcsrepo--force)
-* [`fstype`](#-vcsrepo--fstype)
-* [`group`](#-vcsrepo--group)
-* [`http_proxy`](#-vcsrepo--http_proxy)
-* [`identity`](#-vcsrepo--identity)
-* [`keep_local_changes`](#-vcsrepo--keep_local_changes)
-* [`owner`](#-vcsrepo--owner)
-* [`p4config`](#-vcsrepo--p4config)
-* [`path`](#-vcsrepo--path)
-* [`provider`](#-vcsrepo--provider)
-* [`remote`](#-vcsrepo--remote)
-* [`safe_directory`](#-vcsrepo--safe_directory)
-* [`submodules`](#-vcsrepo--submodules)
-* [`trust_server_cert`](#-vcsrepo--trust_server_cert)
-* [`umask`](#-vcsrepo--umask)
-* [`user`](#-vcsrepo--user)
-
-##### `basic_auth_password`
+* [`basic_auth_password`](#basic_auth_password)
+* [`basic_auth_username`](#basic_auth_username)
+* [`branch`](#branch)
+* [`compression`](#compression)
+* [`configuration`](#configuration)
+* [`conflict`](#conflict)
+* [`cvs_rsh`](#cvs_rsh)
+* [`depth`](#depth)
+* [`excludes`](#excludes)
+* [`force`](#force)
+* [`fstype`](#fstype)
+* [`group`](#group)
+* [`http_proxy`](#http_proxy)
+* [`identity`](#identity)
+* [`keep_local_changes`](#keep_local_changes)
+* [`owner`](#owner)
+* [`p4config`](#p4config)
+* [`path`](#path)
+* [`provider`](#provider)
+* [`remote`](#remote)
+* [`safe_directory`](#safe_directory)
+* [`submodules`](#submodules)
+* [`trust_server_cert`](#trust_server_cert)
+* [`umask`](#umask)
+* [`user`](#user)
+
+##### `basic_auth_password`
HTTP Basic Auth password
-##### `basic_auth_username`
+##### `basic_auth_username`
HTTP Basic Auth username
-##### `branch`
+##### `branch`
The name of the branch to clone.
-##### `compression`
+##### `compression`
Compression level
-##### `configuration`
+##### `configuration`
The configuration directory to use
-##### `conflict`
+##### `conflict`
The action to take if conflicts exist between repository and working copy
-##### `cvs_rsh`
+##### `cvs_rsh`
The value to be used for the CVS_RSH environment variable.
-##### `depth`
+##### `depth`
The value to be used to do a shallow clone.
-##### `excludes`
+##### `excludes`
Local paths which shouldn't be tracked by the repository
-##### `force`
+##### `force`
-Valid values: `true`, `false`, `yes`, `no`
+Valid values: ``true``, ``false``, `yes`, `no`
Force repository creation, destroying any files on the path in the process.
-Default value: `false`
+Default value: ``false``
-##### `fstype`
+##### `fstype`
Filesystem type
-##### `group`
+##### `group`
The group/gid that owns the repository files
-##### `http_proxy`
+##### `http_proxy`
Sets the HTTP/HTTPS proxy for remote repo access
-##### `identity`
+##### `identity`
SSH identity file
-##### `keep_local_changes`
+##### `keep_local_changes`
-Valid values: `true`, `false`
+Valid values: ``true``, ``false``
Keep local changes on files tracked by the repository when changing revision
-Default value: `false`
+Default value: ``false``
-##### `owner`
+##### `owner`
The user/uid that owns the repository files
-##### `p4config`
+##### `p4config`
The Perforce P4CONFIG environment.
-##### `path`
+##### `path`
namevar
Absolute path to repository
-##### `provider`
+##### `provider`
The specific backend to use for this `vcsrepo` resource. You will seldom need to specify this --- Puppet will usually
discover the appropriate provider for your platform.
-##### `remote`
+##### `remote`
The remote repository to track
Default value: `origin`
-##### `safe_directory`
+##### `safe_directory`
-Valid values: `true`, `false`
+Valid values: ``true``, ``false``
Marks the current directory specified by the path parameter as a safe directory.
-Default value: `false`
+Default value: ``false``
-##### `submodules`
+##### `submodules`
-Valid values: `true`, `false`
+Valid values: ``true``, ``false``
Initialize and update each submodule in the repository.
-Default value: `true`
+Default value: ``true``
-##### `trust_server_cert`
+##### `trust_server_cert`
-Valid values: `true`, `false`
+Valid values: ``true``, ``false``
Trust server certificate
-Default value: `false`
+Default value: ``false``
-##### `umask`
+##### `umask`
Sets the umask to be used for all repo operations
-##### `user`
+##### `user`
The user to run for repository operations
diff --git a/manifests/manage/git.pp b/manifests/manage/git.pp
new file mode 100644
index 00000000..b1b8b003
--- /dev/null
+++ b/manifests/manage/git.pp
@@ -0,0 +1,18 @@
+# @summary Manage the Git source code manager package
+#
+# @param package_name
+# name of package to manage
+#
+# @param package_ensure
+# ensure state of the package resource
+#
+# @example simple include
+# include vcsrepo::manage::git
+class vcsrepo::manage::git (
+ Variant[String[1], Array[String[1]]] $package_name = 'git',
+ String[1] $package_ensure = 'installed',
+) {
+ package { $package_name:
+ ensure => $package_ensure,
+ }
+}
diff --git a/manifests/manage/svn.pp b/manifests/manage/svn.pp
new file mode 100644
index 00000000..b32d6a4f
--- /dev/null
+++ b/manifests/manage/svn.pp
@@ -0,0 +1,18 @@
+# @summary Manage the Subversion source code manager package
+#
+# @param package_name
+# name of package to manage
+#
+# @param package_ensure
+# ensure state of the package resource
+#
+# @example simple include
+# include vcsrepo::manage::svn
+class vcsrepo::manage::svn (
+ Variant[String[1], Array[String[1]]] $package_name = 'subversion',
+ String[1] $package_ensure = 'installed',
+) {
+ package { $package_name:
+ ensure => $package_ensure,
+ }
+}
diff --git a/spec/acceptance/manage/git_spec.rb b/spec/acceptance/manage/git_spec.rb
new file mode 100644
index 00000000..16bbc34e
--- /dev/null
+++ b/spec/acceptance/manage/git_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper_acceptance'
+
+describe 'vcsrepo::manage::git' do
+ let(:pp) { 'include vcsrepo::manage::git' }
+
+ it 'applies idempotently' do
+ idempotent_apply(pp)
+ end
+
+ it 'installs git' do
+ expect(package('git')).to be_installed
+ end
+end
diff --git a/spec/acceptance/manage/svn_spec.rb b/spec/acceptance/manage/svn_spec.rb
new file mode 100644
index 00000000..7672753b
--- /dev/null
+++ b/spec/acceptance/manage/svn_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper_acceptance'
+
+describe 'vcsrepo::manage::svn' do
+ let(:pp) { 'include vcsrepo::manage::svn' }
+
+ it 'applies idempotently' do
+ idempotent_apply(pp)
+ end
+
+ it 'installs svn' do
+ expect(package('subversion')).to be_installed
+ end
+end
diff --git a/spec/classes/manage/git_spec.rb b/spec/classes/manage/git_spec.rb
new file mode 100644
index 00000000..e2b03282
--- /dev/null
+++ b/spec/classes/manage/git_spec.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'vcsrepo::manage::git' do
+ on_supported_os.each do |os, os_facts|
+ context "on #{os}" do
+ let(:facts) { os_facts }
+
+ context 'when using defaults' do
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_package('git').with_ensure('installed') }
+ it { is_expected.to have_package_resource_count(1) }
+ end
+
+ context 'with params' do
+ let(:params) do
+ {
+ package_name: 'testing',
+ package_ensure: 'absent'
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_package('testing').with_ensure('absent') }
+ it { is_expected.to have_package_resource_count(1) }
+ end
+
+ context 'with multiple packages' do
+ let(:params) do
+ {
+ package_name: ['test', 'testing']
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_package('test').with_ensure('installed') }
+ it { is_expected.to contain_package('testing').with_ensure('installed') }
+ it { is_expected.to have_package_resource_count(2) }
+ end
+ end
+ end
+end
diff --git a/spec/classes/manage/svn_spec.rb b/spec/classes/manage/svn_spec.rb
new file mode 100644
index 00000000..c41b0c08
--- /dev/null
+++ b/spec/classes/manage/svn_spec.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'vcsrepo::manage::svn' do
+ on_supported_os.each do |os, os_facts|
+ context "on #{os}" do
+ let(:facts) { os_facts }
+
+ context 'when using defaults' do
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_package('subversion').with_ensure('installed') }
+ it { is_expected.to have_package_resource_count(1) }
+ end
+
+ context 'with params' do
+ let(:params) do
+ {
+ package_name: 'testing',
+ package_ensure: 'absent'
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_package('testing').with_ensure('absent') }
+ it { is_expected.to have_package_resource_count(1) }
+ end
+
+ context 'with multiple packages' do
+ let(:params) do
+ {
+ package_name: ['test', 'testing']
+ }
+ end
+
+ it { is_expected.to compile.with_all_deps }
+ it { is_expected.to contain_package('test').with_ensure('installed') }
+ it { is_expected.to contain_package('testing').with_ensure('installed') }
+ it { is_expected.to have_package_resource_count(2) }
+ end
+ end
+ end
+end
diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb
index 97820b54..cf1d88f9 100644
--- a/spec/spec_helper_acceptance_local.rb
+++ b/spec/spec_helper_acceptance_local.rb
@@ -30,11 +30,7 @@ def create_repo
c.before :suite do
case os[:family]
when 'redhat'
- if os[:release][0].include?('5')
- LitmusHelper.instance.run_shell('which git', expect_failures: true)
- LitmusHelper.instance.run_shell('rpm -ivh http://repository.it4i.cz/mirrors/repoforge/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm', expect_failures: true)
- LitmusHelper.instance.run_shell('yum install -y git')
- end
+ LitmusHelper.instance.apply_manifest("package { 'epel-release': ensure => present, }") if os[:name] != 'Fedora'
pp = <<-PP
package { 'git': ensure => present, }
package { 'subversion': ensure => present, }