puppet-retrospec 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ee18423b45926dd5af55e9ae5ab06ad259d391a
4
- data.tar.gz: 8fdb6a385bebe775d225e7a7481babb93285a5ac
3
+ metadata.gz: 3461b3345064309ba4d62c62b0393ed4f4223ba6
4
+ data.tar.gz: 57deba94c2c1d0e62c85263bbedf9771f4b5f213
5
5
  SHA512:
6
- metadata.gz: d726ea817412307e481be8394b37d7c4904b010a37068ba824337a9715b67679c8da15f3805d8abdb88386328e664d4563c9c577272a5f946dc0eca8f5dfab85
7
- data.tar.gz: 695e39765fa941e955d36acda5cb4882a0aa7c61b228bdc3c740e92a4876f1326cc7357bfe22b5b141df142eddd2bcf98712cd2737656f578f53e2a32029529f
6
+ metadata.gz: 81efc82dbb22d30e873dbb1e9a1ddf4fc10b065f31174cfce7a4959876019a0e6e183ce2eed64e2e54264e82834bea2e85c695075195ce1f83326ed3cc73694d
7
+ data.tar.gz: c1e46dea03222cfd8a7ee237bbde5e54937dc6223cfcacaeeb3b2b863b4fa4e9e023634de458ad91125ae55dbd43b6d07aaf615dd3b62c9e660b036f4f96c068
data/README.md CHANGED
@@ -15,9 +15,11 @@ Table of Contents
15
15
  =================
16
16
 
