chefspec 7.4.0 → 8.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/chefspec.gemspec +3 -2
- data/lib/chefspec/coverage.rb +0 -20
- data/lib/chefspec/extensions/chef/cookbook/gem_installer.rb +1 -1
- data/lib/chefspec/policyfile.rb +6 -6
- data/lib/chefspec/version.rb +1 -1
- data/spec/spec_helper.rb +0 -5
- metadata +19 -8
- data/templates/coverage/human.erb +0 -22
- data/templates/coverage/json.erb +0 -8
- data/templates/coverage/table.erb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 888dff160c4e09262e47271fc25e19e24dfa5415f9c17566d5fab2c3b07d3f38
|
4
|
+
data.tar.gz: a79eacde94a5abdad1ab8e4530ed95d46255323927fbfe9706873aa7d6d99545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76b576b0e8fd51f067bda1eaca73ebb3bd5f49f0ce366ac4c59d84942b2d1437cead58afc7fd1b0c96e7051e656342e2b2ac9e1d2d3c183953ed8fefba15b79f
|
7
|
+
data.tar.gz: f5ba63555cde2fb189c53ceedfffd46491744605ea50f8927f85502c8ba480455a69ba397cdc27d1ace387509e95b8c5442b10b411ea50b3d18aaf075c0a5b3d
|
data/chefspec.gemspec
CHANGED
@@ -21,9 +21,10 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.files = %w{LICENSE Rakefile Gemfile chefspec.gemspec} + Dir.glob("{lib,templates,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) }
|
22
22
|
s.require_paths = ['lib']
|
23
23
|
|
24
|
-
s.required_ruby_version = '>= 2.
|
24
|
+
s.required_ruby_version = '>= 2.4'
|
25
25
|
|
26
|
-
s.add_dependency 'chef', '>=
|
26
|
+
s.add_dependency 'chef', '>= 14'
|
27
|
+
s.add_dependency 'chef-cli'
|
27
28
|
s.add_dependency 'fauxhai', '>= 6.11'
|
28
29
|
s.add_dependency 'rspec', '~> 3.0'
|
29
30
|
end
|
data/lib/chefspec/coverage.rb
CHANGED
@@ -90,26 +90,6 @@ module ChefSpec
|
|
90
90
|
@outputs << block
|
91
91
|
end
|
92
92
|
|
93
|
-
#
|
94
|
-
# Change the template for reporting of converage analysis.
|
95
|
-
#
|
96
|
-
# @param [string] path
|
97
|
-
# The template file to use for the output of the report
|
98
|
-
#
|
99
|
-
# @return [true]
|
100
|
-
#
|
101
|
-
def set_template(file = 'human.erb')
|
102
|
-
[
|
103
|
-
ChefSpec.root.join('templates', 'coverage', file),
|
104
|
-
File.expand_path(file, Dir.pwd)
|
105
|
-
].each do |temp|
|
106
|
-
if File.exist?(temp)
|
107
|
-
@template = temp
|
108
|
-
return
|
109
|
-
end
|
110
|
-
end
|
111
|
-
raise Error::TemplateNotFound.new(path: file)
|
112
|
-
end
|
113
93
|
#
|
114
94
|
# Add a resource to the resource collection. Only new resources are added
|
115
95
|
# and only resources that match the given filter are covered (which is *
|
@@ -25,7 +25,7 @@ Chef::Cookbook::GemInstaller.prepend(Module.new do
|
|
25
25
|
gem_cmd = "gem install #{gem_name} --version '#{gem_requirements.join(', ')}'"
|
26
26
|
gemfile_line = "gem '#{[gem_name, *gem_requirements].join('\', \'')}'"
|
27
27
|
warn "No matching version found for '#{gem_name}' in your gem environment.\n" \
|
28
|
-
" - if you are using
|
28
|
+
" - if you are using Chef Workstation, run the following command: \"chef #{gem_cmd}\"\n" \
|
29
29
|
" - if you are using bundler, append \"#{gemfile_line}\" to your Gemfile and run \"bundle install\"\n" \
|
30
30
|
" - otherwise run: \"#{gem_cmd}\""
|
31
31
|
end
|
data/lib/chefspec/policyfile.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
begin
|
2
|
-
require 'chef-
|
3
|
-
require 'chef-
|
2
|
+
require 'chef-cli/policyfile_services/export_repo'
|
3
|
+
require 'chef-cli/policyfile_services/install'
|
4
4
|
rescue LoadError
|
5
|
-
raise ChefSpec::Error::GemLoadError.new(gem: 'chef-
|
5
|
+
raise ChefSpec::Error::GemLoadError.new(gem: 'chef-cli', name: 'ChefCLI')
|
6
6
|
end
|
7
7
|
|
8
8
|
module ChefSpec
|
@@ -27,14 +27,14 @@ module ChefSpec
|
|
27
27
|
policyfile_path = File.join(Dir.pwd, 'Policyfile.rb')
|
28
28
|
end
|
29
29
|
|
30
|
-
installer =
|
30
|
+
installer = ChefCLI::PolicyfileServices::Install.new(
|
31
31
|
policyfile: policyfile_path,
|
32
|
-
ui:
|
32
|
+
ui: ChefCLI::UI.null
|
33
33
|
)
|
34
34
|
|
35
35
|
installer.run
|
36
36
|
|
37
|
-
exporter =
|
37
|
+
exporter = ChefCLI::PolicyfileServices::ExportRepo.new(
|
38
38
|
policyfile: policyfile_path,
|
39
39
|
export_dir: @tmpdir
|
40
40
|
)
|
data/lib/chefspec/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chefspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Crump
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef
|
@@ -17,14 +17,28 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '14'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '14'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: chef-cli
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: fauxhai
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,9 +181,6 @@ files:
|
|
167
181
|
- spec/unit/stubs/search_registry_spec.rb
|
168
182
|
- spec/unit/stubs/search_stub_spec.rb
|
169
183
|
- spec/unit/stubs/stub_spec.rb
|
170
|
-
- templates/coverage/human.erb
|
171
|
-
- templates/coverage/json.erb
|
172
|
-
- templates/coverage/table.erb
|
173
184
|
- templates/errors/cookbook_path_not_found.erb
|
174
185
|
- templates/errors/erb_template_parse_error.erb
|
175
186
|
- templates/errors/gem_load_error.erb
|
@@ -191,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
191
202
|
requirements:
|
192
203
|
- - ">="
|
193
204
|
- !ruby/object:Gem::Version
|
194
|
-
version: '2.
|
205
|
+
version: '2.4'
|
195
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
207
|
requirements:
|
197
208
|
- - ">="
|
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
<% if @total == 0 %>
|
3
|
-
No Chef resources found, skipping coverage calculation...
|
4
|
-
<% else %>
|
5
|
-
ChefSpec Coverage report generated...
|
6
|
-
|
7
|
-
Total Resources: <%= @total %>
|
8
|
-
Touched Resources: <%= @touched %>
|
9
|
-
Touch Coverage: <%= @coverage %>%
|
10
|
-
|
11
|
-
<% if @untouched_resources.empty? %>
|
12
|
-
You are awesome and so is your test coverage! Have a fantastic day!
|
13
|
-
|
14
|
-
<% else %>
|
15
|
-
Untouched Resources:
|
16
|
-
|
17
|
-
<% @untouched_resources.each do |resource| %>
|
18
|
-
<%= resource.to_s.ljust(32) %> <%= resource.source_file %>:<%= resource.source_line %>
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
<% end %>
|
22
|
-
<% end %>
|
data/templates/coverage/json.erb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<%='Touched'.to_s.ljust(8) %> <%='Resource'.to_s.ljust(48) %> File:Line
|
2
|
-
<% @all_resources.each do |resource| %>
|
3
|
-
<%=resource.touched?.to_s.ljust(8) %> <%= resource.to_s.ljust(48) %> <%= resource.source_file %>:<%= resource.source_line %>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<% if @total == 0 %>
|
7
|
-
No Chef resources found, skipping coverage calculation...
|
8
|
-
<% else %>
|
9
|
-
ChefSpec Coverage report generated...
|
10
|
-
|
11
|
-
Total Resources: <%= @total %>
|
12
|
-
Touched Resources: <%= @touched %>
|
13
|
-
Touch Coverage: <%= @coverage %>%
|
14
|
-
<% end %>
|