beaker-module_install_helper 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +33 -11
- data/.rubocop.yml +5 -43
- data/.rubocop_todo.yml +25 -0
- data/CHANGELOG.md +32 -4
- data/Gemfile +7 -6
- data/LICENSE +197 -11
- data/Rakefile +12 -7
- data/beaker-module_install_helper.gemspec +11 -9
- data/lib/beaker/module_install_helper.rb +162 -154
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/beaker/module_install_helper_spec.rb +43 -16
- metadata +39 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb8d10b9ccd4abf59f343eaf4531129ad640ba26ad3a1745a6f713985e4f7f6f
|
4
|
+
data.tar.gz: b35c1819e456c75dd5a79d5b8bd06a65f1646a6a76d60a11477e35d776bc297d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94f450fa00745b80742289722a3480fab58c6453eda89b5f14b0ef898efc3d0feb9f42c8e58ceeb51514850210f75a4ab3a310dff67a79d2d5e967ce6b5d2c7a
|
7
|
+
data.tar.gz: ab84e00a031ed55a5c590f9e221cc180cf718b634ce70de2102b5d3747bbc2750030403879f2c606f158e9b2f6f0e255f3f4cf54e512e35d4689af7a11bcfed1
|
data/.github/dependabot.yml
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
version: 2
|
2
2
|
updates:
|
3
|
+
# raise PRs for gem updates
|
3
4
|
- package-ecosystem: bundler
|
4
5
|
directory: "/"
|
5
6
|
schedule:
|
6
7
|
interval: daily
|
7
8
|
time: "13:00"
|
8
9
|
open-pull-requests-limit: 10
|
10
|
+
|
11
|
+
# Maintain dependencies for GitHub Actions
|
12
|
+
- package-ecosystem: github-actions
|
13
|
+
directory: "/"
|
14
|
+
schedule:
|
15
|
+
interval: daily
|
16
|
+
time: "13:00"
|
17
|
+
open-pull-requests-limit: 10
|
@@ -10,14 +10,14 @@ jobs:
|
|
10
10
|
runs-on: ubuntu-latest
|
11
11
|
if: github.repository_owner == 'voxpupuli'
|
12
12
|
steps:
|
13
|
-
- uses: actions/checkout@
|
13
|
+
- uses: actions/checkout@v3
|
14
14
|
- name: Install Ruby 3.0
|
15
15
|
uses: ruby/setup-ruby@v1
|
16
16
|
with:
|
17
17
|
ruby-version: '3.0'
|
18
18
|
bundler: 'none'
|
19
19
|
- name: Build gem
|
20
|
-
run: gem build *.gemspec
|
20
|
+
run: gem build --strict --verbose *.gemspec
|
21
21
|
- name: Publish gem to rubygems.org
|
22
22
|
run: gem push *.gem
|
23
23
|
env:
|
data/.github/workflows/test.yml
CHANGED
@@ -1,35 +1,57 @@
|
|
1
1
|
name: Test
|
2
2
|
|
3
3
|
on:
|
4
|
-
|
5
|
-
|
4
|
+
pull_request: {}
|
5
|
+
push:
|
6
|
+
branches:
|
7
|
+
- master
|
6
8
|
|
7
9
|
env:
|
8
10
|
BUNDLE_WITHOUT: release
|
9
11
|
|
10
12
|
jobs:
|
11
|
-
|
13
|
+
rubocop:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v3
|
17
|
+
- name: Install Ruby ${{ matrix.ruby }}
|
18
|
+
uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: "2.7"
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Run Rubocop
|
23
|
+
run: bundle exec rake rubocop
|
24
|
+
spec:
|
12
25
|
runs-on: ubuntu-latest
|
13
26
|
strategy:
|
14
27
|
fail-fast: false
|
15
28
|
matrix:
|
16
29
|
include:
|
17
|
-
- ruby: "2.4"
|
18
|
-
- ruby: "2.5"
|
19
|
-
- ruby: "2.6"
|
20
30
|
- ruby: "2.7"
|
21
|
-
- ruby: "3.0"
|
22
31
|
coverage: "yes"
|
32
|
+
- ruby: "3.0"
|
33
|
+
- ruby: "3.1"
|
34
|
+
- ruby: "3.2"
|
23
35
|
env:
|
24
36
|
COVERAGE: ${{ matrix.coverage }}
|
37
|
+
name: RSpec - Ruby ${{ matrix.ruby }}
|
25
38
|
steps:
|
26
|
-
- uses: actions/checkout@
|
39
|
+
- uses: actions/checkout@v3
|
27
40
|
- name: Install Ruby ${{ matrix.ruby }}
|
28
41
|
uses: ruby/setup-ruby@v1
|
29
42
|
with:
|
30
43
|
ruby-version: ${{ matrix.ruby }}
|
31
44
|
bundler-cache: true
|
32
|
-
- name:
|
45
|
+
- name: spec tests
|
33
46
|
run: bundle exec rake spec
|
34
|
-
- name:
|
35
|
-
run:
|
47
|
+
- name: Build gem
|
48
|
+
run: gem build --strict --verbose *.gemspec
|
49
|
+
|
50
|
+
tests:
|
51
|
+
needs:
|
52
|
+
- spec
|
53
|
+
- rubocop
|
54
|
+
runs-on: ubuntu-latest
|
55
|
+
name: Test suite
|
56
|
+
steps:
|
57
|
+
- run: echo Test suite completed
|
data/.rubocop.yml
CHANGED
@@ -1,46 +1,8 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
inherit_from: .rubocop_todo.yml
|
2
3
|
|
3
|
-
|
4
|
-
|
4
|
+
inherit_gem:
|
5
|
+
voxpupuli-rubocop: rubocop.yml
|
5
6
|
|
6
|
-
|
7
|
-
Enabled: false
|
8
|
-
|
9
|
-
RSpec/AnyInstance:
|
10
|
-
Enabled: false
|
11
|
-
|
12
|
-
RSpec/DescribeClass:
|
13
|
-
Enabled: false
|
14
|
-
|
15
|
-
RSpec/NestedGroups:
|
16
|
-
Enabled: false
|
17
|
-
|
18
|
-
Lint/AmbiguousRegexpLiteral:
|
19
|
-
Enabled: false
|
20
|
-
|
21
|
-
Style/ClassAndModuleChildren:
|
22
|
-
Enabled: false
|
23
|
-
|
24
|
-
Style/GlobalVars:
|
25
|
-
Enabled: false
|
26
|
-
|
27
|
-
Style/RegexpLiteral:
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Bundler/DuplicatedGem:
|
31
|
-
Enabled: false
|
32
|
-
|
33
|
-
Metrics/AbcSize:
|
34
|
-
Enabled: false
|
35
|
-
|
36
|
-
Metrics/BlockLength:
|
37
|
-
Enabled: false
|
38
|
-
|
39
|
-
Metrics/LineLength:
|
40
|
-
Max: 100
|
41
|
-
|
42
|
-
Metrics/MethodLength:
|
43
|
-
Enabled: false
|
44
|
-
|
45
|
-
Metrics/ModuleLength:
|
7
|
+
Style/Documentation:
|
46
8
|
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2023-05-05 15:14:01 UTC using RuboCop version 1.50.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 10
|
10
|
+
RSpec/AnyInstance:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/unit/beaker/module_install_helper_spec.rb'
|
13
|
+
|
14
|
+
# Offense count: 2
|
15
|
+
# Configuration parameters: Max.
|
16
|
+
RSpec/IndexedLet:
|
17
|
+
Exclude:
|
18
|
+
- 'spec/unit/beaker/module_install_helper_spec.rb'
|
19
|
+
|
20
|
+
# Offense count: 7
|
21
|
+
# Configuration parameters: AllowedVariables.
|
22
|
+
Style/GlobalVars:
|
23
|
+
Exclude:
|
24
|
+
- 'lib/beaker/module_install_helper.rb'
|
25
|
+
- 'spec/unit/beaker/module_install_helper_spec.rb'
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,38 @@
|
|
1
|
-
# Changelog
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
3
|
+
# All notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
-
## [1.0.0](https://github.com/voxpupuli/beaker-module_install_helper/tree/1.0.0) (2021-11-03)
|
6
5
|
|
7
|
-
[
|
6
|
+
## [2.0.0](https://github.com/voxpupuli/beaker-module_install_helper/tree/2.0.0) (2023-05-05)
|
7
|
+
|
8
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-module_install_helper/compare/v1.0.0...2.0.0)
|
9
|
+
|
10
|
+
**Breaking changes:**
|
11
|
+
|
12
|
+
- Drop Ruby 2.5/2.6 support; use voxpupuli-rubocop [\#42](https://github.com/voxpupuli/beaker-module_install_helper/pull/42) ([bastelfreak](https://github.com/bastelfreak))
|
13
|
+
- add rubocop to CI / bump min ruby to 2.5 [\#33](https://github.com/voxpupuli/beaker-module_install_helper/pull/33) ([jhoblitt](https://github.com/jhoblitt))
|
14
|
+
|
15
|
+
**Implemented enhancements:**
|
16
|
+
|
17
|
+
- CI: Apply Vox Pupuli best practices & Add Ruby 3.2 support [\#39](https://github.com/voxpupuli/beaker-module_install_helper/pull/39) ([bastelfreak](https://github.com/bastelfreak))
|
18
|
+
|
19
|
+
**Closed issues:**
|
20
|
+
|
21
|
+
- Forge stubbing doesn't work for non-forge forges [\#23](https://github.com/voxpupuli/beaker-module_install_helper/issues/23)
|
22
|
+
|
23
|
+
**Merged pull requests:**
|
24
|
+
|
25
|
+
- CI: Build gems with strictness and verbosity & dependencies: add version constraints [\#43](https://github.com/voxpupuli/beaker-module_install_helper/pull/43) ([bastelfreak](https://github.com/bastelfreak))
|
26
|
+
- Update beaker-puppet requirement from ~\> 1.0 to \>= 1, \< 3 [\#41](https://github.com/voxpupuli/beaker-module_install_helper/pull/41) ([dependabot[bot]](https://github.com/apps/dependabot))
|
27
|
+
- Bump actions/checkout from 2 to 3 [\#40](https://github.com/voxpupuli/beaker-module_install_helper/pull/40) ([dependabot[bot]](https://github.com/apps/dependabot))
|
28
|
+
- dependabot: check for github actions and gems [\#38](https://github.com/voxpupuli/beaker-module_install_helper/pull/38) ([bastelfreak](https://github.com/bastelfreak))
|
29
|
+
- Rubocop: Apply Vox Pupuli best practices & fix violations [\#37](https://github.com/voxpupuli/beaker-module_install_helper/pull/37) ([bastelfreak](https://github.com/bastelfreak))
|
30
|
+
- Fix incorrect Apache-2 license [\#36](https://github.com/voxpupuli/beaker-module_install_helper/pull/36) ([bastelfreak](https://github.com/bastelfreak))
|
31
|
+
- add basic Net::HTTP error handling [\#34](https://github.com/voxpupuli/beaker-module_install_helper/pull/34) ([jhoblitt](https://github.com/jhoblitt))
|
32
|
+
|
33
|
+
## [v1.0.0](https://github.com/voxpupuli/beaker-module_install_helper/tree/v1.0.0) (2021-11-03)
|
34
|
+
|
35
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-module_install_helper/compare/v0.1.7...v1.0.0)
|
8
36
|
|
9
37
|
**Closed issues:**
|
10
38
|
|
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
@@ -7,8 +9,6 @@ group :test do
|
|
7
9
|
gem 'bundler', '>= 1.9', '< 3'
|
8
10
|
gem 'rake', '~> 13.0'
|
9
11
|
gem 'rspec', '~> 3.0'
|
10
|
-
gem 'rubocop', require: false
|
11
|
-
gem 'rubocop-rspec', require: false
|
12
12
|
end
|
13
13
|
|
14
14
|
group :development do
|
@@ -16,11 +16,12 @@ group :development do
|
|
16
16
|
gem 'pry-byebug'
|
17
17
|
end
|
18
18
|
|
19
|
-
group :coverage, optional: ENV
|
20
|
-
gem '
|
21
|
-
gem '
|
19
|
+
group :coverage, optional: ENV.fetch('COVERAGE', nil) != 'yes' do
|
20
|
+
gem 'codecov', require: false
|
21
|
+
gem 'simplecov-console', require: false
|
22
22
|
end
|
23
23
|
|
24
24
|
group :release do
|
25
|
-
gem '
|
25
|
+
gem 'faraday-retry', require: false
|
26
|
+
gem 'github_changelog_generator', require: false
|
26
27
|
end
|
data/LICENSE
CHANGED
@@ -1,15 +1,201 @@
|
|
1
|
-
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
2
4
|
|
3
|
-
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
4
6
|
|
5
|
-
|
6
|
-
you may not use this file except in compliance with the License.
|
7
|
-
You may obtain a copy of the License at
|
7
|
+
1. Definitions.
|
8
8
|
|
9
|
-
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/Rakefile
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
|
-
task default: %i[lint spec]
|
5
|
-
|
6
4
|
require 'rubocop/rake_task'
|
7
|
-
|
8
|
-
RuboCop::RakeTask.new
|
9
|
-
t.requires << 'rubocop-rspec'
|
10
|
-
end
|
5
|
+
|
6
|
+
RuboCop::RakeTask.new
|
11
7
|
|
12
8
|
require 'rspec/core/rake_task'
|
13
9
|
desc 'Run spec tests using rspec'
|
@@ -23,10 +19,19 @@ rescue LoadError
|
|
23
19
|
# github_changelog_generator isn't available, so we won't define a rake task with it
|
24
20
|
else
|
25
21
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
26
|
-
config.header =
|
22
|
+
config.header = <<-HEADER
|
23
|
+
# Changelog
|
24
|
+
|
25
|
+
# All notable changes to this project will be documented in this file.
|
26
|
+
HEADER
|
27
27
|
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
|
28
28
|
config.user = 'voxpupuli'
|
29
29
|
config.project = 'beaker-module_install_helper'
|
30
30
|
config.future_release = Gem::Specification.load("#{config.project}.gemspec").version
|
31
31
|
end
|
32
32
|
end
|
33
|
+
|
34
|
+
task default: %w[
|
35
|
+
rubocop
|
36
|
+
spec
|
37
|
+
]
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
|
4
6
|
Gem::Specification.new do |spec|
|
5
7
|
spec.name = 'beaker-module_install_helper'
|
6
|
-
spec.version = '
|
8
|
+
spec.version = '2.0.0'
|
7
9
|
spec.authors = ['Vox Pupuli']
|
8
10
|
spec.email = ['voxpupuli@groups.io']
|
9
11
|
|
@@ -17,18 +19,18 @@ Gem::Specification.new do |spec|
|
|
17
19
|
spec.license = 'Apache-2.0'
|
18
20
|
|
19
21
|
spec.files = `git ls-files`.split("\n")
|
20
|
-
spec.
|
21
|
-
|
22
|
-
.split("\n") \
|
22
|
+
spec.executables = `git ls-files -- bin/*`
|
23
|
+
.split("\n")
|
23
24
|
.map { |f| File.basename(f) }
|
24
25
|
spec.require_paths = ['lib']
|
25
26
|
|
26
27
|
## Testing dependencies
|
27
|
-
spec.add_development_dependency 'rspec'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
29
|
+
spec.add_development_dependency 'voxpupuli-rubocop', '~> 1.2'
|
28
30
|
|
29
31
|
# Run time dependencies
|
30
|
-
spec.add_runtime_dependency 'beaker', '>= 2.0'
|
31
|
-
spec.add_runtime_dependency 'beaker-puppet', '
|
32
|
+
spec.add_runtime_dependency 'beaker', '>= 2.0', '< 6'
|
33
|
+
spec.add_runtime_dependency 'beaker-puppet', '>= 1', '< 3'
|
32
34
|
|
33
|
-
spec.required_ruby_version = '>= 2.
|
35
|
+
spec.required_ruby_version = '>= 2.7.0'
|
34
36
|
end
|
@@ -1,208 +1,216 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'beaker'
|
2
4
|
require 'beaker-puppet'
|
3
5
|
|
4
6
|
# Provides method for use in module test setup to install the module under
|
5
7
|
# test and it's dependencies on the specified hosts
|
6
|
-
module Beaker
|
7
|
-
|
8
|
+
module Beaker
|
9
|
+
module ModuleInstallHelper
|
10
|
+
include Beaker::DSL
|
11
|
+
|
12
|
+
# This method calls the install_module_on method for each host which is a
|
13
|
+
# master, or if no master is present, on all agent nodes.
|
14
|
+
def install_module(opts = {})
|
15
|
+
install_module_on(hosts_to_install_module_on, opts)
|
16
|
+
end
|
8
17
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
18
|
+
# This method will install the module under test on the specified host(s) from
|
19
|
+
# the source on the local machine
|
20
|
+
def install_module_on(host, opts = {})
|
21
|
+
opts = {
|
22
|
+
source: $module_source_dir,
|
23
|
+
module_name: module_name_from_metadata,
|
24
|
+
}.merge(opts)
|
25
|
+
copy_module_to(host, opts)
|
26
|
+
end
|
14
27
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
module_name: module_name_from_metadata
|
21
|
-
}.merge(opts)
|
22
|
-
copy_module_to(host, opts)
|
23
|
-
end
|
28
|
+
# This method calls the install_module_dependencies_on method for each
|
29
|
+
# host which is a master, or if no master is present, on all agent nodes.
|
30
|
+
def install_module_dependencies(deps = nil)
|
31
|
+
install_module_dependencies_on(hosts_to_install_module_on, deps)
|
32
|
+
end
|
24
33
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
34
|
+
# This method will install the module under tests module dependencies on the
|
35
|
+
# specified host(s) from the dependencies list in metadata.json
|
36
|
+
def install_module_dependencies_on(hsts, deps = nil)
|
37
|
+
hsts = [hsts] if hsts.is_a?(Hash)
|
38
|
+
hsts = [hsts] unless hsts.respond_to?(:each)
|
39
|
+
deps = module_dependencies_from_metadata if deps.nil?
|
30
40
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
deps = deps.nil? ? module_dependencies_from_metadata : deps
|
37
|
-
|
38
|
-
fh = ENV['BEAKER_FORGE_HOST']
|
39
|
-
|
40
|
-
hsts.each do |host|
|
41
|
-
deps.each do |dep|
|
42
|
-
if fh.nil?
|
43
|
-
install_puppet_module_via_pmt_on(host, dep)
|
44
|
-
else
|
45
|
-
with_forge_stubbed_on(host) do
|
41
|
+
fh = ENV.fetch('BEAKER_FORGE_HOST', nil)
|
42
|
+
|
43
|
+
hsts.each do |host|
|
44
|
+
deps.each do |dep|
|
45
|
+
if fh.nil?
|
46
46
|
install_puppet_module_via_pmt_on(host, dep)
|
47
|
+
else
|
48
|
+
with_forge_stubbed_on(host) do
|
49
|
+
install_puppet_module_via_pmt_on(host, dep)
|
50
|
+
end
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
51
|
-
end
|
52
55
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
+
def install_module_from_forge(mod_name, ver_req)
|
57
|
+
install_module_from_forge_on(hosts_to_install_module_on, mod_name, ver_req)
|
58
|
+
end
|
56
59
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
60
|
+
def install_module_from_forge_on(hsts, mod_name, ver_req)
|
61
|
+
sub_mod_name = mod_name.sub('/', '-')
|
62
|
+
dependency = {
|
63
|
+
module_name: sub_mod_name,
|
64
|
+
version: module_version_from_requirement(sub_mod_name, ver_req),
|
65
|
+
}
|
63
66
|
|
64
|
-
|
65
|
-
|
67
|
+
install_module_dependencies_on(hsts, [dependency])
|
68
|
+
end
|
66
69
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
# This method returns an array of dependencies from the metadata.json file
|
71
|
+
# in the format of an array of hashes, containing :module_name and optionally
|
72
|
+
# :version elements. If no dependencies are specified, empty array is returned
|
73
|
+
def module_dependencies_from_metadata
|
74
|
+
metadata = module_metadata
|
75
|
+
return [] unless metadata.key?('dependencies')
|
73
76
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
+
dependencies = []
|
78
|
+
metadata['dependencies'].each do |d|
|
79
|
+
tmp = { module_name: d['name'].sub('/', '-') }
|
77
80
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
+
if d.key?('version_requirement')
|
82
|
+
tmp[:version] = module_version_from_requirement(tmp[:module_name],
|
83
|
+
d['version_requirement'])
|
84
|
+
end
|
85
|
+
dependencies.push(tmp)
|
81
86
|
end
|
82
|
-
|
87
|
+
|
88
|
+
dependencies
|
83
89
|
end
|
84
90
|
|
85
|
-
|
86
|
-
|
91
|
+
# This method takes a module name and the version requirement string from the
|
92
|
+
# metadata.json file, containing either lower bounds of version or both lower
|
93
|
+
# and upper bounds. The function then uses the forge rest endpoint to find
|
94
|
+
# the most recent release of the given module matching the version requirement
|
95
|
+
def module_version_from_requirement(mod_name, vr_str)
|
96
|
+
require 'net/http'
|
97
|
+
uri = URI("#{forge_api}v3/modules/#{mod_name}")
|
98
|
+
response = Net::HTTP.get_response(uri)
|
99
|
+
raise "Puppetforge API error '#{uri}': '#{response.body}'" if response.code.to_i >= 400
|
100
|
+
|
101
|
+
forge_data = JSON.parse(response.body)
|
102
|
+
|
103
|
+
vrs = version_requirements_from_string(vr_str)
|
87
104
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
response = Net::HTTP.get(uri)
|
96
|
-
forge_data = JSON.parse(response)
|
97
|
-
|
98
|
-
vrs = version_requirements_from_string(vr_str)
|
99
|
-
|
100
|
-
# Here we iterate the releases of the given module and pick the most recent
|
101
|
-
# that matches to version requirement
|
102
|
-
forge_data['releases'].each do |rel|
|
103
|
-
return rel['version'] if vrs.all? { |vr| vr.match?('', rel['version']) }
|
105
|
+
# Here we iterate the releases of the given module and pick the most recent
|
106
|
+
# that matches to version requirement
|
107
|
+
forge_data['releases'].each do |rel|
|
108
|
+
return rel['version'] if vrs.all? { |vr| vr.match?('', rel['version']) }
|
109
|
+
end
|
110
|
+
|
111
|
+
raise "No release version found matching '#{mod_name}' '#{vr_str}'"
|
104
112
|
end
|
105
113
|
|
106
|
-
|
107
|
-
|
114
|
+
# This method takes a version requirement string as specified in the link
|
115
|
+
# below, with either simply a lower bound, or both lower and upper bounds and
|
116
|
+
# returns an array of Gem::Dependency objects
|
117
|
+
# https://docs.puppet.com/puppet/latest/modules_metadata.html
|
118
|
+
def version_requirements_from_string(vr_str)
|
119
|
+
ops = vr_str.scan(/[(<|>=)]{1,2}/i)
|
120
|
+
vers = vr_str.scan(/[(0-9|.)]+/i)
|
108
121
|
|
109
|
-
|
110
|
-
|
111
|
-
# returns an array of Gem::Dependency objects
|
112
|
-
# https://docs.puppet.com/puppet/latest/modules_metadata.html
|
113
|
-
def version_requirements_from_string(vr_str)
|
114
|
-
ops = vr_str.scan(/[(<|>|=)]{1,2}/i)
|
115
|
-
vers = vr_str.scan(/[(0-9|\.)]+/i)
|
122
|
+
raise 'Invalid version requirements' if ops.count != 0 &&
|
123
|
+
ops.count != vers.count
|
116
124
|
|
117
|
-
|
118
|
-
|
125
|
+
vrs = []
|
126
|
+
ops.each_with_index do |op, index|
|
127
|
+
vrs.push(Gem::Dependency.new('', "#{op} #{vers[index]}"))
|
128
|
+
end
|
119
129
|
|
120
|
-
|
121
|
-
ops.each_with_index do |op, index|
|
122
|
-
vrs.push(Gem::Dependency.new('', "#{op} #{vers[index]}"))
|
130
|
+
vrs
|
123
131
|
end
|
124
132
|
|
125
|
-
|
126
|
-
|
133
|
+
# This method will return array of all masters. If no masters exist, it will
|
134
|
+
# return all agent nodes. If no nodes tagged master or agent exist, all nodes
|
135
|
+
# will be returned
|
136
|
+
def hosts_to_install_module_on
|
137
|
+
masters = hosts_with_role(hosts, :master)
|
138
|
+
return masters unless masters.empty?
|
127
139
|
|
128
|
-
|
129
|
-
|
130
|
-
# will be returned
|
131
|
-
def hosts_to_install_module_on
|
132
|
-
masters = hosts_with_role(hosts, :master)
|
133
|
-
return masters unless masters.empty?
|
140
|
+
agents = hosts_with_role(hosts, :agent)
|
141
|
+
return agents unless agents.empty?
|
134
142
|
|
135
|
-
|
136
|
-
|
143
|
+
hosts
|
144
|
+
end
|
137
145
|
|
138
|
-
|
139
|
-
|
146
|
+
# This method will read the 'name' attribute from metadata.json file and
|
147
|
+
# remove the first segment. E.g. puppetlabs-vcsrepo -> vcsrepo
|
148
|
+
def module_name_from_metadata
|
149
|
+
res = get_module_name module_metadata['name']
|
150
|
+
raise 'Error getting module name' unless res
|
140
151
|
|
141
|
-
|
142
|
-
|
143
|
-
def module_name_from_metadata
|
144
|
-
res = get_module_name module_metadata['name']
|
145
|
-
raise 'Error getting module name' unless res
|
146
|
-
res[1]
|
147
|
-
end
|
152
|
+
res[1]
|
153
|
+
end
|
148
154
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
+
# This method uses the module_source_directory path to read the metadata.json
|
156
|
+
# file into a json array
|
157
|
+
def module_metadata
|
158
|
+
metadata_path = "#{$module_source_dir}/metadata.json"
|
159
|
+
raise "Error loading metadata.json file from #{$module_source_dir}" unless File.exist?(metadata_path)
|
160
|
+
|
161
|
+
JSON.parse(File.read(metadata_path))
|
155
162
|
end
|
156
|
-
JSON.parse(File.read(metadata_path))
|
157
|
-
end
|
158
163
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
164
|
+
# Use this property to store the module_source_dir, so we don't traverse
|
165
|
+
# the tree every time
|
166
|
+
def get_module_source_directory(call_stack)
|
167
|
+
matching_caller = call_stack.grep(/(spec_helper_acceptance|_spec)/i)
|
163
168
|
|
164
|
-
|
169
|
+
raise 'Error finding module source directory' if matching_caller.empty?
|
165
170
|
|
166
|
-
|
167
|
-
|
171
|
+
matching_caller = matching_caller[0] if matching_caller.is_a?(Array)
|
172
|
+
search_in = matching_caller[/[^:]+/]
|
168
173
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
174
|
+
module_source_dir = nil
|
175
|
+
# here we go up the file tree and search the directories for a
|
176
|
+
# valid metadata.json
|
177
|
+
while module_source_dir.nil? && search_in != File.dirname(search_in)
|
178
|
+
# remove last segment (file or folder, doesn't matter)
|
179
|
+
search_in = File.dirname(search_in)
|
175
180
|
|
176
|
-
|
177
|
-
|
178
|
-
|
181
|
+
# Append metadata.json, check it exists in the directory we're searching
|
182
|
+
metadata_path = File.join(search_in, 'metadata.json')
|
183
|
+
module_source_dir = search_in if File.exist?(metadata_path)
|
184
|
+
end
|
185
|
+
module_source_dir
|
179
186
|
end
|
180
|
-
module_source_dir
|
181
|
-
end
|
182
187
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
188
|
+
def forge_host
|
189
|
+
fh = ENV['BEAKER_FORGE_HOST'] # rubocop:disable Style/FetchEnvVar
|
190
|
+
unless fh.nil?
|
191
|
+
fh = "https://#{fh}" unless %r{^(https://|http://)}i.match?(fh)
|
192
|
+
fh += '/' unless fh != %r{/$}
|
193
|
+
return fh
|
194
|
+
end
|
195
|
+
|
196
|
+
'https://forge.puppet.com/'
|
189
197
|
end
|
190
198
|
|
191
|
-
|
192
|
-
|
199
|
+
def forge_api
|
200
|
+
fa = ENV['BEAKER_FORGE_API'] # rubocop:disable Style/FetchEnvVar
|
201
|
+
unless fa.nil?
|
202
|
+
fa = "https://#{fa}" unless %r{^(https://|http://)}i.match?(fa)
|
203
|
+
fa += '/' unless fa != %r{/$}
|
204
|
+
return fa
|
205
|
+
end
|
193
206
|
|
194
|
-
|
195
|
-
fa = ENV['BEAKER_FORGE_API']
|
196
|
-
unless fa.nil?
|
197
|
-
fa = 'https://' + fa if fa !~ /^(https:\/\/|http:\/\/)/i
|
198
|
-
fa += '/' unless fa != /\/$/
|
199
|
-
return fa
|
207
|
+
'https://forgeapi.puppetlabs.com/'
|
200
208
|
end
|
201
|
-
|
202
|
-
'https://forgeapi.puppetlabs.com/'
|
203
209
|
end
|
204
210
|
end
|
205
211
|
|
212
|
+
# rubocop:disable Style/MixinUsage
|
206
213
|
include Beaker::ModuleInstallHelper
|
214
|
+
# rubocop:enable Style/MixinUsage
|
207
215
|
# Use the caller (requirer) of this file to begin search for module source dir
|
208
216
|
$module_source_dir = get_module_source_directory caller
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe Beaker::ModuleInstallHelper do
|
@@ -6,7 +8,7 @@ describe Beaker::ModuleInstallHelper do
|
|
6
8
|
let(:hosts) do
|
7
9
|
[
|
8
10
|
{ 'roles' => %w[master database dashboard classifier] },
|
9
|
-
{ 'roles' => ['agent'] }
|
11
|
+
{ 'roles' => ['agent'] },
|
10
12
|
]
|
11
13
|
end
|
12
14
|
|
@@ -147,19 +149,19 @@ describe Beaker::ModuleInstallHelper do
|
|
147
149
|
'dependencies' => [
|
148
150
|
{
|
149
151
|
'name' => 'puppetlabs/stdlib',
|
150
|
-
'version_requirement' => '>= 4.13.1 <= 4.14.0'
|
152
|
+
'version_requirement' => '>= 4.13.1 <= 4.14.0',
|
151
153
|
}, {
|
152
154
|
'name' => 'puppetlabs/concat',
|
153
|
-
'version_requirement' => '>= 2.0.0 <= 2.2.0'
|
154
|
-
}
|
155
|
-
]
|
155
|
+
'version_requirement' => '>= 2.0.0 <= 2.2.0',
|
156
|
+
},
|
157
|
+
],
|
156
158
|
}
|
157
159
|
end
|
158
160
|
|
159
161
|
let(:desired) do
|
160
162
|
[
|
161
163
|
{ module_name: 'puppetlabs-stdlib', version: '4.14.0' },
|
162
|
-
{ module_name: 'puppetlabs-concat', version: '2.2.0' }
|
164
|
+
{ module_name: 'puppetlabs-concat', version: '2.2.0' },
|
163
165
|
]
|
164
166
|
end
|
165
167
|
|
@@ -175,15 +177,15 @@ describe Beaker::ModuleInstallHelper do
|
|
175
177
|
'name' => 'puppetlabs-vcsrepo',
|
176
178
|
'dependencies' => [
|
177
179
|
{ 'name' => 'puppetlabs/stdlib' },
|
178
|
-
{ 'name' => 'puppetlabs/concat' }
|
179
|
-
]
|
180
|
+
{ 'name' => 'puppetlabs/concat' },
|
181
|
+
],
|
180
182
|
}
|
181
183
|
end
|
182
184
|
|
183
185
|
let(:desired) do
|
184
186
|
[
|
185
187
|
{ module_name: 'puppetlabs-stdlib' },
|
186
|
-
{ module_name: 'puppetlabs-concat' }
|
188
|
+
{ module_name: 'puppetlabs-concat' },
|
187
189
|
]
|
188
190
|
end
|
189
191
|
|
@@ -197,7 +199,7 @@ describe Beaker::ModuleInstallHelper do
|
|
197
199
|
let(:input_metadata) do
|
198
200
|
{
|
199
201
|
'name' => 'puppetlabs-vcsrepo',
|
200
|
-
'dependencies' => []
|
202
|
+
'dependencies' => [],
|
201
203
|
}
|
202
204
|
end
|
203
205
|
let(:desired) { [] }
|
@@ -236,7 +238,7 @@ describe Beaker::ModuleInstallHelper do
|
|
236
238
|
it 'return array with 2 gem version dependency objects' do
|
237
239
|
res = version_requirements_from_string("#{lower_bound} #{upper_bound}")
|
238
240
|
expect(res).to eql([Gem::Dependency.new('', lower_bound),
|
239
|
-
Gem::Dependency.new('', upper_bound)])
|
241
|
+
Gem::Dependency.new('', upper_bound),])
|
240
242
|
end
|
241
243
|
end
|
242
244
|
end
|
@@ -297,9 +299,9 @@ describe Beaker::ModuleInstallHelper do
|
|
297
299
|
'dependencies' => [
|
298
300
|
{
|
299
301
|
'name' => 'puppetlabs/stdlib',
|
300
|
-
'version_requirement' => '>= 4.13.1 <= 4.14.0'
|
301
|
-
}
|
302
|
-
]
|
302
|
+
'version_requirement' => '>= 4.13.1 <= 4.14.0',
|
303
|
+
},
|
304
|
+
],
|
303
305
|
}
|
304
306
|
end
|
305
307
|
|
@@ -319,8 +321,8 @@ describe Beaker::ModuleInstallHelper do
|
|
319
321
|
'name' => 'puppetlabs-vcsrepo',
|
320
322
|
'dependencies' => [
|
321
323
|
{ 'name' => 'puppetlabs/stdlib' },
|
322
|
-
{ 'name' => 'puppetlabs/concat' }
|
323
|
-
]
|
324
|
+
{ 'name' => 'puppetlabs/concat' },
|
325
|
+
],
|
324
326
|
}
|
325
327
|
end
|
326
328
|
let(:a_host) { { name: 'a_host' } }
|
@@ -358,4 +360,29 @@ describe Beaker::ModuleInstallHelper do
|
|
358
360
|
install_module_from_forge_on(a_host, input_module_name, input_module_version_requirement)
|
359
361
|
end
|
360
362
|
end
|
363
|
+
|
364
|
+
describe 'module_version_from_requirement' do
|
365
|
+
context 'when looking up resolvable version contraints for a valid module' do
|
366
|
+
it 'gets a response', live_fire: true do
|
367
|
+
ver = module_version_from_requirement('puppetlabs-vcsrepo', '>= 1 < 2')
|
368
|
+
expect(ver).to eq '1.5.0'
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
context 'when looking up *unresolvable* version contraints for a valid module' do
|
373
|
+
it 'gets a response', live_fire: true do
|
374
|
+
expect do
|
375
|
+
module_version_from_requirement('puppetlabs-vcsrepo', '> 1.4 < 1.5')
|
376
|
+
end.to raise_error(/^No release version found matching 'puppetlabs-vcsrepo' '> 1.4 < 1.5'/)
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
context 'when looking up metadata for a *invalid* module name' do
|
381
|
+
it 'gets a response', live_fire: true do
|
382
|
+
expect do
|
383
|
+
module_version_from_requirement('puppet-does-not-exist', '>= 1 < 2')
|
384
|
+
end.to raise_error(/^Puppetforge API error/)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
361
388
|
end
|
metadata
CHANGED
@@ -1,29 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-module_install_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.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:
|
11
|
+
date: 2023-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '3.12'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '3.12'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: voxpupuli-rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: beaker
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -31,6 +45,9 @@ dependencies:
|
|
31
45
|
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '2.0'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '6'
|
34
51
|
type: :runtime
|
35
52
|
prerelease: false
|
36
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,20 +55,29 @@ dependencies:
|
|
38
55
|
- - ">="
|
39
56
|
- !ruby/object:Gem::Version
|
40
57
|
version: '2.0'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '6'
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
62
|
name: beaker-puppet
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
44
64
|
requirements:
|
45
|
-
- - "
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1'
|
68
|
+
- - "<"
|
46
69
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
70
|
+
version: '3'
|
48
71
|
type: :runtime
|
49
72
|
prerelease: false
|
50
73
|
version_requirements: !ruby/object:Gem::Requirement
|
51
74
|
requirements:
|
52
|
-
- - "
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1'
|
78
|
+
- - "<"
|
53
79
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
80
|
+
version: '3'
|
55
81
|
description: A helper gem for use in a Puppet Modules spec_helper_acceptance.rb file
|
56
82
|
to help install the module under test and its dependencies on the system under test
|
57
83
|
email:
|
@@ -65,6 +91,7 @@ files:
|
|
65
91
|
- ".github/workflows/test.yml"
|
66
92
|
- ".gitignore"
|
67
93
|
- ".rubocop.yml"
|
94
|
+
- ".rubocop_todo.yml"
|
68
95
|
- CHANGELOG.md
|
69
96
|
- CONTRIBUTING.md
|
70
97
|
- Gemfile
|
@@ -87,14 +114,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
87
114
|
requirements:
|
88
115
|
- - ">="
|
89
116
|
- !ruby/object:Gem::Version
|
90
|
-
version: 2.
|
117
|
+
version: 2.7.0
|
91
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
119
|
requirements:
|
93
120
|
- - ">="
|
94
121
|
- !ruby/object:Gem::Version
|
95
122
|
version: '0'
|
96
123
|
requirements: []
|
97
|
-
rubygems_version: 3.2.
|
124
|
+
rubygems_version: 3.2.33
|
98
125
|
signing_key:
|
99
126
|
specification_version: 4
|
100
127
|
summary: A helper gem for use in a Puppet Modules spec_helper_acceptance.rb file
|