voxpupuli-test 8.0.0 → 8.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 346b627b7545574730d917660e968df59460018ce2334d2301be061d1b1aabca
4
- data.tar.gz: 7cd65cb60f03e97283bd7ed532b4255720df4f74ab0294309c2667707d35a94a
3
+ metadata.gz: 4dd40401d3073603368776f98a93973f4a174469d47197de13fb0f767b37f3a4
4
+ data.tar.gz: 8ff8722876be3395a538da16ffdbcdd280275d703e2de43b8583e7e08c533632
5
5
  SHA512:
6
- metadata.gz: 343acd06af0a11767fda3ddce8a4fd247545b2f04b1c85a6238c9c4d135ebe9f1079174abc135a9f33c2345fa9036fec831fbe58a4a971489322e5eec23c808e
7
- data.tar.gz: ed0d6b115b358c3d5a8b8ef6596428e633b7ae971d2fba7dd5f621787293c92adc1d9781f7c0f654d27bcf38399b0a3cb0b28da80a674e152e96b078d5c56349
6
+ metadata.gz: 7d31264b414af6224887a14b0ff6772daaf9f88899f5e289d5b55133e422f7597bad2d2a10c18d65887d5d16ec5069e585e852ab5e5c0ff876474c06b74ecdd4
7
+ data.tar.gz: 8309011ea81518fd8704a6f36afe30278305ca77d3e4d9ce42c42f51a0566b66fd5c39eb1b310029b1ae8e9529d9e4d64f2486414f0881b20a1a85f24d18cd68
data/README.md CHANGED
@@ -9,7 +9,8 @@
9
9
 
10
10
  This is a helper Gem to test the various Vox Pupuli Puppet modules. This Gem provides common functionality for rspec-puppet based testing. The aim is to reduce the boiler plate and need for modulesync.
11
11
 
12
- # Usage
12
+ ## Usage
13
+
13
14
  Add the `voxpupuli-test` Gem to your `Gemfile`:
14
15
 
15
16
  ```ruby
@@ -35,7 +36,17 @@ inherit_gem:
35
36
  voxpupuli-test: rubocop.yml
36
37
  ```
37
38
 
38
- # Fact handling
39
+ ## Rake tasks
40
+
41
+ ### `check:trailing_whitespace`
42
+
43
+ The rake task `check:trailing_whitespace` checks for trailing whitespace in all markdown files in the repository.
44
+ It has an exclude pattern for: `%r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)}`
45
+
46
+ We recommend using the GitHub style guide for markdown files, which includes no trailing whitespace.
47
+ See [GitHub Markdown Style Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)
48
+
49
+ ## Fact handling
39
50
 
