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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b6e329b9bf28b9a369953d9fca8ff19d1cc32e82
4
- data.tar.gz: f5198887c6b93f1b6b44383d2dd3f9183cb001eb
3
+ metadata.gz: ca1e5137298e9ae66d799a66eaf71a221e696379
4
+ data.tar.gz: 707f87e0cb1f5fb001d16459a037f8055806f9ba
5
5
  SHA512:
6
- metadata.gz: e3601799c03379311d561889c8f9ecf7bafab7c817cf40d68ada86ed4ddbf572e01fd1dee95f685dcd6652c09c4efda9166dba6c30af767fd104d870c608f226
7
- data.tar.gz: c21306e18c27ffac761fa3384c93f923b68063fe69e944b62bf828771b40634b62d9f3700eb0ebb0cda9aed1f0e3466a9cc0f7ad7fd54b1ec8932dc2cfb1437a
6
+ metadata.gz: c72d4b82b2eec85b0c29194f33822b3fe135246206c135f99f6cfd8f86a8c155a071f5e7cd9057ce8aa100b3d6d99df05fe53a275a6bb45d39bfe3871baa095b
7
+ data.tar.gz: 223c391870cedfb12b50dfc6246e91fbad7cbc667d4102dafa42d4e09c38b44b8a6f6be0e86b802cc78b8d9e91ac5cd068fe4807cb0d1067d6829a5505051639
@@ -1,3 +1,5 @@
1
+ ## 1.4.1
2
+ * Adds real module data to common.yaml
1
3
  ## 1.4.0
2
4
  * Fixes gh-67 - adds abiltity to auto generate data in a module
3
5
  * Forces retrospec version 0.6.2 or greater
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- puppet-retrospec (1.4.0)
4
+ puppet-retrospec (1.4.1)
5
5
  awesome_print
6
6
  facets
7
7
  retrospec (>= 0.6.2)
data/README.md CHANGED
@@ -50,6 +50,10 @@ TOC Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
50
50
  [![Gem Version](https://badge.fury.io/rb/puppet-retrospec.svg)](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,5 +1,5 @@
1
1
  module Retrospec
2
2
  module Puppet
3
- VERSION = '1.4.0'
3
+ VERSION = '1.4.1'
4
4
  end
5
5
  end
@@ -1,8 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Retrospec::Puppet::Generators::DefinitionGenerator do
4
- after(:each) do
5
- FileUtils.rm(spec_file) if File.exist?(spec_file)
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', 'os'))).to eq(true)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-retrospec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman