puppet-retrospec 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +2 -1
- data/CHANGELOG.md +2 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +10 -2
- data/README.md +3 -5
- data/lib/retrospec/plugins/v1/plugin/generators/parsers/facter.rb +1 -1
- data/lib/retrospec/plugins/v1/plugin/generators/serializers/rspec_dumper_full.rb +1 -1
- data/lib/retrospec/plugins/v1/plugin/generators/serializers/schema_dumper.rb +1 -1
- data/lib/retrospec/plugins/v1/plugin/puppet.rb +2 -33
- data/lib/retrospec/plugins/v1/plugin/version.rb +1 -1
- data/puppet-retrospec.gemspec +2 -2
- data/spec/unit/puppet-retrospec_spec.rb +10 -10
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19182f00aac6e9f41d3dad24c42331a932ef3082
|
4
|
+
data.tar.gz: af3c40c03e987d7257fc7afcd4bc11b34b89d3d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38e3846b3e6dd206a60c3696e638b8e14228d2b02b8d2edd4609e53dba3c68376bb9e6057d79bdb4eeac2b0de4f2571aad042d2ae05f2486ea76f03857057101
|
7
|
+
data.tar.gz: b1824320e73212d7082da5835a068c2035eb807fc3f7f66c8bf5efae042a1519282401500b4da7d870534b2b9f27a3809021b1e9da21b276a504dba3efbf64c3
|
data/.gitlab-ci.yml
CHANGED
@@ -39,6 +39,7 @@ ruby2.3:
|
|
39
39
|
image: ruby:2.3
|
40
40
|
|
41
41
|
stages:
|
42
|
+
- validate
|
42
43
|
- test
|
43
44
|
- release
|
44
45
|
- deploy
|
@@ -60,7 +61,7 @@ bump_and_tag:
|
|
60
61
|
tags:
|
61
62
|
- ruby2.2
|
62
63
|
only:
|
63
|
-
- master@
|
64
|
+
- master@nwops/puppet-retrospec
|
64
65
|
script:
|
65
66
|
- gem install release_me
|
66
67
|
- bump_and_tag
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -2,12 +2,13 @@ source 'http://rubygems.org'
|
|
2
2
|
|
3
3
|
gem 'awesome_print'
|
4
4
|
gem 'facets'
|
5
|
-
gem 'retrospec', '~> 0.
|
5
|
+
gem 'retrospec', '~> 0.6'
|
6
6
|
gem 'trollop'
|
7
7
|
|
8
8
|
group :development do
|
9
9
|
gem 'pry'
|
10
10
|
gem 'rdoc', '~> 3.12'
|
11
|
+
gem 'overcommit'
|
11
12
|
end
|
12
13
|
|
13
14
|
group :test do
|
@@ -17,6 +18,6 @@ group :test do
|
|
17
18
|
gem 'puppet', '4.5.2', :path => 'vendor/gems/puppet-4.5.2'
|
18
19
|
gem 'rake'
|
19
20
|
gem 'rspec', '~> 3.2'
|
20
|
-
gem 'rubocop'
|
21
|
+
gem 'rubocop'
|
21
22
|
gem 'yard', '~> 0.7'
|
22
23
|
end
|
data/Gemfile.lock
CHANGED
@@ -12,16 +12,23 @@ GEM
|
|
12
12
|
CFPropertyList (2.2.8)
|
13
13
|
ast (2.3.0)
|
14
14
|
awesome_print (1.7.0)
|
15
|
+
childprocess (0.5.9)
|
16
|
+
ffi (~> 1.0, >= 1.0.11)
|
15
17
|
coderay (1.1.1)
|
16
18
|
diff-lcs (1.2.5)
|
17
19
|
facets (3.1.0)
|
18
20
|
facter (2.4.6)
|
19
21
|
CFPropertyList (~> 2.2.6)
|
20
22
|
fakefs (0.9.1)
|
23
|
+
ffi (1.9.18)
|
21
24
|
hiera (3.2.1)
|
25
|
+
iniparse (1.4.2)
|
22
26
|
json (1.8.3)
|
23
27
|
json_pure (2.0.1)
|
24
28
|
method_source (0.8.2)
|
29
|
+
overcommit (0.38.0)
|
30
|
+
childprocess (~> 0.5.8)
|
31
|
+
iniparse (~> 1.4)
|
25
32
|
parser (2.3.1.4)
|
26
33
|
ast (~> 2.2)
|
27
34
|
powerpack (0.1.1)
|
@@ -33,7 +40,7 @@ GEM
|
|
33
40
|
rake (11.3.0)
|
34
41
|
rdoc (3.12.2)
|
35
42
|
json (~> 1.4)
|
36
|
-
retrospec (0.
|
43
|
+
retrospec (0.6.0)
|
37
44
|
trollop
|
38
45
|
rspec (3.5.0)
|
39
46
|
rspec-core (~> 3.5.0)
|
@@ -69,11 +76,12 @@ DEPENDENCIES
|
|
69
76
|
facets
|
70
77
|
fakefs
|
71
78
|
json_pure (= 2.0.1)
|
79
|
+
overcommit
|
72
80
|
pry
|
73
81
|
puppet (= 4.5.2)!
|
74
82
|
rake
|
75
83
|
rdoc (~> 3.12)
|
76
|
-
retrospec (~> 0.
|
84
|
+
retrospec (~> 0.6)
|
77
85
|
rspec (~> 3.2)
|
78
86
|
rubocop
|
79
87
|
trollop
|
data/README.md
CHANGED
@@ -30,7 +30,6 @@ Table of Contents
|
|
30
30
|
* [Creating a new function](#creating-a-new-function)
|
31
31
|
* [Creating a new type](#creating-a-new-type)
|
32
32
|
* [Creating a schema file](#creating-a-new-module-schema-file)
|
33
|
-
* [Dependency](#dependency)
|
34
33
|
* [Enable Future Parser](#enabling-the-future-parser)
|
35
34
|
* [Configuration](#configuration)
|
36
35
|
* [Example](#example)
|
@@ -51,6 +50,9 @@ TOC Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)
|
|
51
50
|
[![Gem Version](https://badge.fury.io/rb/puppet-retrospec.svg)](http://badge.fury.io/rb/puppet-retrospec)
|
52
51
|
|
53
52
|
## News
|
53
|
+
### 3/7/17
|
54
|
+
You can now sync files. Any template file that contains a `.sync` in the file name will automatically
|
55
|
+
be syncronized. This is especially helpful for Gemfiles, Rakefiles and other static files that need to be updated.
|
54
56
|
### 2/1/17
|
55
57
|
You can now choose to overwrite files! This is very useful when updating old module code with newer content.
|
56
58
|
See Usage below for how to enable.
|
@@ -225,10 +227,6 @@ retrospec puppet
|
|
225
227
|
+ /private/tmp/testabc124/testabc124_schema.yaml
|
226
228
|
```
|
227
229
|
|
228
|
-
## Dependency
|
229
|
-
Retrospec relies heavily on the puppet 3.7.x codebase. Because of this hard dependency the puppet gem is vendored into the library so there should not be conflicts with your existing puppet gem.
|
230
|
-
|
231
|
-
|
232
230
|
## Configuration
|
233
231
|
Below is a list of options that you can set in the config file. Setting these options will help cut down on passing parameters. (/Users/username/.retrospec/config.yaml) `retrospec -h`
|
234
232
|
|
@@ -227,7 +227,7 @@ module Retrospec
|
|
227
227
|
|
228
228
|
def dump_LambdaExpression o
|
229
229
|
result = ["lambda"]
|
230
|
-
result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size
|
230
|
+
result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size > 0
|
231
231
|
if o.body
|
232
232
|
result << do_dump(o.body)
|
233
233
|
else
|
@@ -198,7 +198,7 @@ module Retrospec
|
|
198
198
|
|
199
199
|
def dump_LambdaExpression o
|
200
200
|
result = ["lambda"]
|
201
|
-
result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size
|
201
|
+
result << ["parameters"] + o.parameters.collect {|p| do_dump(p) } if o.parameters.size > 0
|
202
202
|
if o.body
|
203
203
|
result << do_dump(o.body)
|
204
204
|
else
|
@@ -265,7 +265,8 @@ Generates puppet rspec test code and puppet module components.
|
|
265
265
|
|
266
266
|
# this is the method that performs all the magic and creates all the files
|
267
267
|
def create_files
|
268
|
-
|
268
|
+
filter = /nodesets|acceptance|spec_helper_acceptance/ unless context.enable_beaker_tests?
|
269
|
+
safe_create_module_files(template_dir, module_path, context, filter)
|
269
270
|
fact(module_path, config_data)
|
270
271
|
type_spec_files(module_path, config_data)
|
271
272
|
provider_spec_files(module_path, config_data)
|
@@ -279,38 +280,6 @@ Generates puppet rspec test code and puppet module components.
|
|
279
280
|
true
|
280
281
|
end
|
281
282
|
|
282
|
-
# creates any file that is contained in the templates/modules_files directory structure
|
283
|
-
# loops through the directory looking for erb files or other files.
|
284
|
-
# strips the erb extension and renders the template to the current module path
|
285
|
-
# filenames must named how they would appear in the normal module path. The directory
|
286
|
-
# structure where the file is contained
|
287
|
-
def safe_create_module_files
|
288
|
-
templates = Find.find(File.join(template_dir, 'module_files')).sort
|
289
|
-
templates.each do |template|
|
290
|
-
# need to remove the erb extension and rework the destination path
|
291
|
-
if template =~ /nodesets|acceptance|spec_helper_acceptance/ and !context.enable_beaker_tests?
|
292
|
-
next
|
293
|
-
else
|
294
|
-
dest = template.gsub(File.join(template_dir, 'module_files'), module_path)
|
295
|
-
if File.symlink?(template)
|
296
|
-
safe_create_symlink(template, dest)
|
297
|
-
elsif File.directory?(template)
|
298
|
-
safe_mkdir(dest)
|
299
|
-
else
|
300
|
-
# because some plugins contain erb files themselves any erb file will be copied only
|
301
|
-
# so we need to designate which files should be rendered with .retrospec.erb
|
302
|
-
if template =~ /\.retrospec\.erb/
|
303
|
-
# render any file ending in .retrospec_erb as a template
|
304
|
-
dest = dest.gsub(/\.retrospec\.erb/, '')
|
305
|
-
safe_create_template_file(dest, template, context)
|
306
|
-
else
|
307
|
-
safe_copy_file(template, dest)
|
308
|
-
end
|
309
|
-
end
|
310
|
-
end
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
283
|
def description
|
315
284
|
'Generates puppet rspec test code based on the classes and defines inside the manifests directory'
|
316
285
|
end
|
data/puppet-retrospec.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.require_paths = ["lib"]
|
12
12
|
s.authors = ["Corey Osman"]
|
13
|
-
s.date = "
|
13
|
+
s.date = "2017-03-07"
|
14
14
|
s.description = "Retrofits and generates valid puppet rspec test code to existing modules"
|
15
15
|
s.email = "corey@nwops.io"
|
16
16
|
s.extra_rdoc_files = [
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.rubygems_version = "2.4.5.1"
|
25
25
|
s.summary = "Generates puppet rspec test code based on the classes and defines inside the manifests directory. Aims to reduce some of the boilerplate coding with default test patterns."
|
26
26
|
s.add_runtime_dependency(%q<trollop>, [">= 0"])
|
27
|
-
s.add_runtime_dependency(%q<retrospec>, ["~> 0.
|
27
|
+
s.add_runtime_dependency(%q<retrospec>, ["~> 0.6"])
|
28
28
|
s.add_runtime_dependency(%q<awesome_print>, [">= 0"])
|
29
29
|
s.add_runtime_dependency(%q<facets>, [">= 0"])
|
30
30
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
@@ -140,7 +140,7 @@ describe 'puppet-retrospec' do
|
|
140
140
|
tomcat = Retrospec::Plugins::V1::Puppet.new(module_path, global_opts)
|
141
141
|
tomcat.post_init
|
142
142
|
filepath = File.expand_path(File.join(module_path, 'spec', 'acceptance', 'nodesets', 'default.yml'))
|
143
|
-
tomcat.
|
143
|
+
tomcat.create_files
|
144
144
|
expect(File.exist?(filepath)).to eq(true)
|
145
145
|
expect(Dir.glob(File.expand_path(File.join(module_path, 'spec', 'acceptance', 'nodesets', '*.yml'))).length).to eq 15
|
146
146
|
end
|
@@ -188,7 +188,7 @@ describe 'puppet-retrospec' do
|
|
188
188
|
tomcat = Retrospec::Plugins::V1::Puppet.new(module_path, global_opts)
|
189
189
|
tomcat.post_init
|
190
190
|
filepath = File.expand_path(File.join(module_path, 'spec', 'spec_helper.rb'))
|
191
|
-
tomcat.
|
191
|
+
tomcat.create_files
|
192
192
|
path = tomcat.module_path
|
193
193
|
expect(File.exist?(filepath)).to eq(true)
|
194
194
|
end
|
@@ -197,7 +197,7 @@ describe 'puppet-retrospec' do
|
|
197
197
|
tomcat = Retrospec::Plugins::V1::Puppet.new(module_path, global_opts)
|
198
198
|
tomcat.post_init
|
199
199
|
filepath = File.expand_path(File.join(module_path, 'spec', 'shared_contexts.rb'))
|
200
|
-
tomcat.
|
200
|
+
tomcat.create_files
|
201
201
|
expect(File.exist?(filepath)).to eq(true)
|
202
202
|
end
|
203
203
|
|
@@ -205,7 +205,7 @@ describe 'puppet-retrospec' do
|
|
205
205
|
tomcat = Retrospec::Plugins::V1::Puppet.new(module_path, global_opts)
|
206
206
|
tomcat.post_init
|
207
207
|
filepath = File.expand_path(File.join(module_path, 'spec', 'shared_contexts.rb'))
|
208
|
-
tomcat.
|
208
|
+
tomcat.create_files
|
209
209
|
path = tomcat.module_path
|
210
210
|
expect(tomcat.context.all_hiera_data).to eq('tomcat::catalina_home' => nil,
|
211
211
|
'tomcat::user' => nil,
|
@@ -225,7 +225,7 @@ describe 'puppet-retrospec' do
|
|
225
225
|
tomcat = Retrospec::Plugins::V1::Puppet.new(@opts[:module_path], opts)
|
226
226
|
tomcat.post_init
|
227
227
|
filepath = File.expand_path(File.join(path, 'spec', 'spec_helper_acceptance.rb'))
|
228
|
-
tomcat.
|
228
|
+
tomcat.create_files
|
229
229
|
expect(File.exist?(filepath)).to eq(true)
|
230
230
|
end
|
231
231
|
|
@@ -235,7 +235,7 @@ describe 'puppet-retrospec' do
|
|
235
235
|
filepath = File.expand_path(File.join(path, 'spec', 'spec_helper_acceptance.rb'))
|
236
236
|
tomcat = Retrospec::Plugins::V1::Puppet.new(@opts[:module_path], opts)
|
237
237
|
tomcat.post_init
|
238
|
-
tomcat.
|
238
|
+
tomcat.create_files
|
239
239
|
expect(File.exist?(filepath)).to eq(false)
|
240
240
|
end
|
241
241
|
|
@@ -245,7 +245,7 @@ describe 'puppet-retrospec' do
|
|
245
245
|
tomcat = Retrospec::Plugins::V1::Puppet.new(@opts[:module_path], opts)
|
246
246
|
tomcat.post_init
|
247
247
|
filepath = File.expand_path(File.join(path, 'spec', 'acceptance', 'nodesets', 'default.yml'))
|
248
|
-
tomcat.
|
248
|
+
tomcat.create_files
|
249
249
|
expect(File.exist?(filepath)).to eq(true)
|
250
250
|
expect(Dir.glob(File.expand_path(File.join(path, 'spec', 'acceptance', 'nodesets', '*.yml'))).length).to eq 15
|
251
251
|
end
|
@@ -254,7 +254,7 @@ describe 'puppet-retrospec' do
|
|
254
254
|
tomcat = Retrospec::Plugins::V1::Puppet.new(module_path, global_opts)
|
255
255
|
tomcat.post_init
|
256
256
|
filepath = File.expand_path(File.join(module_path, 'Gemfile'))
|
257
|
-
tomcat.
|
257
|
+
tomcat.create_files
|
258
258
|
expect(File.exist?(filepath)).to eq(true)
|
259
259
|
end
|
260
260
|
|
@@ -262,7 +262,7 @@ describe 'puppet-retrospec' do
|
|
262
262
|
tomcat = Retrospec::Plugins::V1::Puppet.new(module_path, global_opts)
|
263
263
|
tomcat.post_init
|
264
264
|
filepath = File.expand_path(File.join(module_path, 'Rakefile'))
|
265
|
-
tomcat.
|
265
|
+
tomcat.create_files
|
266
266
|
expect(File.exist?(filepath)).to eq(true)
|
267
267
|
end
|
268
268
|
|
@@ -271,7 +271,7 @@ describe 'puppet-retrospec' do
|
|
271
271
|
FileUtils.rm_f(filepath) # ensure we have a clean state
|
272
272
|
tomcat = Retrospec::Plugins::V1::Puppet.new(module_path, global_opts)
|
273
273
|
tomcat.post_init
|
274
|
-
tomcat.
|
274
|
+
tomcat.create_files
|
275
275
|
expect(File.exist?(filepath)).to eq(true)
|
276
276
|
end
|
277
277
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-retrospec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trollop
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
33
|
+
version: '0.6'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
40
|
+
version: '0.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: awesome_print
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|