puppet-retrospec 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 027977cdd2e60766923d0d8c013efb9beafcff28
4
+ data.tar.gz: 1652ba814a16849574a492e2f06c917829625416
5
+ SHA512:
6
+ metadata.gz: 81ab8cff8a124a17b60d2dfe2c3ea50a467a58fe30aaedc3d10791f23328cb68a32fa31efb93298d699d879cfacb3401bc5de9412b59678ecf6f7f12822b6914
7
+ data.tar.gz: 70a98a402f0a993551fd46c81540289955a36427b5cc38804485d5639e3004e7a0344542b54d126ea3f980b63fb3819e798818e6bb43d93bd7ae855d51b8bca5
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,28 @@
1
+ branches:
2
+ only:
3
+ - master
4
+ - development
5
+ language: ruby
6
+ script: "bundle exec rake spec SPEC_OPTS='--format documentation'"
7
+ rvm:
8
+ - 1.9.3
9
+ - 2.0.0
10
+ - 2.1.3
11
+ env:
12
+ matrix:
13
+ - PUPPET_GEM_VERSION="~> 2.7"
14
+ - PUPPET_GEM_VERSION="~> 3.2"
15
+ - PUPPET_GEM_VERSION="~> 3.6"
16
+ - PUPPET_GEM_VERSION="~> 3.7"
17
+
18
+ matrix:
19
+ exclude:
20
+ - rvm: 1.9.3
21
+ env: PUPPET_GEM_VERSION="~> 2.7"
22
+ - rvm: 2.0.0
23
+ env: PUPPET_GEM_VERSION="~> 2.7"
24
+ - rvm: 2.1.3
25
+ env: PUPPET_GEM_VERSION="~> 2.7"
26
+ notifications:
27
+ email: corey@logicminds.biz
28
+
data/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ source "http://rubygems.org"
2
+
3
+ if puppetversion = ENV['PUPPET_GEM_VERSION']
4
+ gem 'puppet', puppetversion, :require => false
5
+ else
6
+ gem 'puppet', :require => false
7
+ end
8
+
9
+ gem 'trollop'
10
+ # Add dependencies to develop your gem here.
11
+ # Include everything needed to run rake, tests, features, etc.
12
+ group :development do
13
+ gem "rspec", "~> 2.14"
14
+ gem "yard", "~> 0.7"
15
+ gem "rdoc", "~> 3.12"
16
+ gem "bundler", "~> 1.0"
17
+ gem "jeweler"
18
+ gem 'pry'
19
+ gem "fakefs", :require => "fakefs/safe"
20
+
21
+ end
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Corey Osman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,75 @@
1
+ puppet-retrospec
2
+ ================
3
+
4
+ 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.
5
+
6
+ Retrospec makes it dead simple to get started with puppet unit testing. When you run retrospec will scan you puppet manifests
7
+ and actually write some very basic rspec-puppet test code. Thus this gem will retrofit your existing puppet module
8
+ with everything needed to get going with puppet unit testing.
9
+
10
+
11
+ Build Status
12
+ ============
13
+ [![Build Status](https://travis-ci.org/logicminds/puppet-retrospec.png)](https://travis-ci.org/logicminds/puppet-retrospec)
14
+
15
+ Install
16
+ =============
17
+ `gem install puppet-retrospec`
18
+
19
+
20
+ How to use
21
+ =============
22
+ Run from a rake task
23
+ ```
24
+ require 'puppet-retrospec'
25
+
26
+ desc "Scans the module directory and automatically creates basic spec tests"
27
+ task :retrospec do
28
+ Retrospec.run
29
+ end
30
+
31
+ ```
32
+
33
+ Run from the command line
34
+ ```
35
+ $ retrospec -h
36
+ Options:
37
+ --module-path, -m <s>: destination directory to create spec tests in (Defaults to current directory)
38
+ --template-dir, -t <s>: Path to templates directory (only for overriding Retrospec templates)
39
+ --enable-user-templates, -e: Use Retrospec templates from /Users/cosman/.puppet_retrospec_templates
40
+ --help, -h: Show this message
41
+
42
+ ```
43
+
44
+ How Does it do this
45
+ =======================
46
+ Basically Retrospec uses the puppet lexer to scan your code in order to fill out some basic templates that will retrofit
47
+ your puppet module with unit tests.
48
+
49
+ Overriding the templates
50
+ =======================
51
+ There may be a time when you want to override the default templates used to generate the rspec related files.
52
+ To override these templates just set the following environment variables. Once one of the variables is set
53
+ the first run will copy over the templates from the gem location. If you have already created the file, then
54
+ puppet-retrospec will not overwrite the file. You can set multiple template path if you use them for
55
+ different projects so just be sure the set the correctly template path.
56
+
57
+ Setting the `RETROSPEC_ENABLE_LOCAL_TEMPLATES=true` Environment variable will tell retrospec to use the default user template location.
58
+
59
+ The default override location for the templates is ~/.puppet_retrospec_templates
60
+
61
+ If you wish to override the default template location you can use the following environment variable RETROSPEC_TEMPLATES_PATH.
62
+ If you set this variable you are not required set RETROSPEC_ENABLE_LOCAL_TEMPLATES.
63
+
64
+ `RETROSPEC_TEMPLATES_PATH=~/my_templates`
65
+
66
+ Todo
67
+ ============
68
+ - Add support to fill out the params in unit tests automatically
69
+ - Add support to fill out used facts in the unit tests automatically
70
+ - Add describe blocks around conditions in test code that change the catalog compilation
71
+ - Auto add dependicies to fixtures file
72
+
73
+ Support
74
+ ============
75
+ Currently this library only supports ruby >= 1.9.3. There is currently a bug with ruby version 1.8.7.
data/README.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = puppet-retrospec2
2
+
3
+ Description goes here.
4
+
5
+ == Contributing to puppet-retrospec2
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2013 Corey Osman. See LICENSE.txt for
18
+ further details.
19
+
data/Rakefile ADDED
@@ -0,0 +1,37 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "puppet-retrospec"
18
+ gem.homepage = "http://github.com/logicminds/puppet-retrospec"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{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.}
21
+ gem.description = %Q{Retrofits and generates valid puppet rspec test code to existing modules}
22
+ gem.email = "corey@logicminds.biz"
23
+ gem.authors = ["Corey Osman"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb'].exclude('spec/fixtures/**/*_spec.rb')
32
+ end
33
+
34
+ task :default => :spec
35
+
36
+ require 'yard'
37
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
data/bin/retrospec ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ require 'trollop'
3
+ require 'puppet-retrospec'
4
+
5
+ opts = Trollop::options do
6
+ opt :module_path, "destination directory to create spec tests in (Defaults to current directory) " ,
7
+ :type => :string, :required => false, :default => nil
8
+ opt :template_dir, "Path to templates directory (only for overriding Retrospec templates)", :type => :string,
9
+ :required => false, :default => nil
10
+ opt :enable_user_templates, "Use Retrospec templates from #{File.expand_path('~/.puppet_retrospec_templates')}",
11
+ :require => false, :type => :boolean
12
+ end
13
+ ENV['RETROSPEC_ENABLE_LOCAL_TEMPLATES'] = 'true' if opts[:enable_user_templates]
14
+ ENV['RETROSPEC_TEMPLATES_PATH'] = opts[:template_dir] if not opts[:template_dir].nil?
15
+ Retrospec.run(opts[:module_path])
data/lib/helpers.rb ADDED
@@ -0,0 +1,152 @@
1
+ require 'fileutils'
2
+
3
+ class Helpers
4
+
5
+
6
+ def self.run(module_name=nil)
7
+ unless is_module_dir?
8
+ $stderr.puts "Does not appear to be a Puppet module. Aborting"
9
+ return false
10
+ end
11
+
12
+ if module_name.nil?
13
+ module_name = get_module_name
14
+ if module_name.nil?
15
+ $stderr.puts "Unable to determine module name. Aborting"
16
+ return false
17
+ end
18
+ end
19
+
20
+ [
21
+ 'spec',
22
+ 'spec/classes',
23
+ 'spec/defines',
24
+ 'spec/functions',
25
+ 'spec/unit', 'spec/unit/facter', 'spec/unit/puppet', 'spec/unit/puppet/type', 'spec/unit/puppet/provider',
26
+ 'spec/hosts',
27
+ ].each { |dir| safe_mkdir(dir) }
28
+
29
+
30
+ safe_create_spec_helper
31
+ safe_create_fixtures_file
32
+ safe_create_resource_spec_files
33
+ safe_make_shared_context
34
+ end
35
+
36
+ def self.get_module_name
37
+ module_name = nil
38
+ Dir["manifests/*.pp"].entries.each do |manifest|
39
+ module_name = get_module_name_from_file(manifest)
40
+ break unless module_name.nil?
41
+ end
42
+ module_name
43
+ end
44
+
45
+ def self.get_module_name_from_file(file)
46
+ p = Puppet::Parser::Lexer.new
47
+ module_name = nil
48
+ p.string = File.read(file)
49
+ tokens = p.fullscan
50
+
51
+ i = tokens.index { |token| [:CLASS, :DEFINE].include? token.first }
52
+ unless i.nil?
53
+ module_name = tokens[i + 1].last[:value].split('::').first
54
+ end
55
+
56
+ module_name
57
+ end
58
+
59
+ def self.is_module_dir?
60
+ Dir["*"].entries.include? "manifests"
61
+ end
62
+
63
+ def self.safe_mkdir(dir)
64
+ if File.exists? dir
65
+ unless File.directory? dir
66
+ $stderr.puts "!! #{dir} already exists and is not a directory"
67
+ end
68
+ else
69
+ FileUtils.mkdir_p dir
70
+ puts " + #{dir}/"
71
+ end
72
+ end
73
+
74
+ # creates the user supplied or default template directory
75
+ # returns: user_template_dir
76
+ def self.create_user_template_dir(user_template_directory=nil)
77
+ if user_template_directory.nil?
78
+ user_template_directory = default_user_template_dir
79
+ end
80
+ # create default user template path or supplied user template path
81
+ if not File.exists?(user_template_directory)
82
+ FileUtils.mkdir_p(File.expand_path(user_template_directory))
83
+ end
84
+ user_template_directory
85
+ end
86
+
87
+ # creates and/or copies all templates in the gem to the user templates path
88
+ # returns: user_template_dir
89
+ def self.sync_user_template_dir(user_template_directory)
90
+ Dir.glob(File.join(gem_template_dir, "*.erb")).each do |src|
91
+ filename = File.basename(src)
92
+ dest = File.expand_path(File.join(user_template_directory, filename))
93
+ safe_copy_file(src, dest)
94
+ end
95
+ user_template_directory
96
+ end
97
+
98
+ # creates and syncs the specifed user template diretory
99
+ # returns: user_template_dir
100
+ def self.setup_user_template_dir(user_template_directory=nil)
101
+ if user_template_directory.nil?
102
+ user_template_directory = default_user_template_dir
103
+ end
104
+ sync_user_template_dir(create_user_template_dir(user_template_directory))
105
+ end
106
+
107
+ def self.default_user_template_dir
108
+ File.expand_path(File.join(ENV['HOME'], '.puppet_retrospec_templates' ))
109
+ end
110
+
111
+ def self.gem_template_dir
112
+ File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
113
+ end
114
+
115
+ def self.safe_copy_file(src, dest)
116
+ if File.exists?(dest)
117
+ $stderr.puts "!! #{dest} already exists"
118
+ else
119
+ if not File.exists?(src)
120
+ safe_touch(src)
121
+ else
122
+ FileUtils.cp(src,dest)
123
+ end
124
+ puts " + #{dest}"
125
+ end
126
+ end
127
+
128
+ def self.safe_touch(file)
129
+ if File.exists? file
130
+ unless File.file? file
131
+ $stderr.puts "!! #{file} already exists and is not a regular file"
132
+ end
133
+ else
134
+ FileUtils.touch file
135
+ puts " + #{file}"
136
+ end
137
+ end
138
+
139
+ def self.safe_create_file(filename, content)
140
+ if File.exists? filename
141
+ old_content = File.read(filename)
142
+ if old_content != content
143
+ $stderr.puts "!! #{filename} already exists and differs from template"
144
+ end
145
+ else
146
+ File.open(filename, 'w') do |f|
147
+ f.puts content
148
+ end
149
+ puts " + #{filename}"
150
+ end
151
+ end
152
+ end
@@ -0,0 +1,233 @@
1
+ require 'erb'
2
+ require 'puppet'
3
+ require 'helpers'
4
+ require 'fileutils'
5
+
6
+ class Retrospec
7
+ attr_reader :included_declarations
8
+ attr_reader :classes_and_defines
9
+ attr_reader :module_name
10
+ attr_reader :modules_included
11
+ attr_accessor :default_path
12
+ attr_accessor :manifest_files
13
+ attr_accessor :default_modules
14
+ attr_accessor :template_dir
15
+
16
+
17
+ def initialize(path=nil, default_template_dir=ENV['RETROSPEC_TEMPLATES_PATH'])
18
+ # user supplied a template path or user wants to use local templates
19
+ if not default_template_dir.nil? or ENV['RETROSPEC_ENABLE_LOCAL_TEMPLATES'] =~ /true/i
20
+ default_template_dir = Helpers.setup_user_template_dir(default_template_dir)
21
+ end
22
+ @default_path = path
23
+ @default_modules = ['stdlib']
24
+ @template_dir = default_template_dir
25
+ module_name
26
+ modules_included
27
+ end
28
+
29
+ def create_files
30
+ safe_create_spec_helper
31
+ safe_create_fixtures_file
32
+ safe_create_gemfile
33
+ manifest_files.each do |file|
34
+ safe_create_resource_spec_files(file)
35
+ end
36
+ safe_make_shared_context
37
+ end
38
+
39
+ # pass in either the path to the module directory
40
+ # or the path to a specific manifest
41
+ # defaults to all manifests in the current directory
42
+ # if ENV['RETROSPEC_ENABLE_LOCAL_TEMPLATES'] = 'true' the use the default user templates path
43
+ # if ENV["RETROSPEC_TEMPLATES_PATH"] is set then we will override the default user template path
44
+ # with the path provided
45
+ # we will use the necessary templates from that directory instead of the default gem path
46
+ def self.run(path=nil, template_dir=ENV['RETROSPEC_TEMPLATES_PATH'])
47
+ spec = Retrospec.new(path, template_dir)
48
+ spec.create_files
49
+ end
50
+
51
+ def safe_create_gemfile(template='gemfile.erb')
52
+ safe_create_template_file('Gemfile', template)
53
+ end
54
+
55
+ # if user doesn't supply template directory we assume we should use the templates in this gem
56
+ def template_dir
57
+ @template_dir ||= Helpers.gem_template_dir
58
+ end
59
+
60
+ def modules_included
61
+ @modules_included ||= default_modules + referenced_modules
62
+ end
63
+
64
+ def referenced_modules
65
+ []
66
+ end
67
+
68
+ def module_name
69
+ @module_name ||= Helpers.get_module_name
70
+ end
71
+
72
+ def manifest_files
73
+ if @manifest_files.nil?
74
+ # first check to see if manifests directory even exists when path is nil
75
+ if default_path.nil?
76
+ raise 'No manifest directory' if ! File.exist?('manifests')
77
+ @default_path = 'manifests/**/*.pp'
78
+ # check to see if at least one of the files given is a pp file
79
+ # remove any non pp files
80
+ elsif default_path.instance_of?(Array)
81
+ data = default_path.find_all { |file| File.extname(file) == '.pp' }
82
+ if data.length < 1
83
+ raise "No valid puppet manifests given"
84
+ end
85
+ @default_path = data
86
+ # this should be a module directory which would have a manifests directory
87
+ elsif Dir.exist?(File.expand_path(default_path))
88
+ raise 'No manifest directory' if ! File.exist?(File.expand_path(File.join(default_path, 'manifests')))
89
+ @default_path = File.join(default_path, 'manifests/**/*.pp')
90
+ else
91
+ path = File.expand_path(default_path)
92
+ raise "File does not exist at path #{path}" if ! File.exist?(path)
93
+ raise 'Not a puppet manifest file' if File.extname(path) != '.pp'
94
+ end
95
+ @manifest_files = Dir.glob(default_path)
96
+
97
+ end
98
+ @manifest_files
99
+ end
100
+
101
+ def classes_and_defines(file)
102
+ @classes_and_defines = []
103
+ # for each file we are going to use the puppet lexer to find the class or define
104
+ resources = []
105
+ p = Puppet::Parser::Lexer.new
106
+ p.string = File.read(file)
107
+ tokens = p.fullscan
108
+ tokens.each do | token|
109
+ if [:CLASS, :DEFINE].include? token.first
110
+ k = tokens.index { |token| [:NAME].include? token.first }
111
+ # there is some sort of ordering bug here with ruby 1.8.7 and I have to modify the code like below
112
+ # to get it working. I think its this index method above
113
+ # TODO make this work with ruby versions 1.8.7 and above
114
+ #resources.push({:type_name => tokens[k-1].last[:value], :name => token.last[:value] })
115
+ resources.push({:type_name => token.last[:value] , :name => tokens[k].last[:value] })
116
+ end
117
+ end
118
+ # sometimes the manifest can be blank and not include a class or define statement
119
+ if resources.length > 0
120
+ @classes_and_defines.push({:filename => File.basename(file, '.pp'), :types => resources })
121
+ end
122
+ @classes_and_defines
123
+ end
124
+
125
+ # finds all the included resources so we can test and depend on in the fixtures file
126
+ def included_declarations(file)
127
+ @included_declarations = {}
128
+ includes = []
129
+ p = Puppet::Parser::Lexer.new
130
+ p.string = File.read(file)
131
+ tokens = p.fullscan
132
+ k = 0
133
+ typename = nil
134
+ tokens.each do | token|
135
+ next if not token.last.is_a?(Hash)
136
+ if typename.nil? and [:CLASS, :DEFINE].include? token.first
137
+ j = tokens.index { |token| [:NAME].include? token.first }
138
+ typename = tokens[j].last[:value]
139
+ end
140
+ if token.last.fetch(:value, nil) == 'include'
141
+ key = token.last[:value]
142
+ value = tokens[k + 1].last[:value]
143
+ includes << value
144
+ end
145
+ k = k + 1
146
+ end
147
+ @included_declarations[typename] = includes
148
+ @included_declarations
149
+ end
150
+
151
+
152
+ def safe_make_shared_context(template='shared_context.erb')
153
+ safe_create_template_file('spec/shared_contexts.rb', template)
154
+ end
155
+
156
+ # Gets all the classes and define types from all the files in the manifests directory
157
+ # Creates an associated spec file for each type and even creates the subfolders for nested classes one::two::three
158
+ def safe_create_resource_spec_files(manifest_file,template='resource_spec_file.erb')
159
+ classes_dir = 'spec/classes'
160
+ defines_dir = 'spec/defines'
161
+ classes_and_defines(manifest_file).each do |value|
162
+ types = value[:types]
163
+ types.each do |type|
164
+ # run template
165
+ tokens = type[:name].split('::')
166
+ if type[:type_name] == 'class'
167
+ type_dir_name = classes_dir
168
+ else
169
+ type_dir_name = defines_dir
170
+ end
171
+ file_name = tokens.pop # the last item should be the filename
172
+ # if there are only two tokens ie. tomcat::params we dont need to create a subdirectory
173
+ if tokens.count > 1
174
+ # this is a deep level resource ie. tomcat::config::server::connector
175
+ # however we don't need the tomcat directory so we can just remove it
176
+ # this should leave us with config/server/connector_spec.rb
177
+ tokens.delete_at(0)
178
+ # so lets make a directory structure out of it
179
+ dir_name = File.join(tokens) # config/server
180
+ dir_name = File.join(type_dir_name,dir_name) # spec/classes/tomcat/config/server
181
+ safe_create_template_file(File.join(dir_name,"#{file_name}_spec.rb"), template)
182
+ else
183
+ safe_create_template_file(File.join(type_dir_name,"#{file_name}_spec.rb"), template)
184
+ end
185
+ end
186
+ end
187
+ end
188
+
189
+ def safe_create_fixtures_file(template='fixtures_file.erb')
190
+ safe_create_template_file('.fixtures.yml', template)
191
+ end
192
+
193
+ def safe_create_spec_helper(template='spec_helper_file.erb')
194
+ safe_create_template_file('spec/spec_helper.rb', template)
195
+ end
196
+
197
+ def safe_create_template_file(path, template)
198
+ # check to ensure parent directory exists
199
+ file_dir_path = File.expand_path(File.join(module_dir,File.dirname(path)))
200
+ if ! File.exists?(file_dir_path)
201
+ Helpers.safe_mkdir(file_dir_path)
202
+ end
203
+ template_path = File.join(template_dir, template)
204
+ File.open(template_path) do |file|
205
+ renderer = ERB.new(file.read, 0, '-')
206
+ content = renderer.result binding
207
+ Helpers.safe_create_file(File.expand_path(File.join(module_dir,path)), content)
208
+ end
209
+
210
+ end
211
+
212
+ # calculates where the spec directory is by going one directory back from manifests directory
213
+ def module_dir
214
+ @spec_dir ||= File.join(File.dirname(manifest_dir))
215
+ end
216
+
217
+ def manifest_dir
218
+ # look and compare, then get basename, loop till found
219
+ if @manifest_dir.nil?
220
+ file = manifest_files.first
221
+ file.split(File::SEPARATOR).each do |part|
222
+ filename = File.basename(file)
223
+ if filename != 'manifests'
224
+ file = File.dirname(file)
225
+ else
226
+ @manifest_dir = file
227
+ end
228
+ end
229
+ end
230
+ @manifest_dir
231
+ end
232
+
233
+ end
@@ -0,0 +1,7 @@
1
+ fixtures:
2
+ symlinks:
3
+ <%= @module_name %>: "#{source_dir}"
4
+ repositories:
5
+ stdlib:
6
+ repo: https://github.com/puppetlabs/puppetlabs-stdlib.git
7
+ ref: 4.3.2
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ group :development, :test do
4
+ gem 'bodeco_module_helper', :git => 'https://github.com/bodeco/bodeco_module_helper.git'
5
+ gem 'rspec-puppet-utils', :git => 'https://github.com/Accuity/rspec-puppet-utils.git'
6
+ gem 'hiera-puppet-helper', :git => 'https://github.com/bobtfish/hiera-puppet-helper.git'
7
+ end
8
+
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+ require 'shared_contexts'
3
+
4
+ <% @classes_and_defines.each do | value | -%>
5
+ <% types = value[:types] -%>
6
+ <% types.each do |type| -%>
7
+ <% tname = type[:name] -%>
8
+ describe '<%= tname %>' do
9
+ include_context :hiera
10
+ <% if type[:type_name] == 'define' -%>
11
+ let(:title) { 'example_name' }
12
+ <% end -%>
13
+ let(:facts) do
14
+ {}
15
+ end
16
+ let(:params) do
17
+ {}
18
+ end
19
+ # add these two lines in a single test to enable puppet and hiera debug mode
20
+ # Puppet::Util::Log.level = :debug
21
+ # Puppet::Util::Log.newdestination(:console)
22
+ it { should compile }
23
+ <% end -%>
24
+ end
25
+ <% end -%>
@@ -0,0 +1,28 @@
1
+ require 'hiera-puppet-helper'
2
+
3
+ # optional, this should be the path to where the hirea data config file is in this repo
4
+ hiera_config_file = File.expand_path(File.join(File.dirname(__FILE__), '..','data', 'hiera.yaml'))
5
+
6
+ # hiera_file and hiera_data are mutally exclusive contexts.
7
+
8
+
9
+ shared_context :linux_hiera do
10
+ # example only,
11
+ let(:hiera_data) do
12
+ {:some_key => "some_value" }
13
+ end
14
+ end
15
+
16
+ # In case you want a more specific set of mocked hiera data for windows
17
+ shared_context :windows_hiera do
18
+ # example only,
19
+ let(:hiera_data) do
20
+ {:some_key => "some_value" }
21
+ end
22
+ end
23
+
24
+ shared_context :real_hiera_data do
25
+ let(:hiera_config) do
26
+ hirea_config_file
27
+ end
28
+ end
@@ -0,0 +1,9 @@
1
+ require 'puppetlabs_spec_helper/module_spec_helper'
2
+ require 'rspec-puppet-utils'
3
+
4
+ # Uncomment this to show coverage report, also useful for debugging
5
+ #at_exit { RSpec::Puppet::Coverage.report! }
6
+
7
+ RSpec.configure do |c|
8
+ c.formatter = 'documentation'
9
+ end
@@ -0,0 +1,89 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: puppet-retrospec 0.2.0 ruby lib
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "puppet-retrospec"
9
+ s.version = "0.2.0"
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Corey Osman"]
14
+ s.date = "2014-11-12"
15
+ s.description = "Retrofits and generates valid puppet rspec test code to existing modules"
16
+ s.email = "corey@logicminds.biz"
17
+ s.executables = ["retrospec"]
18
+ s.extra_rdoc_files = [
19
+ "LICENSE",
20
+ "README.md",
21
+ "README.rdoc"
22
+ ]
23
+ s.files = [
24
+ ".document",
25
+ ".rspec",
26
+ ".travis.yml",
27
+ "Gemfile",
28
+ "LICENSE",
29
+ "README.md",
30
+ "README.rdoc",
31
+ "Rakefile",
32
+ "VERSION",
33
+ "bin/retrospec",
34
+ "lib/helpers.rb",
35
+ "lib/puppet-retrospec.rb",
36
+ "lib/templates/fixtures_file.erb",
37
+ "lib/templates/gemfile.erb",
38
+ "lib/templates/resource_spec_file.erb",
39
+ "lib/templates/shared_context.erb",
40
+ "lib/templates/spec_helper_file.erb",
41
+ "puppet-retrospec.gemspec",
42
+ "spec/fixtures/manifests/includes-class.pp",
43
+ "spec/fixtures/manifests/includes-defines.pp",
44
+ "spec/fixtures/manifests/not_a_resource_defination.pp",
45
+ "spec/spec_helper.rb",
46
+ "spec/unit/puppet-retrospec_spec.rb"
47
+ ]
48
+ s.homepage = "http://github.com/logicminds/puppet-retrospec"
49
+ s.licenses = ["MIT"]
50
+ s.rubygems_version = "2.2.2"
51
+ 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."
52
+
53
+ if s.respond_to? :specification_version then
54
+ s.specification_version = 4
55
+
56
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
+ s.add_runtime_dependency(%q<puppet>, [">= 0"])
58
+ s.add_runtime_dependency(%q<trollop>, [">= 0"])
59
+ s.add_development_dependency(%q<rspec>, ["~> 2.14"])
60
+ s.add_development_dependency(%q<yard>, ["~> 0.7"])
61
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
62
+ s.add_development_dependency(%q<bundler>, ["~> 1.0"])
63
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
64
+ s.add_development_dependency(%q<pry>, [">= 0"])
65
+ s.add_development_dependency(%q<fakefs>, [">= 0"])
66
+ else
67
+ s.add_dependency(%q<puppet>, [">= 0"])
68
+ s.add_dependency(%q<trollop>, [">= 0"])
69
+ s.add_dependency(%q<rspec>, ["~> 2.14"])
70
+ s.add_dependency(%q<yard>, ["~> 0.7"])
71
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
72
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
73
+ s.add_dependency(%q<jeweler>, [">= 0"])
74
+ s.add_dependency(%q<pry>, [">= 0"])
75
+ s.add_dependency(%q<fakefs>, [">= 0"])
76
+ end
77
+ else
78
+ s.add_dependency(%q<puppet>, [">= 0"])
79
+ s.add_dependency(%q<trollop>, [">= 0"])
80
+ s.add_dependency(%q<rspec>, ["~> 2.14"])
81
+ s.add_dependency(%q<yard>, ["~> 0.7"])
82
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
83
+ s.add_dependency(%q<bundler>, ["~> 1.0"])
84
+ s.add_dependency(%q<jeweler>, [">= 0"])
85
+ s.add_dependency(%q<pry>, [">= 0"])
86
+ s.add_dependency(%q<fakefs>, [">= 0"])
87
+ end
88
+ end
89
+
@@ -0,0 +1,26 @@
1
+ class includes-class{
2
+
3
+ include class1
4
+ include class2
5
+ include class3
6
+
7
+
8
+ require class4
9
+ require class5
10
+
11
+ $var1 = 'true'
12
+
13
+ file{"dummytest":
14
+ ensure => directory
15
+
16
+ }
17
+
18
+ file{"dummytest":
19
+ ensure => directory
20
+ }
21
+
22
+ if $var1 == 'true'{
23
+ include class6
24
+ }
25
+
26
+ }
@@ -0,0 +1,26 @@
1
+ define webinstance{
2
+
3
+ include class1
4
+ include class2
5
+ include class3
6
+
7
+
8
+ require class4
9
+ require class5
10
+
11
+ $var1 = 'true'
12
+
13
+ file{"dummytest":
14
+ ensure => directory
15
+
16
+ }
17
+
18
+ file{"dummytest":
19
+ ensure => directory
20
+ }
21
+
22
+ if $var1 == 'true'{
23
+ include class6
24
+ }
25
+
26
+ }
@@ -0,0 +1 @@
1
+ include class1
@@ -0,0 +1,23 @@
1
+ require 'puppet-retrospec'
2
+ require 'rspec'
3
+ require 'puppet'
4
+
5
+ def fixture_modules_path
6
+ @fixture_module_path ||= File.expand_path(File.join(fixtures_path, 'modules'))
7
+ end
8
+
9
+ def fixtures_path
10
+ @fixtures_path ||= File.expand_path(File.join(File.dirname(__FILE__), 'fixtures'))
11
+ end
12
+
13
+ def install_module(module_name)
14
+ FileUtils.mkdir_p(fixture_modules_path)
15
+ puts "Downloading modules to fixtures directory"
16
+ `puppet module install -i #{fixture_modules_path} #{module_name}`
17
+ Dir.glob('spec/fixtures/modules/**/spec').each do |dir|
18
+ FileUtils.rm_rf(dir)
19
+ end
20
+ end
21
+
22
+
23
+
@@ -0,0 +1,161 @@
1
+ require 'spec_helper'
2
+ require 'puppet-retrospec'
3
+ require 'helpers'
4
+ require 'fakefs/safe'
5
+ require 'pry'
6
+
7
+ describe "puppet-retrospec" do
8
+ after :all do
9
+ #FileUtils.rm_rf(fixture_modules_path)
10
+ end
11
+
12
+ before :each do
13
+ @retro = Retrospec.new(Dir.glob('spec/fixtures/manifests/*.pp'))
14
+ ENV['RETROSPEC_ENABLE_LOCAL_TEMPLATES'] = nil
15
+ ENV['RETROSPEC_TEMPLATES_PATH'] = nil
16
+
17
+
18
+ end
19
+
20
+ it 'should run without errors' do
21
+ install_module('puppetlabs-tomcat')
22
+ tomcat = Retrospec.new('spec/fixtures/modules/tomcat')
23
+ tomcat.create_files
24
+ end
25
+
26
+ it 'should create a local templates directory when flag is on' do
27
+ ENV['RETROSPEC_ENABLE_LOCAL_TEMPLATES'] = 'true'
28
+ FakeFS do
29
+ user_directory = Helpers.default_user_template_dir
30
+ FileUtils.mkdir_p(Helpers.gem_template_dir)
31
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'fixtures_file.erb'))
32
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'resource_spec_file.erb'))
33
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'shared_context.erb'))
34
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'spec_helper_file.erb'))
35
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'gemfile.erb'))
36
+
37
+ FileUtils.mkdir_p('/modules/tomcat/manifests')
38
+ FileUtils.touch('/modules/tomcat/manifests/init.pp')
39
+ Retrospec.new('/modules/tomcat')
40
+ expect(File.exists?(user_directory)).to eq(true)
41
+ expect(File.exists?(File.join(user_directory, 'gemfile.erb'))).to eq(true)
42
+ expect(File.exists?(File.join(user_directory, 'fixtures_file.erb'))).to eq(true)
43
+ expect(File.exists?(File.join(user_directory, 'resource_spec_file.erb'))).to eq(true)
44
+ expect(File.exists?(File.join(user_directory, 'shared_context.erb'))).to eq(true)
45
+ expect(File.exists?(File.join(user_directory, 'spec_helper_file.erb'))).to eq(true)
46
+ end
47
+ ENV['RETROSPEC_ENABLE_LOCAL_TEMPLATES'] = nil
48
+ ENV['RETROSPEC_TEMPLATES_PATH'] = nil
49
+ end
50
+
51
+ it 'should create and use the user supplied templates directory when variable is set' do
52
+ ENV['RETROSPEC_TEMPLATES_PATH'] = '/tmp/my_templates'
53
+ FakeFS do
54
+ FileUtils.mkdir_p(Helpers.gem_template_dir)
55
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'fixtures_file.erb'))
56
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'resource_spec_file.erb'))
57
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'shared_context.erb'))
58
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'spec_helper_file.erb'))
59
+ FileUtils.touch(File.join(Helpers.gem_template_dir, 'gemfile.erb'))
60
+ FileUtils.mkdir_p('/modules/tomcat/manifests')
61
+ FileUtils.touch('/modules/tomcat/manifests/init.pp')
62
+ r = Retrospec.new('/modules/tomcat')
63
+ user_directory = r.template_dir
64
+ expect(user_directory).to eq('/tmp/my_templates')
65
+ r.create_files
66
+ expect(File.exists?(user_directory)).to eq(true)
67
+ expect(File.exists?(File.join(user_directory, 'fixtures_file.erb'))).to eq(true)
68
+ expect(File.exists?(File.join(user_directory, 'gemfile.erb'))).to eq(true)
69
+ expect(File.exists?(File.join(user_directory, 'resource_spec_file.erb'))).to eq(true)
70
+ expect(File.exists?(File.join(user_directory, 'shared_context.erb'))).to eq(true)
71
+ expect(File.exists?(File.join(user_directory, 'spec_helper_file.erb'))).to eq(true)
72
+ end
73
+ ENV['RETROSPEC_ENABLE_LOCAL_TEMPLATES'] = nil
74
+ ENV['RETROSPEC_TEMPLATES_PATH'] = nil
75
+ end
76
+
77
+ it 'manifest path is calculated correctly' do
78
+ @retro.manifest_dir.should eq('spec/fixtures/manifests')
79
+ end
80
+
81
+ it 'should return a list of files' do
82
+ @retro.manifest_files.length.should == 3
83
+ end
84
+
85
+ it 'should retrieve a list of includes' do
86
+ # ie. {"includes-class"=>["class1", "class2", "class3", "class6"]}
87
+ includes = @retro.included_declarations('spec/fixtures/manifests/includes-class.pp')
88
+ includes['includes-class'].should eq(["class1", "class2", "class3", "class6"])
89
+ end
90
+
91
+ it 'should not include the require statements' do
92
+ # ie. {"includes-class"=>["class1", "class2", "class3", "class6"]}
93
+ includes = @retro.included_declarations('spec/fixtures/manifests/includes-class.pp')
94
+ includes['includes-class'].should_not eq(["class1", "class2", "class3", "class4", "class5", "class6"])
95
+ end
96
+
97
+ it 'should retrieve a list of class names' do
98
+ # ie. [{:filename=>"includes-class", :types=>[{:type_name=>"class", :name=>"includes-class"}]}]
99
+ classes = @retro.classes_and_defines('spec/fixtures/manifests/includes-class.pp')
100
+ types = classes.first[:types]
101
+ types.first[:type_name].should eq('class')
102
+ types.first[:name].should eq("includes-class")
103
+ end
104
+
105
+ it 'should retrieve 0 defines or classes' do
106
+ my_retro = Retrospec.new('spec/fixtures/manifests/not_a_resource_defination.pp')
107
+ classes = my_retro.classes_and_defines('spec/fixtures/manifests/not_a_resource_defination.pp')
108
+ classes.count.should == 0
109
+ end
110
+
111
+ it 'should not create any files when 0 resources exists' do
112
+ my_retro = Retrospec.new('spec/fixtures/manifests/not_a_resource_defination.pp')
113
+ my_retro.safe_create_resource_spec_files(my_retro.manifest_files.first)
114
+ end
115
+
116
+ it 'should retrieve a list of define names' do
117
+ # ie. [{:filename=>"includes-class", :types=>[{:type_name=>"class", :name=>"includes-class"}]}]
118
+ my_retro = Retrospec.new('spec/fixtures/manifests/includes-defines.pp')
119
+ classes = my_retro.classes_and_defines('spec/fixtures/manifests/includes-defines.pp')
120
+ types = classes.first[:types]
121
+ types.first[:type_name].should eq('define')
122
+ types.first[:name].should eq("webinstance")
123
+ end
124
+
125
+ it 'should create proper spec helper file' do
126
+ filepath = File.expand_path(File.join(fixtures_path, 'spec/spec_helper.rb'))
127
+ Helpers.should_receive(:safe_create_file).with(filepath,anything).once
128
+ @retro.safe_create_spec_helper('spec_helper_file.erb')
129
+
130
+ end
131
+
132
+ it 'should return the correct module name' do
133
+ Helpers.should_receive(:get_module_name).and_return('mymodule')
134
+ @retro.module_name.should eq('mymodule')
135
+ end
136
+
137
+ it 'should create proper fixtures file' do
138
+ filepath = File.expand_path(File.join(fixtures_path, '.fixtures.yml'))
139
+ Helpers.should_receive(:safe_create_file).with(filepath,anything).once
140
+ @retro.safe_create_fixtures_file('fixtures_file.erb')
141
+
142
+ end
143
+
144
+ it 'included_declarations should not be nil' do
145
+ @retro.included_declarations(@retro.manifest_files.first).length.should >= 1
146
+ end
147
+
148
+ it 'classes_and_defines should not be nil' do
149
+ @retro.classes_and_defines(@retro.manifest_files.first).length.should >= 1
150
+ end
151
+
152
+ it 'module_name should not be nil' do
153
+ Helpers.should_receive(:get_module_name).and_return('mymodule')
154
+ @retro.module_name.should_not be_nil
155
+ end
156
+
157
+ it 'modules_included should not be nil' do
158
+ @retro.modules_included.length.should eq(1)
159
+ end
160
+
161
+ end
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: puppet-retrospec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Corey Osman
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: puppet
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: trollop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: yard
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '0.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '3.12'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '3.12'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jeweler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: fakefs
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: Retrofits and generates valid puppet rspec test code to existing modules
140
+ email: corey@logicminds.biz
141
+ executables:
142
+ - retrospec
143
+ extensions: []
144
+ extra_rdoc_files:
145
+ - LICENSE
146
+ - README.md
147
+ - README.rdoc
148
+ files:
149
+ - .document
150
+ - .rspec
151
+ - .travis.yml
152
+ - Gemfile
153
+ - LICENSE
154
+ - README.md
155
+ - README.rdoc
156
+ - Rakefile
157
+ - VERSION
158
+ - bin/retrospec
159
+ - lib/helpers.rb
160
+ - lib/puppet-retrospec.rb
161
+ - lib/templates/fixtures_file.erb
162
+ - lib/templates/gemfile.erb
163
+ - lib/templates/resource_spec_file.erb
164
+ - lib/templates/shared_context.erb
165
+ - lib/templates/spec_helper_file.erb
166
+ - puppet-retrospec.gemspec
167
+ - spec/fixtures/manifests/includes-class.pp
168
+ - spec/fixtures/manifests/includes-defines.pp
169
+ - spec/fixtures/manifests/not_a_resource_defination.pp
170
+ - spec/spec_helper.rb
171
+ - spec/unit/puppet-retrospec_spec.rb
172
+ homepage: http://github.com/logicminds/puppet-retrospec
173
+ licenses:
174
+ - MIT
175
+ metadata: {}
176
+ post_install_message:
177
+ rdoc_options: []
178
+ require_paths:
179
+ - lib
180
+ required_ruby_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ requirements: []
191
+ rubyforge_project:
192
+ rubygems_version: 2.2.2
193
+ signing_key:
194
+ specification_version: 4
195
+ summary: Generates puppet rspec test code based on the classes and defines inside
196
+ the manifests directory. Aims to reduce some of the boilerplate coding with default
197
+ test patterns.
198
+ test_files: []