40
51
  The recommended method is using [rspec-puppet-facts](https://github.com/mcanevet/rspec-puppet-facts) and is set up by default. This means the tests are writting as follows:
41
52
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rspec-puppet-facts'
2
4
  include RspecPuppetFacts
3
5
 
@@ -60,6 +62,7 @@ end
60
62
 
61
63
  def normalize_module_name(name)
62
64
  return unless name
65
+
63
66
  name.sub('-', '/')
64
67
  end
65
68
 
@@ -70,29 +73,25 @@ def add_stdlib_facts
70
73
 
71
74
  # Rough conversion of grepping in the puppet source:
72
75
  # grep defaultfor lib/puppet/provider/service/*.rb
73
- add_custom_fact :service_provider, ->(_os, facts) do
76
+ add_custom_fact :service_provider, lambda { |_os, facts|
74
77
  os = RSpec.configuration.facterdb_string_keys ? facts['os'] : facts[:os]
75
78
  case os['family'].downcase
76
- when 'archlinux'
79
+ when 'archlinux', 'debian', 'redhat'
77
80
  'systemd'
78
81
  when 'darwin'
79
82
  'launchd'
80
- when 'debian'
81
- 'systemd'
82
83
  when 'freebsd'
83
84
  'freebsd'
84
85
  when 'gentoo'
85
86
  'openrc'
86
87
  when 'openbsd'
87
88
  'openbsd'
88
- when 'redhat'
89
- 'systemd'
90
89
  when 'suse'
91
- os['release']['major'].to_i >= 12 ? 'systemd' : 'redhat'
90
+ (os['release']['major'].to_i >= 12) ? 'systemd' : 'redhat'
92
91
  when 'windows'
93
92
  'windows'
94
93
  else
95
94
  'init'
96
95
  end
97
- end
96
+ }
98
97
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppetlabs_spec_helper/rake_tasks'
2
4
 
3
- PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
5
+ PuppetLint.configuration.log_format = '%<path>s:%<line>s:%<check>s:%<KIND>s:%<message>s'
4
6
  # without this, puppet-lint always gives an exit code of 0
5
7
  PuppetLint.configuration.fail_on_warnings = true
6
8
 
@@ -12,15 +14,23 @@ task default: [:release_checks]
12
14
  namespace :check do
13
15
  desc 'Check for trailing whitespace'
14
16
  task :trailing_whitespace do
17
+ errors = []
18
+
15
19
  Dir.glob('**/*.md', File::FNM_DOTMATCH).sort.each do |filename|
16
20
  next if filename =~ %r{^((modules|acceptance|\.?vendor|spec/fixtures|pkg)/|REFERENCE.md)}
21
+
17
22
  File.foreach(filename).each_with_index do |line, index|
18
- if line =~ %r{\s\n$}
19
- puts "#{filename} has trailing whitespace on line #{index + 1}"
20
- exit 1
23
+ if line =~ /\s\n$/
24
+ errors << "#{filename} has trailing whitespace on line #{index + 1}"
21
25
  end
22
26
  end
23
27
  end
28
+
29
+ if errors.any?
30
+ errors.each { |error| puts error }
31
+ exit 1
32
+ end
24
33
  end
25
34
  end
35
+
26
36
  Rake::Task[:check].enhance ['check:trailing_whitespace']
@@ -1,11 +1,4 @@
1
- RSpec.configure do |config|
2
- # puppetlabs_spec_helper defaults to mocha but emits a deprecation warning
3
- # Vox Pupuli prefers rspec to avoid the deprecation warning unless explicitly
4
- # set
5
- if config.instance_variable_get(:@mock_framework).nil?
6
- config.mock_with :rspec
7
- end
8
- end
1
+ # frozen_string_literal: true
9
2
 
10
3
  require 'voxpupuli/test/facts'
11
4
  require 'puppetlabs_spec_helper/module_spec_helper'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voxpupuli-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0
4
+ version: 8.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vox Pupuli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-12 00:00:00.000000000 Z
11
+ date: 2024-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -157,33 +157,33 @@ dependencies:
157
157
  - !ruby/object:Gem::Version
158
158
  version: 1.50.0
159
159
  - !ruby/object:Gem::Dependency
160
- name: rubocop-rspec
160
+ name: rubocop-rake
161
161
  requirement: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - "~>"
164
164
  - !ruby/object:Gem::Version
165
- version: 2.20.0
165
+ version: 0.6.0
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: 2.20.0
172
+ version: 0.6.0
173
173
  - !ruby/object:Gem::Dependency
174
- name: rubocop-rake
174
+ name: rubocop-rspec
175
175
  requirement: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: 0.6.0
179
+ version: 2.20.0
180
180
  type: :runtime
181
181
  prerelease: false
182
182
  version_requirements: !ruby/object:Gem::Requirement
183
183
  requirements:
184
184
  - - "~>"
185
185
  - !ruby/object:Gem::Version
186
- version: 0.6.0
186
+ version: 2.20.0
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: voxpupuli-puppet-lint-plugins
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -222,7 +222,6 @@ extra_rdoc_files: []
222
222
  files:
223
223
  - LICENSE
224
224
  - README.md
225
- - lib/voxpupuli/test.rb
226
225
  - lib/voxpupuli/test/facts.rb
227
226
  - lib/voxpupuli/test/rake.rb
228
227
  - lib/voxpupuli/test/spec_helper.rb
File without changes