puppet-retrospec 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/VERSION +1 -1
- data/bin/retrospec +2 -5
- data/lib/retrospec.rb +41 -45
- data/lib/retrospec/exceptions.rb +4 -0
- data/lib/retrospec/puppet_module.rb +163 -0
- data/lib/retrospec/resource.rb +2 -3
- data/lib/retrospec/spec_object.rb +37 -0
- data/lib/retrospec/templates/gemfile.erb +12 -10
- data/lib/retrospec/templates/nodesets/centos-66-x64.yml +11 -0
- data/lib/retrospec/templates/rakefile.erb +3 -0
- data/lib/retrospec/templates/resource_spec_file.erb +3 -3
- data/lib/retrospec/templates/spec_helper_file.erb +1 -0
- data/lib/retrospec/templates/travis.yml.erb +14 -0
- data/lib/retrospec/type_code.rb +14 -2
- data/lib/retrospec/variable_store.rb +70 -9
- data/lib/retrospec/version.rb +1 -1
- data/puppet-retrospec.gemspec +14 -7
- data/spec/fixtures/fixture_modules/one_resource_module/manifests/{another_resource_class.pp → another_resource.pp} +4 -3
- data/spec/fixtures/fixture_modules/one_resource_module/manifests/inherits_params.pp +8 -0
- data/spec/fixtures/fixture_modules/one_resource_module/manifests/params.pp +19 -0
- data/spec/integration/retrospec_spec.rb +36 -0
- data/spec/unit/conditional_spec.rb +41 -23
- data/spec/unit/module_spec.rb +55 -0
- data/spec/unit/puppet-retrospec_spec.rb +15 -22
- data/spec/unit/resource_spec.rb +46 -38
- data/spec/unit/type_code_spec.rb +37 -19
- data/spec/unit/variable_store_spec.rb +72 -16
- metadata +40 -33
- data/lib/retrospec/module_utilities.rb +0 -80
- data/lib/retrospec/templates/nodesets/centos-65-x64.yml +0 -10
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: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet
|
@@ -28,154 +28,154 @@ dependencies:
|
|
28
28
|
name: trollop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
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
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.14'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.7'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.7'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '3.12'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.12'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: jeweler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: fakefs
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '>='
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '>='
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: pry-rescue
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '>='
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: pry-stack_explorer
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: pry-coolline
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - '>='
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - '>='
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
description: Retrofits and generates valid puppet rspec test code to existing modules
|
@@ -187,9 +187,9 @@ extra_rdoc_files:
|
|
187
187
|
- LICENSE
|
188
188
|
- README.md
|
189
189
|
files:
|
190
|
-
-
|
191
|
-
-
|
192
|
-
-
|
190
|
+
- .document
|
191
|
+
- .rspec
|
192
|
+
- .travis.yml
|
193
193
|
- Gemfile
|
194
194
|
- LICENSE
|
195
195
|
- README.md
|
@@ -198,16 +198,18 @@ files:
|
|
198
198
|
- bin/retrospec
|
199
199
|
- lib/retrospec.rb
|
200
200
|
- lib/retrospec/conditional.rb
|
201
|
+
- lib/retrospec/exceptions.rb
|
201
202
|
- lib/retrospec/helpers.rb
|
202
|
-
- lib/retrospec/
|
203
|
+
- lib/retrospec/puppet_module.rb
|
203
204
|
- lib/retrospec/resource.rb
|
205
|
+
- lib/retrospec/spec_object.rb
|
204
206
|
- lib/retrospec/templates/acceptance_spec_test.erb
|
205
207
|
- lib/retrospec/templates/fixtures_file.erb
|
206
208
|
- lib/retrospec/templates/gemfile.erb
|
207
209
|
- lib/retrospec/templates/nodesets/centos-59-x64.yml
|
208
210
|
- lib/retrospec/templates/nodesets/centos-64-x64-pe.yml
|
209
211
|
- lib/retrospec/templates/nodesets/centos-64-x64.yml
|
210
|
-
- lib/retrospec/templates/nodesets/centos-
|
212
|
+
- lib/retrospec/templates/nodesets/centos-66-x64.yml
|
211
213
|
- lib/retrospec/templates/nodesets/debian-607-x64.yml
|
212
214
|
- lib/retrospec/templates/nodesets/debian-70rc1-x64.yml
|
213
215
|
- lib/retrospec/templates/nodesets/debian-73-i386.yml
|
@@ -224,18 +226,23 @@ files:
|
|
224
226
|
- lib/retrospec/templates/shared_context.erb
|
225
227
|
- lib/retrospec/templates/spec_helper_acceptance.rb.erb
|
226
228
|
- lib/retrospec/templates/spec_helper_file.erb
|
229
|
+
- lib/retrospec/templates/travis.yml.erb
|
227
230
|
- lib/retrospec/type_code.rb
|
228
231
|
- lib/retrospec/variable_store.rb
|
229
232
|
- lib/retrospec/version.rb
|
230
233
|
- puppet-retrospec.gemspec
|
231
|
-
- spec/fixtures/fixture_modules/one_resource_module/manifests/
|
234
|
+
- spec/fixtures/fixture_modules/one_resource_module/manifests/another_resource.pp
|
235
|
+
- spec/fixtures/fixture_modules/one_resource_module/manifests/inherits_params.pp
|
232
236
|
- spec/fixtures/fixture_modules/one_resource_module/manifests/one_resource_class.pp
|
237
|
+
- spec/fixtures/fixture_modules/one_resource_module/manifests/params.pp
|
233
238
|
- spec/fixtures/fixture_modules/zero_resource_module/manifests/empty_class.pp
|
234
239
|
- spec/fixtures/fixture_modules/zero_resource_module/manifests/not_a_resource_defination.pp
|
235
240
|
- spec/fixtures/manifests/includes-class.pp
|
236
241
|
- spec/fixtures/manifests/includes-defines.pp
|
242
|
+
- spec/integration/retrospec_spec.rb
|
237
243
|
- spec/spec_helper.rb
|
238
244
|
- spec/unit/conditional_spec.rb
|
245
|
+
- spec/unit/module_spec.rb
|
239
246
|
- spec/unit/puppet-retrospec_spec.rb
|
240
247
|
- spec/unit/resource_spec.rb
|
241
248
|
- spec/unit/type_code_spec.rb
|
@@ -250,17 +257,17 @@ require_paths:
|
|
250
257
|
- lib
|
251
258
|
required_ruby_version: !ruby/object:Gem::Requirement
|
252
259
|
requirements:
|
253
|
-
- -
|
260
|
+
- - '>='
|
254
261
|
- !ruby/object:Gem::Version
|
255
262
|
version: '0'
|
256
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
257
264
|
requirements:
|
258
|
-
- -
|
265
|
+
- - '>='
|
259
266
|
- !ruby/object:Gem::Version
|
260
267
|
version: '0'
|
261
268
|
requirements: []
|
262
269
|
rubyforge_project:
|
263
|
-
rubygems_version: 2.4.
|
270
|
+
rubygems_version: 2.4.4
|
264
271
|
signing_key:
|
265
272
|
specification_version: 4
|
266
273
|
summary: Generates puppet rspec test code based on the classes and defines inside
|
@@ -1,80 +0,0 @@
|
|
1
|
-
module PuppetModule
|
2
|
-
module Utilities
|
3
|
-
|
4
|
-
# puts a symlink in that module directory that points back to the user supplied module path
|
5
|
-
def create_tmp_module_path(module_path)
|
6
|
-
path = File.join(tmp_modules_dir, module_dir_name)
|
7
|
-
unless File.exists?(path)
|
8
|
-
# create a link where source is the current repo and dest is /tmp/modules/module_name
|
9
|
-
FileUtils.ln_s(module_path, path)
|
10
|
-
end
|
11
|
-
path
|
12
|
-
end
|
13
|
-
|
14
|
-
def tmp_module_path
|
15
|
-
@tmp_module_path ||= File.join(tmp_modules_dir, module_dir_name)
|
16
|
-
end
|
17
|
-
|
18
|
-
# the directory name of the module
|
19
|
-
# usually this is the same as the module name but it can be namespaced sometimes
|
20
|
-
def module_dir_name
|
21
|
-
@module_dir_name ||= File.basename(module_path)
|
22
|
-
end
|
23
|
-
|
24
|
-
# returns the name of the module ie. mysql::config => mysql
|
25
|
-
def module_name
|
26
|
-
begin
|
27
|
-
@module_name ||= types.first.name.split('::').first
|
28
|
-
rescue
|
29
|
-
@module_name = module_dir_name
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# creates a tmp module directory so puppet can work correctly
|
34
|
-
def tmp_modules_dir
|
35
|
-
if @tmp_modules_dir.nil?
|
36
|
-
dir = Dir.mktmpdir
|
37
|
-
tmp_path = File.expand_path(File.join(dir, 'modules'))
|
38
|
-
FileUtils.mkdir_p(tmp_path)
|
39
|
-
@tmp_modules_dir = tmp_path
|
40
|
-
end
|
41
|
-
@tmp_modules_dir
|
42
|
-
end
|
43
|
-
|
44
|
-
# creates a puppet environment given a module path and environment name
|
45
|
-
def puppet_environment
|
46
|
-
@puppet_environment ||= Puppet::Node::Environment.create('production', [tmp_modules_dir])
|
47
|
-
end
|
48
|
-
|
49
|
-
# creates a puppet resource request to be used indirectly
|
50
|
-
def request(key, method)
|
51
|
-
instance = Puppet::Indirector::Indirection.instance(:resource_type)
|
52
|
-
indirection_name = 'test'
|
53
|
-
@request = Puppet::Indirector::Request.new(indirection_name, method, key, instance)
|
54
|
-
@request.environment = puppet_environment
|
55
|
-
@request
|
56
|
-
end
|
57
|
-
|
58
|
-
# creates an instance of the resource type parser
|
59
|
-
def resource_type_parser
|
60
|
-
@resource_type_parser ||= Puppet::Indirector::ResourceType::Parser.new
|
61
|
-
end
|
62
|
-
|
63
|
-
# returns the resource type object given a resource name ie. tomcat::connector
|
64
|
-
def find_resource(resource_name)
|
65
|
-
request = request(resource_name, 'find')
|
66
|
-
resource_type_parser.find(request)
|
67
|
-
end
|
68
|
-
|
69
|
-
# returns the resource types found in the module
|
70
|
-
def search_module(pattern='*')
|
71
|
-
request = request(pattern, 'search')
|
72
|
-
resource_type_parser.search(request)
|
73
|
-
end
|
74
|
-
|
75
|
-
# TODO we need to parse the types and find all the types that inherit other types and then order them so we can load the files first
|
76
|
-
def types
|
77
|
-
@types ||= search_module || []
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|