puppet-retrospec 1.4.0 → 1.4.1
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/CHANGELOG.md +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -0
- data/lib/retrospec/plugins/v1/plugin/puppet.rb +1 -0
- data/lib/retrospec/plugins/v1/plugin/version.rb +1 -1
- data/spec/unit/generators/definition_generator_spec.rb +4 -4
- data/spec/unit/generators/module_data_spec.rb +24 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca1e5137298e9ae66d799a66eaf71a221e696379
|
4
|
+
data.tar.gz: 707f87e0cb1f5fb001d16459a037f8055806f9ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c72d4b82b2eec85b0c29194f33822b3fe135246206c135f99f6cfd8f86a8c155a071f5e7cd9057ce8aa100b3d6d99df05fe53a275a6bb45d39bfe3871baa095b
|
7
|
+
data.tar.gz: 223c391870cedfb12b50dfc6246e91fbad7cbc667d4102dafa42d4e09c38b44b8a6f6be0e86b802cc78b8d9e91ac5cd068fe4807cb0d1067d6829a5505051639
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -50,6 +50,10 @@ TOC Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
|
|
50
50
|
[](http://badge.fury.io/rb/puppet-retrospec)
|
51
51
|
|
52
52
|
## News
|
53
|
+
### 5/10/17
|
54
|
+
Adds ability to create module data. With the release of puppet 4.9 we can now use module data.
|
55
|
+
Use the module_data generater to auto setup module data in your puppet module. `retrospec puppet module_data`
|
56
|
+
|
53
57
|
### 4/20/17
|
54
58
|
With all the changes in hiera recently and the ability to provide data in puppet modules. I thought it would be a good
|
55
59
|
time to create a generator for retrospec to create hiera backends and data in module scaffolding. With the 1.6.0 release
|
@@ -60,6 +64,8 @@ Just run `retrospec puppet module_data` to auto create the scaffolding.
|
|
60
64
|
Note: You must be using puppet 4.7+ (PE 2016.4.x) to actually use data in a module, but there is nothing stopping
|
61
65
|
you from creating the scaffolding.
|
62
66
|
|
67
|
+
Note: If you are using puppet 4.7-4.8 you will need to add `data_provider: "hiera"` in your module's metadata.json file.
|
68
|
+
|
63
69
|
### 3/7/17
|
64
70
|
You can now sync files. Any template file that contains a `.sync` in the file name will automatically
|
65
71
|
be syncronized. This is especially helpful for Gemfiles, Rakefiles and other static files that need to be updated.
|
@@ -167,6 +167,7 @@ Generates puppet rspec test code and puppet module components.
|
|
167
167
|
|
168
168
|
def module_data(module_path, config, args=[])
|
169
169
|
plugin_data = Retrospec::Puppet::Generators::ModuleDataGenerator.run_cli(config, args)
|
170
|
+
plugin_data[:puppet_context] = context
|
170
171
|
p = Retrospec::Puppet::Generators::ModuleDataGenerator.new(module_path, plugin_data)
|
171
172
|
p.run
|
172
173
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Retrospec::Puppet::Generators::DefinitionGenerator do
|
4
|
-
|
5
|
-
FileUtils.
|
4
|
+
before(:each) do
|
5
|
+
FileUtils.rm_rf(spec_files_path) if File.exist?(spec_files_path)
|
6
6
|
end
|
7
7
|
|
8
8
|
let(:generator_opts) do
|
@@ -83,11 +83,11 @@ describe Retrospec::Puppet::Generators::DefinitionGenerator do
|
|
83
83
|
describe 'spec files' do
|
84
84
|
let(:generated_files) do
|
85
85
|
[File.join(spec_files_path, 'one_define_spec.rb'),
|
86
|
-
File.join(spec_files_path, 'sub', 'settings_define_spec.rb')]
|
86
|
+
File.join(spec_files_path, 'sub', 'settings_define_spec.rb')].sort
|
87
87
|
end
|
88
88
|
it 'should generate a bunch of files' do
|
89
89
|
files = Retrospec::Puppet::Generators::DefinitionGenerator.generate_spec_files(module_path, generator_opts)
|
90
|
-
expect(files).to eq(generated_files)
|
90
|
+
expect(files.sort).to eq(generated_files)
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -3,6 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe 'ModuleDataGenerator' do
|
4
4
|
let(:cli_opts) do
|
5
5
|
cli_opts = Retrospec::Puppet::Generators::ModuleDataGenerator.run_cli(context, opts)
|
6
|
+
cli_opts[:puppet_context] = puppet_context
|
7
|
+
cli_opts
|
6
8
|
end
|
7
9
|
|
8
10
|
let(:context) do
|
@@ -10,6 +12,18 @@ describe 'ModuleDataGenerator' do
|
|
10
12
|
:template_dir => retrospec_templates_path }
|
11
13
|
end
|
12
14
|
|
15
|
+
let(:puppet_context) do
|
16
|
+
# before we validate the module directory we should ensure the module exists by creating it
|
17
|
+
# validation also occurs when setting the module path
|
18
|
+
# these are required because the puppet module creates a singleton with some cached values
|
19
|
+
Utilities::PuppetModule.instance.module_dir_name = File.basename(module_path)
|
20
|
+
Utilities::PuppetModule.instance.module_name = File.basename(module_path)
|
21
|
+
Utilities::PuppetModule.instance.module_path = module_path
|
22
|
+
Utilities::PuppetModule.create_tmp_module_path # this is required to finish initialization
|
23
|
+
# setting the context is required to make other methods below work. #TODO lazy create the context
|
24
|
+
::Retrospec::Puppet::SpecObject.new(module_path, Utilities::PuppetModule.instance, context)
|
25
|
+
end
|
26
|
+
|
13
27
|
let(:module_path) do
|
14
28
|
File.join(fixture_modules_path, 'tomcat')
|
15
29
|
end
|
@@ -38,7 +52,16 @@ describe 'ModuleDataGenerator' do
|
|
38
52
|
generator.run
|
39
53
|
expect(File.exist?(File.join(module_path, 'data'))).to eq(true)
|
40
54
|
expect(File.exist?(File.join(module_path, 'functions'))).to eq(false)
|
41
|
-
expect(File.exist?(File.join(module_path, 'data', '
|
55
|
+
expect(File.exist?(File.join(module_path, 'data', 'common.yaml'))).to eq(true)
|
56
|
+
expect(File.exist?(File.join(module_path, 'hiera.yaml'))).to eq(true)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'works with hiera data' do
|
60
|
+
generator.run
|
61
|
+
output = File.read(File.join(module_path, 'data', 'common.yaml'))
|
62
|
+
expect(output).to match(/tomcat/)
|
63
|
+
expect(File.exist?(File.join(module_path, 'data'))).to eq(true)
|
64
|
+
expect(File.exist?(File.join(module_path, 'functions'))).to eq(false)
|
42
65
|
expect(File.exist?(File.join(module_path, 'data', 'common.yaml'))).to eq(true)
|
43
66
|
expect(File.exist?(File.join(module_path, 'hiera.yaml'))).to eq(true)
|
44
67
|
end
|