beaker-vmware 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +27 -6
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +266 -0
- data/.simplecov +1 -1
- data/CHANGELOG.md +20 -0
- data/Gemfile +4 -23
- data/Rakefile +26 -125
- data/beaker-vmware.gemspec +20 -21
- data/bin/beaker-vmware +1 -3
- data/lib/beaker/hypervisor/fusion.rb +21 -23
- data/lib/beaker/hypervisor/vsphere.rb +23 -24
- data/lib/beaker/hypervisor/vsphere_helper.rb +78 -81
- data/lib/beaker-vmware/version.rb +1 -1
- data/spec/beaker/hypervisor/fusion_spec.rb +14 -16
- data/spec/beaker/hypervisor/vsphere_helper_spec.rb +120 -124
- data/spec/beaker/hypervisor/vsphere_spec.rb +28 -40
- data/spec/mock_fission.rb +63 -0
- data/spec/mock_vsphere.rb +284 -0
- data/spec/mock_vsphere_helper.rb +167 -0
- data/spec/spec_helper.rb +9 -7
- metadata +77 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be69407550d964113e9fb9e3fdcd567c903fbff2e137dd716143e2abe38bd701
|
4
|
+
data.tar.gz: 6b9a1365fec6cbcece962a6906588deeddd37eb87f7b939c9b78c01ab5d8b77e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dda90f1f25eef41f3cdf32407d95ca6f2482b5de059ee443909f1174e6fdcd0e42f494792c70f41d279c3c3a004ede3e497ad0f461a634f26567eb3882efd78c
|
7
|
+
data.tar.gz: f0293b346e71faec357550a5c955ef5da222b91fba56cfbd41ff69b2899df0223bae1a34d37f5072e60dc56abe9c0fe6c7e59e807d7b02a42847e8b1cf18d069
|
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
|
data/.github/workflows/test.yml
CHANGED
@@ -1,29 +1,41 @@
|
|
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:
|
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: "3.1"
|
21
|
+
bundler-cache: true
|
22
|
+
- name: Run Rubocop
|
23
|
+
run: bundle exec rake rubocop
|
24
|
+
|
11
25
|
test:
|
12
26
|
runs-on: ubuntu-latest
|
13
27
|
strategy:
|
14
28
|
fail-fast: false
|
15
29
|
matrix:
|
16
30
|
include:
|
17
|
-
- ruby: "2.4"
|
18
|
-
- ruby: "2.5"
|
19
|
-
- ruby: "2.6"
|
20
31
|
- ruby: "2.7"
|
21
32
|
- ruby: "3.0"
|
22
33
|
coverage: "yes"
|
34
|
+
- ruby: "3.1"
|
23
35
|
env:
|
24
36
|
COVERAGE: ${{ matrix.coverage }}
|
25
37
|
steps:
|
26
|
-
- uses: actions/checkout@
|
38
|
+
- uses: actions/checkout@v3
|
27
39
|
- name: Install Ruby ${{ matrix.ruby }}
|
28
40
|
uses: ruby/setup-ruby@v1
|
29
41
|
with:
|
@@ -33,3 +45,12 @@ jobs:
|
|
33
45
|
run: bundle exec rake
|
34
46
|
- name: Build gem
|
35
47
|
run: gem build *.gemspec
|
48
|
+
|
49
|
+
tests:
|
50
|
+
needs:
|
51
|
+
- rubocop
|
52
|
+
- test
|
53
|
+
runs-on: ubuntu-latest
|
54
|
+
name: Test suite
|
55
|
+
steps:
|
56
|
+
- run: echo Test suite completed
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,266 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2023-03-27 20:09:11 UTC using RuboCop version 1.48.1.
|
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: 2
|
10
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
11
|
+
# Configuration parameters: AllowSafeAssignment.
|
12
|
+
Lint/AssignmentInCondition:
|
13
|
+
Exclude:
|
14
|
+
- 'lib/beaker/hypervisor/vsphere.rb'
|
15
|
+
|
16
|
+
# Offense count: 2
|
17
|
+
Lint/DuplicateMethods:
|
18
|
+
Exclude:
|
19
|
+
- 'spec/mock_vsphere_helper.rb'
|
20
|
+
|
21
|
+
# Offense count: 2
|
22
|
+
Lint/MissingSuper:
|
23
|
+
Exclude:
|
24
|
+
- 'lib/beaker/hypervisor/fusion.rb'
|
25
|
+
- 'lib/beaker/hypervisor/vsphere.rb'
|
26
|
+
|
27
|
+
# Offense count: 1
|
28
|
+
# Configuration parameters: AllowComments, AllowNil.
|
29
|
+
Lint/SuppressedException:
|
30
|
+
Exclude:
|
31
|
+
- 'Rakefile'
|
32
|
+
|
33
|
+
# Offense count: 3
|
34
|
+
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
35
|
+
Lint/Void:
|
36
|
+
Exclude:
|
37
|
+
- 'spec/beaker/hypervisor/vsphere_spec.rb'
|
38
|
+
|
39
|
+
# Offense count: 4
|
40
|
+
Naming/AccessorMethodName:
|
41
|
+
Exclude:
|
42
|
+
- 'spec/mock_fission.rb'
|
43
|
+
- 'spec/mock_vsphere.rb'
|
44
|
+
- 'spec/mock_vsphere_helper.rb'
|
45
|
+
|
46
|
+
# Offense count: 1
|
47
|
+
# Configuration parameters: ForbiddenDelimiters.
|
48
|
+
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
49
|
+
Naming/HeredocDelimiterNaming:
|
50
|
+
Exclude:
|
51
|
+
- 'Rakefile'
|
52
|
+
|
53
|
+
# Offense count: 30
|
54
|
+
# Configuration parameters: EnforcedStyle, AllowedPatterns.
|
55
|
+
# SupportedStyles: snake_case, camelCase
|
56
|
+
Naming/MethodName:
|
57
|
+
Exclude:
|
58
|
+
- 'spec/mock_vsphere.rb'
|
59
|
+
- 'spec/mock_vsphere_helper.rb'
|
60
|
+
|
61
|
+
# Offense count: 11
|
62
|
+
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
63
|
+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
|
64
|
+
Naming/MethodParameterName:
|
65
|
+
Exclude:
|
66
|
+
- 'lib/beaker/hypervisor/vsphere_helper.rb'
|
67
|
+
- 'spec/mock_vsphere.rb'
|
68
|
+
- 'spec/mock_vsphere_helper.rb'
|
69
|
+
|
70
|
+
# Offense count: 28
|
71
|
+
# Configuration parameters: EnforcedStyle, AllowedIdentifiers, AllowedPatterns.
|
72
|
+
# SupportedStyles: snake_case, camelCase
|
73
|
+
Naming/VariableName:
|
74
|
+
Exclude:
|
75
|
+
- 'lib/beaker/hypervisor/vsphere_helper.rb'
|
76
|
+
- 'spec/mock_vsphere.rb'
|
77
|
+
- 'spec/mock_vsphere_helper.rb'
|
78
|
+
|
79
|
+
# Offense count: 1
|
80
|
+
# Configuration parameters: MinSize.
|
81
|
+
Performance/CollectionLiteralInLoop:
|
82
|
+
Exclude:
|
83
|
+
- 'lib/beaker/hypervisor/vsphere_helper.rb'
|
84
|
+
|
85
|
+
# Offense count: 1
|
86
|
+
RSpec/AnyInstance:
|
87
|
+
Exclude:
|
88
|
+
- 'spec/beaker/hypervisor/fusion_spec.rb'
|
89
|
+
|
90
|
+
# Offense count: 12
|
91
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
92
|
+
# Configuration parameters: SkipBlocks, EnforcedStyle.
|
93
|
+
# SupportedStyles: described_class, explicit
|
94
|
+
RSpec/DescribedClass:
|
95
|
+
Exclude:
|
96
|
+
- 'spec/beaker/hypervisor/fusion_spec.rb'
|
97
|
+
- 'spec/beaker/hypervisor/vsphere_helper_spec.rb'
|
98
|
+
- 'spec/beaker/hypervisor/vsphere_spec.rb'
|
99
|
+
|
100
|
+
# Offense count: 6
|
101
|
+
# Configuration parameters: CountAsOne.
|
102
|
+
RSpec/ExampleLength:
|
103
|
+
Max: 8
|
104
|
+
|
105
|
+
# Offense count: 1
|
106
|
+
# Configuration parameters: .
|
107
|
+
# SupportedStyles: have_received, receive
|
108
|
+
RSpec/MessageSpies:
|
109
|
+
EnforcedStyle: receive
|
110
|
+
|
111
|
+
# Offense count: 1
|
112
|
+
# Configuration parameters: AllowedPatterns.
|
113
|
+
# AllowedPatterns: ^expect_, ^assert_
|
114
|
+
RSpec/NoExpectationExample:
|
115
|
+
Exclude:
|
116
|
+
- 'spec/beaker/hypervisor/fusion_spec.rb'
|
117
|
+
|
118
|
+
# Offense count: 5
|
119
|
+
RSpec/UnspecifiedException:
|
120
|
+
Exclude:
|
121
|
+
- 'spec/beaker/hypervisor/fusion_spec.rb'
|
122
|
+
- 'spec/beaker/hypervisor/vsphere_helper_spec.rb'
|
123
|
+
- 'spec/beaker/hypervisor/vsphere_spec.rb'
|
124
|
+
|
125
|
+
# Offense count: 1
|
126
|
+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
|
127
|
+
RSpec/VerifiedDoubles:
|
128
|
+
Exclude:
|
129
|
+
- 'spec/beaker/hypervisor/vsphere_helper_spec.rb'
|
130
|
+
|
131
|
+
# Offense count: 3
|
132
|
+
# This cop supports safe autocorrection (--autocorrect).
|
133
|
+
Rake/Desc:
|
134
|
+
Exclude:
|
135
|
+
- 'Rakefile'
|
136
|
+
|
137
|
+
# Offense count: 2
|
138
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
139
|
+
# Configuration parameters: EnforcedStyle.
|
140
|
+
# SupportedStyles: always, conditionals
|
141
|
+
Style/AndOr:
|
142
|
+
Exclude:
|
143
|
+
- 'lib/beaker/hypervisor/fusion.rb'
|
144
|
+
- 'lib/beaker/hypervisor/vsphere_helper.rb'
|
145
|
+
|
146
|
+
# Offense count: 12
|
147
|
+
# This cop supports safe autocorrection (--autocorrect).
|
148
|
+
# Configuration parameters: AllowOnConstant, AllowOnSelfClass.
|
149
|
+
Style/CaseEquality:
|
150
|
+
Exclude:
|
151
|
+
- 'spec/beaker/hypervisor/vsphere_helper_spec.rb'
|
152
|
+
|
153
|
+
# Offense count: 7
|
154
|
+
Style/ClassVars:
|
155
|
+
Exclude:
|
156
|
+
- 'spec/mock_fission.rb'
|
157
|
+
- 'spec/mock_vsphere_helper.rb'
|
158
|
+
|
159
|
+
# Offense count: 1
|
160
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
161
|
+
Style/CommentedKeyword:
|
162
|
+
Exclude:
|
163
|
+
- 'lib/beaker/hypervisor/fusion.rb'
|
164
|
+
|
165
|
+
# Offense count: 3
|
166
|
+
# Configuration parameters: AllowedConstants.
|
167
|
+
Style/Documentation:
|
168
|
+
Exclude:
|
169
|
+
- 'spec/**/*'
|
170
|
+
- 'test/**/*'
|
171
|
+
- 'lib/beaker/hypervisor/fusion.rb'
|
172
|
+
- 'lib/beaker/hypervisor/vsphere.rb'
|
173
|
+
- 'lib/beaker/hypervisor/vsphere_helper.rb'
|
174
|
+
|
175
|
+
# Offense count: 3
|
176
|
+
# This cop supports safe autocorrection (--autocorrect).
|
177
|
+
# Configuration parameters: EnforcedStyle.
|
178
|
+
# SupportedStyles: format, sprintf, percent
|
179
|
+
Style/FormatString:
|
180
|
+
Exclude:
|
181
|
+
- 'lib/beaker/hypervisor/fusion.rb'
|
182
|
+
- 'lib/beaker/hypervisor/vsphere.rb'
|
183
|
+
|
184
|
+
# Offense count: 16
|
185
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
186
|
+
# Configuration parameters: EnforcedStyle.
|
187
|
+
# SupportedStyles: always, always_true, never
|
188
|
+
Style/FrozenStringLiteralComment:
|
189
|
+
Enabled: false
|
190
|
+
|
191
|
+
# Offense count: 3
|
192
|
+
# This cop supports safe autocorrection (--autocorrect).
|
193
|
+
Style/IfUnlessModifier:
|
194
|
+
Exclude:
|
195
|
+
- 'lib/beaker/hypervisor/fusion.rb'
|
196
|
+
|
197
|
+
# Offense count: 1
|
198
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
199
|
+
Style/InfiniteLoop:
|
200
|
+
Exclude:
|
201
|
+
- 'lib/beaker/hypervisor/vsphere_helper.rb'
|
202
|
+
|
203
|
+
# Offense count: 2
|
204
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
205
|
+
Style/LineEndConcatenation:
|
206
|
+
Exclude:
|
207
|
+
- 'lib/beaker/hypervisor/vsphere.rb'
|
208
|
+
|
209
|
+
# Offense count: 2
|
210
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
211
|
+
# Configuration parameters: EnforcedStyle.
|
212
|
+
# SupportedStyles: literals, strict
|
213
|
+
Style/MutableConstant:
|
214
|
+
Exclude:
|
215
|
+
- 'bin/beaker-vmware'
|
216
|
+
- 'lib/beaker-vmware/version.rb'
|
217
|
+
|
218
|
+
# Offense count: 2
|
219
|
+
Style/OpenStructUse:
|
220
|
+
Exclude:
|
221
|
+
- 'spec/mock_vsphere.rb'
|
222
|
+
|
223
|
+
# Offense count: 1
|
224
|
+
# Configuration parameters: AllowedMethods.
|
225
|
+
# AllowedMethods: respond_to_missing?
|
226
|
+
Style/OptionalBooleanParameter:
|
227
|
+
Exclude:
|
228
|
+
- 'spec/mock_vsphere.rb'
|
229
|
+
|
230
|
+
# Offense count: 2
|
231
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
232
|
+
# Configuration parameters: EnforcedStyle.
|
233
|
+
# SupportedStyles: short, verbose
|
234
|
+
Style/PreferredHashMethods:
|
235
|
+
Exclude:
|
236
|
+
- 'spec/mock_vsphere_helper.rb'
|
237
|
+
|
238
|
+
# Offense count: 2
|
239
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
240
|
+
# Configuration parameters: AllowComments.
|
241
|
+
Style/RedundantInitialize:
|
242
|
+
Exclude:
|
243
|
+
- 'spec/mock_vsphere.rb'
|
244
|
+
- 'spec/mock_vsphere_helper.rb'
|
245
|
+
|
246
|
+
# Offense count: 2
|
247
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
248
|
+
# Configuration parameters: Mode.
|
249
|
+
Style/StringConcatenation:
|
250
|
+
Exclude:
|
251
|
+
- 'spec/mock_vsphere.rb'
|
252
|
+
|
253
|
+
# Offense count: 1
|
254
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
255
|
+
# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments.
|
256
|
+
# AllowedMethods: define_method
|
257
|
+
Style/SymbolProc:
|
258
|
+
Exclude:
|
259
|
+
- 'lib/beaker/hypervisor/fusion.rb'
|
260
|
+
|
261
|
+
# Offense count: 5
|
262
|
+
# This cop supports safe autocorrection (--autocorrect).
|
263
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
264
|
+
# URISchemes: http, https
|
265
|
+
Layout/LineLength:
|
266
|
+
Max: 152
|
data/.simplecov
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.0.0](https://github.com/voxpupuli/beaker-vmware/tree/2.0.0) (2023-03-28)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/voxpupuli/beaker-vmware/compare/1.0.0...2.0.0)
|
6
|
+
|
7
|
+
**Breaking changes:**
|
8
|
+
|
9
|
+
- Drop Ruby 2.4/2.5/2.6 support; Add 3.1 [\#25](https://github.com/voxpupuli/beaker-vmware/pull/25) ([bastelfreak](https://github.com/bastelfreak))
|
10
|
+
|
11
|
+
**Implemented enhancements:**
|
12
|
+
|
13
|
+
- Implement rubocop [\#26](https://github.com/voxpupuli/beaker-vmware/pull/26) ([bastelfreak](https://github.com/bastelfreak))
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- Update fakefs requirement from ~\> 0.6 to ~\> 2.4 [\#23](https://github.com/voxpupuli/beaker-vmware/pull/23) ([dependabot[bot]](https://github.com/apps/dependabot))
|
18
|
+
- CI: Apply Vox Pupuli best practices [\#22](https://github.com/voxpupuli/beaker-vmware/pull/22) ([bastelfreak](https://github.com/bastelfreak))
|
19
|
+
- Bump actions/checkout from 2 to 3 [\#21](https://github.com/voxpupuli/beaker-vmware/pull/21) ([dependabot[bot]](https://github.com/apps/dependabot))
|
20
|
+
- dependabot: check for github actions and gems [\#20](https://github.com/voxpupuli/beaker-vmware/pull/20) ([bastelfreak](https://github.com/bastelfreak))
|
21
|
+
- Update rbvmomi requirement from ~\> 1.9 to \>= 1.9, \< 4.0 [\#12](https://github.com/voxpupuli/beaker-vmware/pull/12) ([dependabot[bot]](https://github.com/apps/dependabot))
|
22
|
+
|
3
23
|
## [1.0.0](https://github.com/voxpupuli/beaker-vmware/tree/1.0.0) (2021-08-09)
|
4
24
|
|
5
25
|
[Full Changelog](https://github.com/voxpupuli/beaker-vmware/compare/0.3.0...1.0.0)
|
data/Gemfile
CHANGED
@@ -1,31 +1,12 @@
|
|
1
|
-
source ENV['GEM_SOURCE'] ||
|
1
|
+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
def location_for(place, fake_version = nil)
|
8
|
-
if place =~ /^git:([^#]*)#(.*)/
|
9
|
-
[fake_version, { :git => $1, :branch => $2, :require => false }].compact
|
10
|
-
elsif place =~ /^file:\/\/(.*)/
|
11
|
-
['>= 0', { :path => File.expand_path($1), :require => false }]
|
12
|
-
else
|
13
|
-
[place, { :require => false }]
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
# We don't put beaker in as a test dependency because we
|
19
|
-
# don't want to create a transitive dependency
|
20
|
-
group :acceptance_testing do
|
21
|
-
gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '>= 3.0')
|
22
|
-
end
|
23
|
-
|
24
5
|
group :release do
|
25
6
|
gem 'github_changelog_generator', require: false
|
26
7
|
end
|
27
8
|
|
28
|
-
group :coverage, optional: ENV['COVERAGE']!='yes' do
|
29
|
-
gem '
|
30
|
-
gem '
|
9
|
+
group :coverage, optional: ENV['COVERAGE'] != 'yes' do
|
10
|
+
gem 'codecov', require: false
|
11
|
+
gem 'simplecov-console', require: false
|
31
12
|
end
|
data/Rakefile
CHANGED
@@ -1,46 +1,39 @@
|
|
1
1
|
require 'rspec/core/rake_task'
|
2
2
|
|
3
3
|
namespace :test do
|
4
|
-
|
5
4
|
namespace :spec do
|
6
|
-
|
7
|
-
desc "Run spec tests"
|
5
|
+
desc 'Run spec tests'
|
8
6
|
RSpec::Core::RakeTask.new(:run) do |t|
|
9
7
|
t.rspec_opts = ['--color']
|
10
8
|
t.pattern = 'spec/'
|
11
9
|
end
|
12
10
|
|
13
|
-
desc
|
11
|
+
desc 'Run spec tests with coverage'
|
14
12
|
RSpec::Core::RakeTask.new(:coverage) do |t|
|
15
13
|
ENV['BEAKER_VMWARE_COVERAGE'] = 'y'
|
16
14
|
t.rspec_opts = ['--color']
|
17
15
|
t.pattern = 'spec/'
|
18
16
|
end
|
19
|
-
|
20
17
|
end
|
21
18
|
|
22
19
|
namespace :acceptance do
|
23
|
-
|
24
|
-
|
25
|
-
A quick acceptance test, named because it has no pre-suites to run
|
20
|
+
desc <<~EOS
|
21
|
+
A quick acceptance test, named because it has no pre-suites to run
|
26
22
|
EOS
|
27
23
|
task :quick do
|
28
|
-
|
29
24
|
# setup & load_path of beaker's acceptance base and lib directory
|
30
25
|
beaker_gem_spec = Gem::Specification.find_by_name('beaker')
|
31
26
|
beaker_gem_dir = beaker_gem_spec.gem_dir
|
32
27
|
beaker_test_base_dir = File.join(beaker_gem_dir, 'acceptance/tests/base')
|
33
28
|
load_path_option = File.join(beaker_gem_dir, 'acceptance/lib')
|
34
29
|
|
35
|
-
sh(
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
30
|
+
sh('beaker',
|
31
|
+
'--hosts', 'acceptance/config/nodes/test-nodes.yml',
|
32
|
+
'--tests', beaker_test_base_dir,
|
33
|
+
'--log-level', 'debug',
|
34
|
+
'--load-path', load_path_option)
|
40
35
|
end
|
41
|
-
|
42
36
|
end
|
43
|
-
|
44
37
|
end
|
45
38
|
|
46
39
|
# namespace-named default tasks.
|
@@ -50,119 +43,14 @@ task 'test:spec' => 'test:spec:run'
|
|
50
43
|
task 'test:acceptance' => 'test:acceptance:quick'
|
51
44
|
|
52
45
|
# global defaults
|
53
|
-
task :
|
54
|
-
task :
|
55
|
-
|
56
|
-
###########################################################
|
57
|
-
#
|
58
|
-
# Documentation Tasks
|
59
|
-
#
|
60
|
-
###########################################################
|
61
|
-
DOCS_DAEMON = "yard server --reload --daemon --server thin"
|
62
|
-
FOREGROUND_SERVER = 'bundle exec yard server --reload --verbose --server thin lib/beaker'
|
63
|
-
|
64
|
-
def running?( cmdline )
|
65
|
-
ps = `ps -ef`
|
66
|
-
found = ps.lines.grep( /#{Regexp.quote( cmdline )}/ )
|
67
|
-
if found.length > 1
|
68
|
-
raise StandardError, "Found multiple YARD Servers. Don't know what to do."
|
69
|
-
end
|
70
|
-
|
71
|
-
yes = found.empty? ? false : true
|
72
|
-
return yes, found.first
|
73
|
-
end
|
74
|
-
|
75
|
-
def pid_from( output )
|
76
|
-
output.squeeze(' ').strip.split(' ')[1]
|
77
|
-
end
|
78
|
-
|
79
|
-
desc 'Start the documentation server in the foreground'
|
80
|
-
task :docs => 'docs:clear' do
|
81
|
-
original_dir = Dir.pwd
|
82
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
83
|
-
sh FOREGROUND_SERVER
|
84
|
-
Dir.chdir( original_dir )
|
85
|
-
end
|
86
|
-
|
87
|
-
namespace :docs do
|
88
|
-
|
89
|
-
desc 'Clear the generated documentation cache'
|
90
|
-
task :clear do
|
91
|
-
original_dir = Dir.pwd
|
92
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
93
|
-
sh 'rm -rf docs'
|
94
|
-
Dir.chdir( original_dir )
|
95
|
-
end
|
96
|
-
|
97
|
-
desc 'Generate static documentation'
|
98
|
-
task :gen => 'docs:clear' do
|
99
|
-
original_dir = Dir.pwd
|
100
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
101
|
-
output = `bundle exec yard doc`
|
102
|
-
puts output
|
103
|
-
if output =~ /\[warn\]|\[error\]/
|
104
|
-
fail "Errors/Warnings during yard documentation generation"
|
105
|
-
end
|
106
|
-
Dir.chdir( original_dir )
|
107
|
-
end
|
108
|
-
|
109
|
-
desc 'Run the documentation server in the background, alias `bg`'
|
110
|
-
task :background => 'docs:clear' do
|
111
|
-
yes, output = running?( DOCS_DAEMON )
|
112
|
-
if yes
|
113
|
-
puts "Not starting a new YARD Server..."
|
114
|
-
puts "Found one running with pid #{pid_from( output )}."
|
115
|
-
else
|
116
|
-
original_dir = Dir.pwd
|
117
|
-
Dir.chdir( File.expand_path(File.dirname(__FILE__)) )
|
118
|
-
sh "bundle exec #{DOCS_DAEMON}"
|
119
|
-
Dir.chdir( original_dir )
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
task(:bg) { Rake::Task['docs:background'].invoke }
|
124
|
-
|
125
|
-
desc 'Check the status of the documentation server'
|
126
|
-
task :status do
|
127
|
-
yes, output = running?( DOCS_DAEMON )
|
128
|
-
if yes
|
129
|
-
pid = pid_from( output )
|
130
|
-
puts "Found a YARD Server running with pid #{pid}"
|
131
|
-
else
|
132
|
-
puts "Could not find a running YARD Server."
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
desc "Stop a running YARD Server"
|
137
|
-
task :stop do
|
138
|
-
yes, output = running?( DOCS_DAEMON )
|
139
|
-
if yes
|
140
|
-
pid = pid_from( output )
|
141
|
-
puts "Found a YARD Server running with pid #{pid}"
|
142
|
-
`kill #{pid}`
|
143
|
-
puts "Stopping..."
|
144
|
-
yes, output = running?( DOCS_DAEMON )
|
145
|
-
if yes
|
146
|
-
`kill -9 #{pid}`
|
147
|
-
yes, output = running?( DOCS_DAEMON )
|
148
|
-
if yes
|
149
|
-
puts "Could not Stop Server!"
|
150
|
-
else
|
151
|
-
puts "Server stopped."
|
152
|
-
end
|
153
|
-
else
|
154
|
-
puts "Server stopped."
|
155
|
-
end
|
156
|
-
else
|
157
|
-
puts "Could not find a running YARD Server"
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
46
|
+
task test: 'test:spec'
|
47
|
+
task default: :test
|
161
48
|
|
162
49
|
begin
|
163
50
|
require 'rubygems'
|
164
51
|
require 'github_changelog_generator/task'
|
165
|
-
rescue LoadError
|
52
|
+
rescue LoadError
|
53
|
+
# github_changelog_generator is an optional group
|
166
54
|
else
|
167
55
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
168
56
|
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
|
@@ -172,3 +60,16 @@ else
|
|
172
60
|
config.future_release = gem_version
|
173
61
|
end
|
174
62
|
end
|
63
|
+
|
64
|
+
begin
|
65
|
+
require 'rubocop/rake_task'
|
66
|
+
rescue LoadError
|
67
|
+
# RuboCop is an optional group
|
68
|
+
else
|
69
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
70
|
+
# These make the rubocop experience maybe slightly less terrible
|
71
|
+
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
|
72
|
+
# Use Rubocop's Github Actions formatter if possible
|
73
|
+
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
|
74
|
+
end
|
75
|
+
end
|