17
17
  * [Build Status](#build-status)
18
+ * [News](#news)
18
19
  * [Dependency](#dependency)
19
20
  * [Install](#install)
20
21
  * [How to use](#how-to-use)
22
+ * [Config file](#config_file)
21
23
  * [Example](#example)
22
24
  * [About the test suite](#about-the-test-suite)
23
25
  * [How Does it do this](#how-does-it-do-this)
@@ -38,6 +40,34 @@ Build Status
38
40
  [![Build Status](https://travis-ci.org/logicminds/puppet-retrospec.png)](https://travis-ci.org/logicminds/puppet-retrospec)
39
41
  [![Gem Version](https://badge.fury.io/rb/puppet-retrospec.svg)](http://badge.fury.io/rb/puppet-retrospec)
40
42
 
43
+ ## News
44
+ This gem has been converted to a retrospec plugin. This means that this gem no longer contains a binary and instead
45
+ depends on the retrospec framework. The new way of using this gem is : `retrospec puppet`
46
+
47
+ Because I found this gem to be so useful I figured I could make it automate other types of projects and generalized its
48
+ use case. So now any project you create can have its development workflow automated with retrospec.
49
+
50
+ More info: https://github.com/nwops/retrospec.git
51
+
52
+ As a result you may have a conflict with the retrospec binary when installing this plugin, please allow the new retrospec
53
+ binary to replace the old one.
54
+
55
+ ```shell
56
+ [puppet@puppetdev module]$ gem install puppet-retrospec
57
+ Fetching: retrospec-0.3.0.gem (100%)
58
+ retrospec's executable "retrospec" conflicts with puppet-retrospec
59
+ Overwrite the executable? [yN] y
60
+ Successfully installed retrospec-0.3.0
61
+ Fetching: puppet-retrospec-0.9.0.gem (100%)
62
+ Successfully installed puppet-retrospec-0.9.0
63
+ Parsing documentation for retrospec-0.3.0
64
+ Installing ri documentation for retrospec-0.3.0
65
+ Parsing documentation for puppet-retrospec-0.9.0
66
+ Installing ri documentation for puppet-retrospec-0.9.0
67
+ 2 gems installed
68
+
69
+ ```
70
+
41
71
  Dependency
42
72
  ============
43
73
  Retrospec relies heavily on the puppet 3.7.x codebase. Because of this hard dependency the puppet gem is vendored into
@@ -47,28 +77,44 @@ Install
47
77
  =============
48
78
  `gem install puppet-retrospec`
49
79
 
80
+ This will also install the retrospec framework that is required to use the plugin.
50
81
 
51
82
  How to use
52
83
  =============
53
84
  Run from the command line
54
85
  ```
55
- $ retrospec -h
86
+ retrospec puppet -h
56
87
  Generates puppet rspec test code based on the classes and defines inside the manifests directory.
57
- -m, --module-path=<s> The path (relative or absolute) to the module directory (Defaults to current directory)
58
- -t, --template-dir=<s> Path to templates directory (only for overriding Retrospec templates) (default: /Users/user1/.retrospec_templates)
59
- -s, --scm-url=<s> SCM url for retrospec templates
60
- -b, --branch=<s> Branch you want to use for the retrospec template repo
61
- -e, --enable-beaker-tests Enable the creation of beaker tests
62
- -n, --enable-future-parser Enables the future parser only during validation
63
- -v, --version Print version and exit
64
- -h, --help Show this message
88
+ -t, --template-dir=<s> Path to templates directory (only for overriding Retrospec templates) (default: /home/puppet/.retrospec/repos/retrospec-puppet-templates)
89
+ -s, --scm-url=<s> SCM url for retrospec templates (default: https://github.com/nwops/retrospec-templates)
90
+ -b, --branch=<s> Branch you want to use for the retrospec template repo (default: master)
91
+ -e, --enable-beaker-tests Enable the creation of beaker tests
92
+ -n, --enable-future-parser Enables the future parser only during validation
93
+ -v, --version Print version and exit
94
+ -h, --help Show this message
95
+
65
96
 
66
97
 
67
- retrospec -m ~/projects/puppet_modules/apache
98
+ retrospec -m ~/projects/puppet_modules/apache puppet --enable-future-parser
99
+
68
100
  ```
69
101
 
102
+ ## Config file
103
+ Previously before release 0.9.0 there was no way to set a config file so you were stuck with always
104
+ having to pass in the same cli options. With the 0.9.0 release we now rely on the retrospec framework which
105
+ gives us access to config file options for free. Below is a list of options that you can set
106
+ in the config file. (/Users/username/.retrospec/config.yaml) `retrospec -h`
107
+
108
+ ```yaml
70
109
  plugins::puppet::templates::url: https://github.com/nwops/retrospec-templates
71
110
  plugins::puppet::templates::ref: master
111
+ plugins::puppet::enable_beaker_tests: true
112
+ plugins::puppet::enable_future_parser: true
113
+ plugins::puppet::template_dir: /Users/username/.retrospec/repos/retrospec-puppet-templates
114
+ ```
115
+
116
+ Note: your not require to set any of these as they can be specified on the cli and also default to
117
+ sane values.
72
118
 
73
119
  Example
74
120
  ======================
@@ -82,7 +128,7 @@ with retrospec.
82
128
  ```shell
83
129
  $ pwd
84
130
  /Users/cosman/github/puppetlabs-apache
85
- $ retrospec
131
+ $ retrospec puppet
86
132
  + /Users/cosman/github/puppetlabs-apache/Gemfile
87
133
  + /Users/cosman/github/puppetlabs-apache/Rakefile
88
134
  + /Users/cosman/github/puppetlabs-apache/spec/
@@ -340,7 +386,7 @@ versioned controlled in their own repo and update them before each retrospec use
340
386
  contributions to be spread to other team members quickly.
341
387
 
342
388
  ```shell
343
- -t, --template-dir=<s> Path to templates directory (only for overriding Retrospec templates) (default: /Users/user1/.retrospec_templates)
389
+ -t, --template-dir=<s> Path to templates directory (only for overriding Retrospec templates) (default: /Users/user1/.retrospec/repos/retrospec-puppet-templates)
344
390
  -s, --scm-url=<s> SCM url for retrospec templates
345
391
  -b, --branch=<s> Branch you want to use for the retrospec template repo
346
392
 
@@ -348,8 +394,8 @@ contributions to be spread to other team members quickly.
348
394
 
349
395
  ### Environment variables to set template defaults
350
396
 
351
- RETROSPEC_SCM_URL # set this to auto set your scm url to the templates
352
- RETROSPEC_SCM_BRANCH # set this to auto checkout a particular branch (only works upon initial checkout)
397
+ RETROSPEC_PUPPET_SCM_URL # set this to auto set your scm url to the templates
398
+ RETROSPEC_PUPPET_SCM_BRANCH # set this to auto checkout a particular branch (only works upon initial checkout)
353
399
 
354
400
  After running retrospec, retrospec will clone the templates from the default template url or from whatever you set to the templates path.
355
401
  If you have already created the erb file in the templates location, then retrospec will not overwrite the file as there will
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -124,26 +124,34 @@ Generates puppet rspec test code based on the classes and defines inside the man
124
124
  # filenames must named how they would appear in the normal module path. The directory
125
125
  # structure where the file is contained
126
126
  def safe_create_module_files
127
- templates = Find.find(File.join(template_dir,'module_files')).find_all {|f| !File.directory?(f)}.sort
127
+ templates = Find.find(File.join(template_dir,'module_files')).sort
128
128
  templates.each do |template|
129
129
  # need to remove the erb extension and rework the destination path
130
130
  if template =~ /nodesets|spec_helper_acceptance/ and !context.enable_beaker_tests?
131
131
  next
132
132
  else
133
- dest = template.gsub(File.join(template_dir,'module_files'), module_path).gsub('.erb', '')
133
+ dest = template.gsub(File.join(template_dir,'module_files'), module_path)
134
134
  if File.symlink?(template)
135
135
  safe_create_symlink(template, dest)
136
136
  elsif File.directory?(template)
137
137
  safe_mkdir(dest)
138
138
  else
139
- safe_create_template_file(dest, template, context)
139
+ # because some plugins contain erb files themselves any erb file will be copied only
140
+ # so we need to designate which files should be rendered with .retrospec.erb
141
+ if template =~ /\.retrospec\.erb/
142
+ # render any file ending in .retrospec_erb as a template
143
+ dest = dest.gsub(/\.retrospec\.erb/, '')
144
+ safe_create_template_file(dest, template, context)
145
+ else
146
+ safe_copy_file(template, dest)
147
+ end
140
148
  end
141
149
  end
142
150
  end
143
151
  end
144
152
 
145
153
  # Creates an associated spec file for each type and even creates the subfolders for nested classes one::two::three
146
- def safe_create_resource_spec_files(type,template=File.join(template_dir,'resource_spec_file.erb'))
154
+ def safe_create_resource_spec_files(type,template=File.join(template_dir,'resource_spec_file.retrospec.erb'))
147
155
  context.parameters = type.arguments
148
156
  context.type = type
149
157
  VariableStore.populate(type)
@@ -156,7 +164,7 @@ Generates puppet rspec test code based on the classes and defines inside the man
156
164
  dest
157
165
  end
158
166
 
159
- def safe_create_acceptance_tests(type,template=File.join(template_dir,'acceptance_spec_test.erb'))
167
+ def safe_create_acceptance_tests(type,template=File.join(template_dir,'acceptance_spec_test.retrospec.erb'))
160
168
  @parameters = type.arguments
161
169
  @type = type
162
170
  dest = File.join(module_path,generate_file_path(type, true))
@@ -1,5 +1,5 @@
1
1
  module Retrospec
2
2
  module Puppet
3
- VERSION = '0.9.0'
3
+ VERSION = '0.9.1'
4
4
  end
5
5
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "puppet-retrospec"
8
- s.version = "0.9.0"
8
+ s.version = "0.9.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Corey Osman"]
12
- s.date = "2015-09-27"
12
+ s.date = "2015-09-28"
13
13
  s.description = "Retrofits and generates valid puppet rspec test code to existing modules"
14
14
  s.email = "corey@logicminds.biz"
15
15
  s.extra_rdoc_files = [
@@ -64,7 +64,7 @@ describe "puppet-retrospec" do
64
64
  spec_path = File.expand_path(File.join(@path, 'spec'))
65
65
  tomcat.create_files
66
66
  expect(File.exists?(File.join(spec_path, 'spec_helper_acceptance.rb'))).to eq(false)
67
- expect(File.exists?(File.join(spec_path, 'acceptance'))).to eq(false)
67
+ expect(File.exists?(File.join(spec_path, 'acceptance'))).to eq(true)
68
68
  expect(File.exists?(File.join(spec_path, 'acceptance', 'classes', 'tomcat_spec.rb'))).to eq(false)
69
69
  expect(File.exists?(File.join(spec_path, 'acceptance', 'nodesets'))).to eq(false)
70
70
  expect(File.exists?(File.join(spec_path, 'acceptance', 'nodesets', 'default.yml'))).to eq(false)
@@ -162,13 +162,12 @@ describe "puppet-retrospec" do
162
162
  it 'should create a file from a template' do
163
163
  tomcat = Retrospec::Plugins::V1::Puppet.new(@opts[:module_path], @opts)
164
164
  file_path = File.join(@path,'.fixtures.yml')
165
- template_file = File.join(tomcat.template_dir,'module_files','.fixtures.yml')
165
+ template_file = File.join(tomcat.template_dir,'module_files','.fixtures.yml.retrospec.erb')
166
166
  tomcat.safe_create_template_file(file_path, template_file, tomcat.context)
167
167
  expect(File.exists?(file_path)).to eq(true)
168
168
  end
169
169
 
170
170
  describe 'generate_file_path' do
171
-
172
171
  describe 'classes' do
173
172
  it 'should generate a acceptance test path correctly' do
174
173
  type = double("type")
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.9.0
4
+ version: 0.9.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: 2015-09-27 00:00:00.000000000 Z
11
+ date: 2015-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop