chef-gen-flavor-example 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Manifest.txt +3 -29
  3. data/README.md +1 -1
  4. data/chef-gen-flavor-example.gemspec +10 -7
  5. data/code_generator_2/metadata.rb +2 -0
  6. data/code_generator_2/recipes/cookbook.rb +2 -0
  7. data/lib/chef_gen/flavor/example.rb +4 -1
  8. data/lib/chef_gen/flavor/example2.rb +45 -0
  9. metadata +21 -33
  10. data/.rspec +0 -2
  11. data/.rubocop.yml +0 -13
  12. data/.travis.yml +0 -6
  13. data/Gemfile +0 -3
  14. data/Guardfile +0 -15
  15. data/Rakefile +0 -96
  16. data/code_generator/files/default/files_default_example_conf +0 -34
  17. data/code_generator/files/default/templates_default_example_conf_erb +0 -22
  18. data/code_generator/libraries/kitchen_helper.rb +0 -13
  19. data/code_generator/templates/default/Berksfile.erb +0 -3
  20. data/code_generator/templates/default/CHANGELOG_md.erb +0 -5
  21. data/code_generator/templates/default/Gemfile.erb +0 -25
  22. data/code_generator/templates/default/Guardfile.erb +0 -41
  23. data/code_generator/templates/default/README_md.erb +0 -92
  24. data/code_generator/templates/default/Rakefile.erb +0 -52
  25. data/code_generator/templates/default/_kitchen_yml.erb +0 -30
  26. data/code_generator/templates/default/_rspec.erb +0 -2
  27. data/code_generator/templates/default/_rubocop_yml.erb +0 -17
  28. data/code_generator/templates/default/attributes_default_rb.erb +0 -8
  29. data/code_generator/templates/default/metadata_rb.erb +0 -10
  30. data/code_generator/templates/default/recipes_default_rb.erb +0 -9
  31. data/code_generator/templates/default/spec_recipes_default_spec_rb.erb +0 -7
  32. data/code_generator/templates/default/spec_spec_helper_rb.erb +0 -94
  33. data/code_generator/templates/default/test_integration_default_serverspec_recipes_default_spec_rb.erb +0 -16
  34. data/code_generator/templates/default/test_integration_default_serverspec_spec_helper_rb.erb +0 -7
  35. data/features/generate.feature +0 -84
  36. data/features/support/env.rb +0 -15
  37. data/spec/lib/chef_gen/flavor/example_spec.rb +0 -86
  38. data/spec/spec_helper.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44c692b412483550b161942dbb8c04c6164686a2
4
- data.tar.gz: 24877e78f512f8facbbbb006f3b7135be8ad3d4d
3
+ metadata.gz: 6b3d59969317a570e5d2dd34c1f39ab51b4100dd
4
+ data.tar.gz: eb064eaf7354a81925a26637e0f1882ddcf1040f
5
5
  SHA512:
6
- metadata.gz: 2f3c3475edafc1f9b05358a0334f20b3b5bde26b0816d669bc38d6fa0f0fd4794889099b95364fee0b277ba6c500f3da41ceebd6cd7f46e607a7927c030e52d7
7
- data.tar.gz: 79ed71aabf270e779881bd0f3b88e9771a5dd2cc6f2cbe339f0c4f87265b135b4a08539df3636135fa32ff66af3ebd022c56fa22ccac47a731b4642753d3a0c2
6
+ metadata.gz: f9a4f04fd32bf95bcb28b037a019a0521d7f9e5e9bd608f40edae4fcffff71603239bb6c3269bc0e7e3566dd69354c18cfc8084bdce19f14d37fbb5cb8dd965b
7
+ data.tar.gz: 0eca167dd2d0ca1067e7f0180468cb61b4d0fa22dd9564ad243d69db0119e47416360bb6e9967e933e40b716be1ef25fa0037e9695e098777f498fb1bf884fac
@@ -1,37 +1,11 @@
1
- .rspec
2
- .rubocop.yml
3
- .travis.yml
4
- Gemfile
5
- Guardfile
6
1
  History.md
7
2
  LICENSE
8
3
  Manifest.txt
9
4
  README.md
10
- Rakefile
11
5
  chef-gen-flavor-example.gemspec
12
- code_generator/files/default/files_default_example_conf
13
- code_generator/files/default/templates_default_example_conf_erb
14
- code_generator/libraries/kitchen_helper.rb
15
6
  code_generator/metadata.rb
16
7
  code_generator/recipes/cookbook.rb
17
- code_generator/templates/default/Berksfile.erb
18
- code_generator/templates/default/CHANGELOG_md.erb
19
- code_generator/templates/default/Gemfile.erb
20
- code_generator/templates/default/Guardfile.erb
21
- code_generator/templates/default/README_md.erb
22
- code_generator/templates/default/Rakefile.erb
23
- code_generator/templates/default/_kitchen_yml.erb
24
- code_generator/templates/default/_rspec.erb
25
- code_generator/templates/default/_rubocop_yml.erb
26
- code_generator/templates/default/attributes_default_rb.erb
27
- code_generator/templates/default/metadata_rb.erb
28
- code_generator/templates/default/recipes_default_rb.erb
29
- code_generator/templates/default/spec_recipes_default_spec_rb.erb
30
- code_generator/templates/default/spec_spec_helper_rb.erb
31
- code_generator/templates/default/test_integration_default_serverspec_recipes_default_spec_rb.erb
32
- code_generator/templates/default/test_integration_default_serverspec_spec_helper_rb.erb
33
- features/generate.feature
34
- features/support/env.rb
8
+ code_generator_2/metadata.rb
9
+ code_generator_2/recipes/cookbook.rb
35
10
  lib/chef_gen/flavor/example.rb
36
- spec/lib/chef_gen/flavor/example_spec.rb
37
- spec/spec_helper.rb
11
+ lib/chef_gen/flavor/example2.rb
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  * home :: https://github.com/Nordstrom/chef-gen-flavor-example
4
4
  * license :: [Apache2](http://www.apache.org/licenses/LICENSE-2.0)
5
5
  * gem version :: [![Gem Version](https://badge.fury.io/rb/chef-gen-flavor-example.png)](http://badge.fury.io/rb/chef-gen-flavor-example)
6
- * build status :: [![Build Status](https://travis-ci.org/Nordstrom/chef-gen-flavor-example.png?branch=master)](https://travis-ci.org/Nordstrom/chef-gen-flavor-example)
6
+ * build status :: [![Circle CI](https://circleci.com/gh/Nordstrom/chef-gen-flavor-example.svg?style=svg)](https://circleci.com/gh/Nordstrom/chef-gen-flavor-example)
7
7
  * code climate :: [![Code Climate](https://codeclimate.com/github/Nordstrom/chef-gen-flavor-example/badges/gpa.svg)](https://codeclimate.com/github/Nordstrom/chef-gen-flavor-example)
8
8
  * docs :: [![Inline docs](http://inch-ci.org/github/nordstrom/chef-gen-flavor-example.svg?branch=master)](http://inch-ci.org/github/nordstrom/chef-gen-flavor-example)
9
9
 
@@ -1,18 +1,18 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: chef-gen-flavor-example 0.4.0.20150518102235 ruby lib
2
+ # stub: chef-gen-flavor-example 0.5.0.20150609142215 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "chef-gen-flavor-example"
6
- s.version = "0.4.0.20150518102235"
6
+ s.version = "0.5.0.20150609142215"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["James FitzGibbon"]
11
- s.date = "2015-05-18"
11
+ s.date = "2015-06-09"
12
12
  s.description = "An example plugin for [chef-gen-flavors](https://rubygems.org/gems/chef-gen-flavors).\n\nThis plugin makes use of most of the snippets available, and is meant as a\nreference implementation than for actual use. It demonstrates how to create\na flavor with tests and serves as a good example of how to get\nstarted writing your own flavors for distribution."
13
13
  s.email = ["james.i.fitzgibbon@nordstrom.com"]
14
14
  s.extra_rdoc_files = ["History.md", "Manifest.txt", "README.md"]
15
- s.files = [".rspec", ".rubocop.yml", ".travis.yml", "Gemfile", "Guardfile", "History.md", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "chef-gen-flavor-example.gemspec", "code_generator/files/default/files_default_example_conf", "code_generator/files/default/templates_default_example_conf_erb", "code_generator/libraries/kitchen_helper.rb", "code_generator/metadata.rb", "code_generator/recipes/cookbook.rb", "code_generator/templates/default/Berksfile.erb", "code_generator/templates/default/CHANGELOG_md.erb", "code_generator/templates/default/Gemfile.erb", "code_generator/templates/default/Guardfile.erb", "code_generator/templates/default/README_md.erb", "code_generator/templates/default/Rakefile.erb", "code_generator/templates/default/_kitchen_yml.erb", "code_generator/templates/default/_rspec.erb", "code_generator/templates/default/_rubocop_yml.erb", "code_generator/templates/default/attributes_default_rb.erb", "code_generator/templates/default/metadata_rb.erb", "code_generator/templates/default/recipes_default_rb.erb", "code_generator/templates/default/spec_recipes_default_spec_rb.erb", "code_generator/templates/default/spec_spec_helper_rb.erb", "code_generator/templates/default/test_integration_default_serverspec_recipes_default_spec_rb.erb", "code_generator/templates/default/test_integration_default_serverspec_spec_helper_rb.erb", "features/generate.feature", "features/support/env.rb", "lib/chef_gen/flavor/example.rb", "spec/lib/chef_gen/flavor/example_spec.rb", "spec/spec_helper.rb"]
15
+ s.files = ["History.md", "LICENSE", "Manifest.txt", "README.md", "chef-gen-flavor-example.gemspec", "code_generator/metadata.rb", "code_generator/recipes/cookbook.rb", "code_generator_2/metadata.rb", "code_generator_2/recipes/cookbook.rb", "lib/chef_gen/flavor/example.rb", "lib/chef_gen/flavor/example2.rb"]
16
16
  s.homepage = "https://github.com/Nordstrom/chef-gen-flavor-example"
17
17
  s.licenses = ["apache2"]
18
18
  s.rdoc_options = ["--main", "README.md"]
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.specification_version = 4
24
24
 
25
25
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<chef-gen-flavors>, ["~> 0.5"])
26
+ s.add_runtime_dependency(%q<chef-gen-flavors>, ["~> 0.7"])
27
27
  s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
28
28
  s.add_development_dependency(%q<chef-dk>, ["~> 0.5"])
29
29
  s.add_development_dependency(%q<hoe>, ["~> 3.13"])
@@ -38,8 +38,9 @@ Gem::Specification.new do |s|
38
38
  s.add_development_dependency(%q<simplecov-console>, ["~> 0.2"])
39
39
  s.add_development_dependency(%q<yard>, ["~> 0.8"])
40
40
  s.add_development_dependency(%q<aruba>, ["~> 0.6"])
41
+ s.add_development_dependency(%q<rspec_junit_formatter>, ["~> 0.2"])
41
42
  else
42
- s.add_dependency(%q<chef-gen-flavors>, ["~> 0.5"])
43
+ s.add_dependency(%q<chef-gen-flavors>, ["~> 0.7"])
43
44
  s.add_dependency(%q<rdoc>, ["~> 4.0"])
44
45
  s.add_dependency(%q<chef-dk>, ["~> 0.5"])
45
46
  s.add_dependency(%q<hoe>, ["~> 3.13"])
@@ -54,9 +55,10 @@ Gem::Specification.new do |s|
54
55
  s.add_dependency(%q<simplecov-console>, ["~> 0.2"])
55
56
  s.add_dependency(%q<yard>, ["~> 0.8"])
56
57
  s.add_dependency(%q<aruba>, ["~> 0.6"])
58
+ s.add_dependency(%q<rspec_junit_formatter>, ["~> 0.2"])
57
59
  end
58
60
  else
59
- s.add_dependency(%q<chef-gen-flavors>, ["~> 0.5"])
61
+ s.add_dependency(%q<chef-gen-flavors>, ["~> 0.7"])
60
62
  s.add_dependency(%q<rdoc>, ["~> 4.0"])
61
63
  s.add_dependency(%q<chef-dk>, ["~> 0.5"])
62
64
  s.add_dependency(%q<hoe>, ["~> 3.13"])
@@ -71,5 +73,6 @@ Gem::Specification.new do |s|
71
73
  s.add_dependency(%q<simplecov-console>, ["~> 0.2"])
72
74
  s.add_dependency(%q<yard>, ["~> 0.8"])
73
75
  s.add_dependency(%q<aruba>, ["~> 0.6"])
76
+ s.add_dependency(%q<rspec_junit_formatter>, ["~> 0.2"])
74
77
  end
75
78
  end
@@ -0,0 +1,2 @@
1
+ name 'code_generator_2'
2
+ version '0.0.0'
@@ -0,0 +1,2 @@
1
+ template = ChefGen::Flavor::Example2.new(self)
2
+ template.generate
@@ -14,12 +14,15 @@ module ChefGen
14
14
  include ChefGen::Snippet::TestKitchen
15
15
  include ChefGen::Snippet::StandardIgnore
16
16
  include ChefGen::Snippet::StyleRubocop
17
+ include ChefGen::Snippet::StyleTailor
18
+ include ChefGen::Snippet::StyleFoodcritic
17
19
  include ChefGen::Snippet::GitInit
18
20
  include ChefGen::Snippet::ExampleFile
19
21
  include ChefGen::Snippet::ExampleTemplate
22
+ include ChefGen::Snippet::ResourceProvider
20
23
 
21
24
  # the version of the gem
22
- VERSION = '0.4.0'
25
+ VERSION ||= '0.5.0'
23
26
 
24
27
  class << self
25
28
  # :nocov:
@@ -0,0 +1,45 @@
1
+ require 'chef_gen/flavor/example'
2
+
3
+ # chef generators
4
+ module ChefGen
5
+ # a pluggable framework for distributing templates as ruby gems
6
+ module Flavor
7
+ # a flavor that inherits from ChefGen::Flavor::Example
8
+ class Example2 < Example
9
+ # the version of the gem
10
+ VERSION ||= '0.5.0'
11
+
12
+ class << self
13
+ # :nocov:
14
+ def description
15
+ 'Example 2 cookbook template'
16
+ end
17
+ # :nocov:
18
+
19
+ def code_generator_path(classfile)
20
+ File.expand_path(
21
+ File.join(
22
+ classfile,
23
+ '..', '..', '..', '..',
24
+ 'code_generator_2'
25
+ )
26
+ )
27
+ end
28
+ end
29
+
30
+ # hook after run_snippets to remove examples files
31
+ def after_run_snippets
32
+ toremove = [
33
+ 'files',
34
+ File.join('files', 'default'),
35
+ File.join('files', 'default', 'example.conf'),
36
+ 'templates',
37
+ File.join('templates', 'default'),
38
+ File.join('templates', 'default', 'example.conf.erb')
39
+ ]
40
+ @directories.reject! { |e| toremove.include? e }
41
+ @files_if_missing.reject! { |e| toremove.include? e }
42
+ end
43
+ end
44
+ end
45
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-gen-flavor-example
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James FitzGibbon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-18 00:00:00.000000000 Z
11
+ date: 2015-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-gen-flavors
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '0.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.5'
26
+ version: '0.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +220,20 @@ dependencies:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
222
  version: '0.6'
223
+ - !ruby/object:Gem::Dependency
224
+ name: rspec_junit_formatter
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - "~>"
228
+ - !ruby/object:Gem::Version
229
+ version: '0.2'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - "~>"
235
+ - !ruby/object:Gem::Version
236
+ version: '0.2'
223
237
  description: |-
224
238
  An example plugin for [chef-gen-flavors](https://rubygems.org/gems/chef-gen-flavors).
225
239
 
@@ -236,43 +250,17 @@ extra_rdoc_files:
236
250
  - Manifest.txt
237
251
  - README.md
238
252
  files:
239
- - ".rspec"
240
- - ".rubocop.yml"
241
- - ".travis.yml"
242
- - Gemfile
243
- - Guardfile
244
253
  - History.md
245
254
  - LICENSE
246
255
  - Manifest.txt
247
256
  - README.md
248
- - Rakefile
249
257
  - chef-gen-flavor-example.gemspec
250
- - code_generator/files/default/files_default_example_conf
251
- - code_generator/files/default/templates_default_example_conf_erb
252
- - code_generator/libraries/kitchen_helper.rb
253
258
  - code_generator/metadata.rb
254
259
  - code_generator/recipes/cookbook.rb
255
- - code_generator/templates/default/Berksfile.erb
256
- - code_generator/templates/default/CHANGELOG_md.erb
257
- - code_generator/templates/default/Gemfile.erb
258
- - code_generator/templates/default/Guardfile.erb
259
- - code_generator/templates/default/README_md.erb
260
- - code_generator/templates/default/Rakefile.erb
261
- - code_generator/templates/default/_kitchen_yml.erb
262
- - code_generator/templates/default/_rspec.erb
263
- - code_generator/templates/default/_rubocop_yml.erb
264
- - code_generator/templates/default/attributes_default_rb.erb
265
- - code_generator/templates/default/metadata_rb.erb
266
- - code_generator/templates/default/recipes_default_rb.erb
267
- - code_generator/templates/default/spec_recipes_default_spec_rb.erb
268
- - code_generator/templates/default/spec_spec_helper_rb.erb
269
- - code_generator/templates/default/test_integration_default_serverspec_recipes_default_spec_rb.erb
270
- - code_generator/templates/default/test_integration_default_serverspec_spec_helper_rb.erb
271
- - features/generate.feature
272
- - features/support/env.rb
260
+ - code_generator_2/metadata.rb
261
+ - code_generator_2/recipes/cookbook.rb
273
262
  - lib/chef_gen/flavor/example.rb
274
- - spec/lib/chef_gen/flavor/example_spec.rb
275
- - spec/spec_helper.rb
263
+ - lib/chef_gen/flavor/example2.rb
276
264
  homepage: https://github.com/Nordstrom/chef-gen-flavor-example
277
265
  licenses:
278
266
  - apache2
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
@@ -1,13 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - '**/Gemfile'
4
- - '**/*.gemspec'
5
- - 'pkg/**/*'
6
-
7
- Style/RegexpLiteral:
8
- Exclude:
9
- - '**/Guardfile'
10
-
11
- Style/Documentation:
12
- Exclude:
13
- - 'spec/**/*.rb'
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "2.1.6"
4
- - "2.2.2"
5
- install: bundle install --binstubs
6
- env: TRAVIS_BUILD=true
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org/'
2
-
3
- gemspec
data/Guardfile DELETED
@@ -1,15 +0,0 @@
1
- # prevent dropping into pry when nothing is happening
2
- interactor :off
3
-
4
- guard :rubocop, all_on_start: true, cli: ['-D'] do
5
- watch(%r{.+\.rb$})
6
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
7
- watch('Gemfile')
8
- watch('Rakefile')
9
- end
10
-
11
- guard :rspec, all_on_start: true, cmd: 'bundle exec rspec' do
12
- watch(%r{^spec/(.+)_spec\.rb$})
13
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
14
- watch(%r{^spec/spec_helper.*\.rb$}) { 'spec' }
15
- end
data/Rakefile DELETED
@@ -1,96 +0,0 @@
1
- require 'chef_gen/flavor/example'
2
-
3
- begin
4
- require 'hoe'
5
- Hoe.plugin :gemspec
6
- Hoe.plugins.delete :test
7
- Hoe.spec 'chef-gen-flavor-example' do |s|
8
- s.version = ChefGen::Flavor::Example::VERSION
9
- developer 'James FitzGibbon', 'james.i.fitzgibbon@nordstrom.com'
10
- license 'apache2'
11
- extra_deps << ['chef-gen-flavors', '~> 0.5']
12
- extra_dev_deps << ['chef-dk', '~> 0.5']
13
- extra_dev_deps << ['hoe', '~> 3.13']
14
- extra_dev_deps << ['hoe-gemspec', '~> 1.0']
15
- extra_dev_deps << ['rake', '~> 10.3']
16
- extra_dev_deps << ['rspec', '~> 3.1']
17
- extra_dev_deps << ['guard', '~> 2.12']
18
- extra_dev_deps << ['guard-rspec', '~> 4.2']
19
- extra_dev_deps << ['guard-rake', '~> 0.0']
20
- extra_dev_deps << ['guard-rubocop', '~> 1.2']
21
- extra_dev_deps << ['simplecov', '~> 0.9']
22
- extra_dev_deps << ['simplecov-console', '~> 0.2']
23
- extra_dev_deps << ['yard', '~> 0.8']
24
- extra_dev_deps << ['aruba', '~> 0.6']
25
- end
26
- # re-generate our gemspec before packaging
27
- task package: 'gem:spec'
28
- rescue LoadError
29
- puts 'hoe not available; disabling tasks'
30
- end
31
-
32
- # Style Tests
33
- begin
34
- require 'rubocop/rake_task'
35
- RuboCop::RakeTask.new do |t|
36
- t.formatters = ['progress']
37
- t.options = ['-D']
38
- t.patterns = %w(
39
- lib/**/*.rb
40
- spec/**/*.rb
41
- ./Rakefile
42
- )
43
- end
44
- desc 'Run Style Tests'
45
- task style: [:rubocop]
46
- rescue LoadError
47
- puts 'rubocop not available; disabling tasks'
48
- end
49
-
50
- # Unit Tests
51
- begin
52
- require 'rspec/core/rake_task'
53
- RSpec::Core::RakeTask.new
54
-
55
- # Coverage
56
- desc 'Generate unit test coverage report'
57
- task :coverage do
58
- ENV['COVERAGE'] = 'true'
59
- Rake::Task[:test].invoke
60
- end
61
- rescue LoadError
62
- puts 'rspec not available; disabling tasks'
63
- # create a no-op task so that :default works
64
- task :test
65
- end
66
-
67
- # Feature Tests
68
- begin
69
- require 'cucumber'
70
- require 'cucumber/rake/task'
71
- Cucumber::Rake::Task.new(:features)
72
- rescue LoadError
73
- puts 'Cucumber/Aruba not available; disabling feature tasks'
74
- # create a no-op spec task for :default
75
- task :features
76
- end
77
-
78
- # Documentation
79
- begin
80
- require 'yard'
81
- require 'yard/rake/yardoc_task'
82
- YARD::Rake::YardocTask.new(:doc) do |t|
83
- t.options = ['-m', 'markdown', '--private']
84
- t.stats_options = ['--list-undoc']
85
- end
86
- rescue LoadError
87
- puts 'yard not available; disabling tasks'
88
- end
89
-
90
- # test is an alias for testing all the things
91
- desc 'runs unit and feature tests'
92
- task test: [:style, :spec, :features]
93
-
94
- # default is to test everything
95
- desc 'runs all tests'
96
- task default: :test
@@ -1,34 +0,0 @@
1
- # this is an example of a Chef cookbook file. It is
2
- # copied intact when referenced by the cookbook_file
3
- # resource.
4
-
5
- [today_2014_09_17]
6
- variable = value
7
-
8
- [section_two]
9
- variable_1=value_1
10
- variable_2=value_2
11
- variable_3=value_3
12
- variable_4=value_4
13
- variable_5=value_5
14
-
15
- [section_three]
16
- variable_1=value_1
17
- variable_2=value_2
18
- variable_3=value_3
19
- variable_4=value_4
20
- variable_5=value_5
21
-
22
- [section_four]
23
- variable_1=value_1
24
- variable_2=value_2
25
- variable_3=value_3
26
- variable_4=value_4
27
- variable_5=value_5
28
-
29
- [section_five]
30
- variable_1=value_1
31
- variable_2=value_2
32
- variable_3=value_3
33
- variable_4=value_4
34
- variable_5=value_5
@@ -1,22 +0,0 @@
1
- # this is an example of a Chef template. It is a simple
2
- # INI-style file. The first section name is dynamically
3
- # generated to be the current date in YYYY_MM_DD format
4
- # and the second through fifth sections are generated in
5
- # an 'each' loop.
6
- #
7
- # note that ending an ERB tag with -% instead of just %,
8
- # that line doesn't produce an empty line in the output.
9
- # Use this syntax on lines that are pure logic (like the
10
- # require line and start and end of the loop) and contain
11
- # no actual output
12
-
13
- <% require 'date' -%>
14
- [today_<%= DateTime.now.strftime('%Y_%M_%D') %>]
15
- variable = value
16
-
17
- <% %w(two three four five).each do |section_name| -%>
18
- [<%= section_name %>]
19
- <% 5.times do |i| -%>
20
- variable_<%= i %>=value_<%= i %>
21
- <% end -%>
22
- <% end -%>
@@ -1,13 +0,0 @@
1
- # produces ERB to conditionally set proxy vars in kitchen at
2
- # runtime. This can't go directly in the template because if
3
- # it does it gets evaluated at generation time in the context
4
- # of ChefDK
5
- def kitchen_proxy_vars(indentspaces)
6
- <<END
7
- <% %w(http_proxy https_proxy no_proxy).each do |envvar| %>
8
- <% if ENV.key?(envvar) %>
9
- #{' ' * indentspaces}<%= envvar %>: '<%= ENV[envvar] %>'
10
- <% end %>
11
- <% end %>
12
- END
13
- end
@@ -1,3 +0,0 @@
1
- source 'https://supermarket.chef.io'
2
-
3
- metadata
@@ -1,5 +0,0 @@
1
- # Revision History for <%= cookbook_name %>
2
-
3
- ## 0.1.0
4
-
5
- * initial version
@@ -1,25 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- group :development do
4
- gem 'rake', '~> 10.4'
5
- gem 'pry', '~> 0.10'
6
- gem 'pry-byebug', '~> 3.1'
7
- gem 'pry-rescue', '~> 1.4'
8
- gem 'pry-stack_explorer', '~> 0.4'
9
- end
10
-
11
- group :test do
12
- gem 'foodcritic', '~> 4.0'
13
- gem 'chefspec', '~> 4.1'
14
- gem 'ci_reporter_rspec', '~> 1.0'
15
- gem 'test-kitchen', '~> 1.4'
16
- gem 'kitchen-vagrant', '~> 0.16'
17
- gem 'berkshelf', '~> 3.2'
18
- # pin to 2.8 series until guard-foodcritic has been updated for v2 API
19
- gem 'guard', '~> 2.8.2'
20
- # pin to 4.3 series until guard-foodcritic has been updated for v2 API
21
- gem 'guard-rspec', '~> 4.3.1'
22
- gem 'guard-foodcritic', '~> 1.0'
23
- gem 'rubocop', '~> 0.30.0'
24
- gem 'guard-rubocop', '~> 1.1'
25
- end
@@ -1,41 +0,0 @@
1
- notification :terminal_title
2
-
3
- # prevent dropping into pry when nothing is happening
4
- interactor :off
5
-
6
- # automatically runs Foodcritic
7
- guard :foodcritic, cookbook_paths: '.', cli: '-f any -X spec -X test -X features' do
8
- watch(%r{^attributes/.+\.rb$})
9
- watch(%r{^resources/.+\.rb$})
10
- watch(%r{^providers/.+\.rb$})
11
- watch(%r{^libraries/.+\.rb$})
12
- watch(%r{^recipes/.+\.rb$})
13
- watch(%r{^metadata\.rb$})
14
- end
15
-
16
- # automatically runs Rubocop
17
- guard :rubocop, all_on_start: true, cli: ['-f', 'p', '-D'] do
18
- watch(%r{^attributes/.+\.rb$})
19
- watch(%r{^recipes/.+\.rb$})
20
- watch(%r{^libraries/.+\.rb$})
21
- watch(%r{^resources/.+\.rb$})
22
- watch(%r{^providers/.+\.rb$})
23
- watch(%r{^spec/.+\.rb$})
24
- watch(%r{^test/.+\.rb$})
25
- watch(%r{^metadata\.rb$})
26
- watch(%r{^Berksfile$})
27
- watch(%r{^Gemfile$})
28
- watch(%r{^Rakefile$})
29
- end
30
-
31
- # automatically runs ChefSpec tests
32
- rspec_command = ENV.key?('DISABLE_PRY_RESCUE') ? 'rspec' : 'rescue rspec'
33
- guard :rspec, all_on_start: true, cmd: "bundle exec #{rspec_command}" do
34
- watch(%r{^spec/recipes/.+_spec\.rb$})
35
- watch(%r{^spec/spec_helper\.rb$}) { 'spec' }
36
- watch(%r{^attributes/.+\.rb$}) { 'spec' }
37
- watch(%r{^resources/.+\.rb$}) { 'spec' }
38
- watch(%r{^providers/.+\.rb$}) { 'spec' }
39
- watch(%r{^libraries/.+\.rb$}) { 'spec' }
40
- watch(%r{^recipes/(.+)\.rb$}) { |m| "spec/recipes/#{m[1]}_spec.rb" }
41
- end
@@ -1,92 +0,0 @@
1
- # <%= cookbook_name %>
2
-
3
- ## Description
4
-
5
- ...
6
-
7
- ## Usage
8
-
9
- Add 'recipe[<%= cookbook_name %>::default]' to your node's run-list.
10
-
11
- ## Recipes
12
-
13
- ### default
14
-
15
- The default recipe ...
16
-
17
- ## Attributes
18
-
19
- The attributes defined by this recipe are organized under the
20
- `node['<%= cookbook_name %>']` namespace.
21
-
22
- Attribute | Description | Type | Default
23
- ----------|-------------|--------|--------
24
- ... | ... | String | ...
25
-
26
- ## Development
27
-
28
- The first time you check out this cookbook, run
29
-
30
- bundle --binstubs
31
-
32
- to download and install the development tools.
33
-
34
- ## Testing
35
-
36
- Three forms of cookbook testing are available:
37
-
38
- ### Style Checks
39
-
40
- bin/rake style
41
-
42
- Will run foodcritic (cookbook style) and tailor (ruby style/syntax)
43
- checks. These tests must pass before the cookbook can progress
44
- through the CI pipeline.
45
-
46
- ### Unit Tests
47
-
48
- bin/rake spec
49
-
50
- Will run ChefSpec tests. It is a good idea to ensure that these
51
- tests pass before committing changes to git.
52
-
53
- #### Unit Test Coverage
54
-
55
- bin/rake coverage
56
-
57
- Will run the ChefSpec tests and report on test coverage. It is a
58
- good idea to make sure that every Chef resource you declare is covered
59
- by a unit test.
60
-
61
- #### Automated Testing with Guard
62
-
63
- bin/guard
64
-
65
- Will run foodcritic, tailor, rubocop (if enabled) and chefspec tests
66
- automatically when the associated files change. If a chefspec test
67
- fails, it will drop you into a pry session in the context of the
68
- failure to explore the state of the run.
69
-
70
- To disable the pry-rescue behavior, define the environment variable
71
- DISABLE_PRY_RESCUE before running guard:
72
-
73
- DISABLE_PRY_RESCUE=1 bin/guard
74
-
75
- ### Integration Tests
76
-
77
- bin/rake kitchen:all
78
-
79
- Will run the test kitchen integration tests. These tests use Vagrant
80
- and Virtualbox, which must be installed for the tests to execute.
81
-
82
- After converging in a virtual machine, ServerSpec tests are executed.
83
- This skeleton comes with a very basic ServerSpec test; refer to
84
- http://serverspec.org for detail on how to create tests.
85
-
86
- ## Author
87
-
88
- <%= copyright_holder %>
89
-
90
- ## License
91
-
92
- <%= license_description %>
@@ -1,52 +0,0 @@
1
- require 'foodcritic'
2
- require 'foodcritic/rake_task'
3
- require 'rspec/core/rake_task'
4
- require 'rubocop/rake_task'
5
- require 'kitchen/rake_tasks'
6
-
7
- # Style tests (Foodcritic / Rubocop)
8
- FoodCritic::Rake::LintTask.new
9
- RuboCop::RakeTask.new do |t|
10
- t.formatters = ['progress']
11
- t.options = ['-D']
12
- t.patterns = %w(
13
- attributes/*.rb
14
- recipes/*.rb
15
- libraries/**/*.rb
16
- resources/*.rb
17
- providers/*.rb
18
- spec/**/*.rb
19
- test/**/*.rb
20
- ./metadata.rb
21
- ./Berksfile
22
- ./Gemfile
23
- ./Rakefile
24
- )
25
- end
26
-
27
- desc 'Run Style Tests'
28
- task style: [:foodcritic, :rubocop]
29
-
30
- # ChefSpec (RSpec)
31
- RSpec::Core::RakeTask.new
32
-
33
- desc 'Generate ChefSpec coverage report'
34
- task :coverage do
35
- ENV['COVERAGE'] = 'true'
36
- Rake::Task[:spec].invoke
37
- end
38
-
39
- # Test Kitchen
40
- begin
41
- Kitchen::RakeTasks.new
42
- rescue LoadError
43
- puts 'test-kitchen initialization failed; disabling kitchen tasks'
44
- end
45
-
46
- # test is an alias for testing all the things except kitchen
47
- desc 'runs style and unit tests'
48
- task test: [:style, :spec]
49
-
50
- # default is to test everything
51
- desc 'runs all tests'
52
- task default: :test
@@ -1,30 +0,0 @@
1
- <%% proxy_vars = {} %>
2
- <%% %w(http_proxy https_proxy no_proxy).each do |envvar| %>
3
- <%% if ENV.key?(envvar) %>
4
- <%% proxy_vars[envvar] = ENV[envvar] %>
5
- <%% end %>
6
- <%% end %>
7
- ---
8
- driver:
9
- name: vagrant
10
-
11
- <%% if proxy_vars.size > 0 %>
12
- driver_config:
13
- <%= kitchen_proxy_vars(2) %>
14
- <%% end %>
15
-
16
- provisioner:
17
- name: chef_zero
18
- <%% if proxy_vars.size > 0 %>
19
- client_rb:
20
- <%= kitchen_proxy_vars(4) %>
21
- <%% end %>
22
-
23
- platforms:
24
- - name: ubuntu-14.04
25
- - name: centos-6.6
26
-
27
- suites:
28
- - name: default
29
- run_list:
30
- - recipe[<%= cookbook_name %>::default]
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
@@ -1,17 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - 'vendor/**/*'
4
-
5
- Style/SingleSpaceBeforeFirstArg:
6
- Exclude:
7
- - '**/Berksfile'
8
- - '**/metadata.rb'
9
-
10
- Style/FileName:
11
- Exclude:
12
- - '**/Gemfile'
13
- - '**/Berksfile'
14
-
15
- Style/RegexpLiteral:
16
- Exclude:
17
- - '**/Guardfile'
@@ -1,8 +0,0 @@
1
- #
2
- # Cookbook <%= cookbook_name %>
3
- # Copyright (c) <%= year %> <%= copyright_holder %>
4
- #
5
-
6
- # replace these with something real
7
- default['<%= cookbook_name %>']['attribute_1'] = 'foo'
8
- default['<%= cookbook_name %>']['attribute_2'] = 'bar'
@@ -1,10 +0,0 @@
1
- #
2
- # Copyright (c) <%= year %> <%= copyright_holder %>
3
- #
4
-
5
- name '<%= cookbook_name %>'
6
- maintainer '<%= copyright_holder %>'
7
- maintainer_email '<%= email %>'
8
- license '<%= license %>'
9
- description 'Installs/Configures <%= cookbook_name %>'
10
- version '0.1.0'
@@ -1,9 +0,0 @@
1
- #
2
- # Recipe: <%= cookbook_name %>::default
3
- # Copyright (c) <%= year %> <%= copyright_holder %>
4
- #
5
-
6
- # a common pattern is to seperate the cookbook into distinct
7
- # recipes and pull them all in via the default recipe
8
- # include_recipe '<%= cookbook_name %>::recipe_a'
9
- # include_recipe '<%= cookbook_name %>::recipe_b'
@@ -1,7 +0,0 @@
1
- RSpec.describe '<%= cookbook_name %>::default' do
2
- let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }
3
-
4
- it 'converges successfully' do
5
- expect(chef_run).to include_recipe(described_recipe)
6
- end
7
- end
@@ -1,94 +0,0 @@
1
- require 'chefspec'
2
- require 'chefspec/berkshelf'
3
-
4
- # This file was generated by the `rspec --init` command. Conventionally, all
5
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
6
- # The generated `.rspec` file contains `--require spec_helper` which will
7
- # cause this file to always be loaded, without a need to explicitly require
8
- # it in any files.
9
- #
10
- # Given that it is always loaded, you are encouraged to keep this file as
11
- # light-weight as possible. Requiring heavyweight dependencies from this file
12
- # will add to the boot time of your test suite on EVERY test run, even for
13
- # an individual file that may not need all of that loaded. Instead, consider
14
- # making a separate helper file that requires the additional dependencies
15
- # and performs the additional setup, and require it from the spec files that
16
- # actually need it.
17
- #
18
- # The `.rspec` file also contains a few flags that are not defaults but that
19
- # users commonly want.
20
- #
21
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
- RSpec.configure do |config|
23
- # rspec-expectations config goes here. You can use an alternate
24
- # assertion/expectation library such as wrong or the stdlib/minitest
25
- # assertions if you prefer.
26
- config.expect_with :rspec do |expectations|
27
- # This option will default to `true` in RSpec 4. It makes the `description`
28
- # and `failure_message` of custom matchers include text for helper methods
29
- # defined using `chain`, e.g.:
30
- # be_bigger_than(2).and_smaller_than(4).description
31
- # # => "be bigger than 2 and smaller than 4"
32
- # ...rather than:
33
- # # => "be bigger than 2"
34
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
- end
36
-
37
- # rspec-mocks config goes here. You can use an alternate test double
38
- # library (such as bogus or mocha) by changing the `mock_with` option here.
39
- config.mock_with :rspec do |mocks|
40
- # Prevents you from mocking or stubbing a method that does not exist on
41
- # a real object. This is generally recommended, and will default to
42
- # `true` in RSpec 4.
43
- mocks.verify_partial_doubles = true
44
- end
45
-
46
- # The settings below are suggested to provide a good initial experience
47
- # with RSpec, but feel free to customize to your heart's content.
48
- # These two settings work together to allow you to limit a spec run
49
- # to individual examples or groups you care about by tagging them with
50
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
- # get run.
52
- config.filter_run :focus
53
- config.run_all_when_everything_filtered = true
54
-
55
- # Limits the available syntax to the non-monkey patched syntax that is
56
- # recommended. For more details, see:
57
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
58
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
59
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
60
- config.disable_monkey_patching!
61
-
62
- # This setting enables warnings. It's recommended, but in some cases may
63
- # be too noisy due to issues in dependencies.
64
- config.warnings = false
65
-
66
- # Many RSpec users commonly either run the entire suite or an individual
67
- # file, and it's useful to allow more verbose output when running an
68
- # individual spec file.
69
- if config.files_to_run.one?
70
- # Use the documentation formatter for detailed output,
71
- # unless a formatter has already been configured
72
- # (e.g. via a command-line flag).
73
- config.default_formatter = 'doc'
74
- end
75
-
76
- # Print the 10 slowest examples and example groups at the
77
- # end of the spec run, to help surface which specs are running
78
- # particularly slow.
79
- config.profile_examples = 10
80
-
81
- # Run specs in random order to surface order dependencies. If you find an
82
- # order dependency and want to debug it, you can fix the order by providing
83
- # the seed, which is printed after each run.
84
- # --seed 1234
85
- config.order = :random
86
-
87
- # Seed global randomization in this process using the `--seed` CLI option.
88
- # Setting this allows you to use `--seed` to deterministically reproduce
89
- # test failures related to randomization by passing the same `--seed` value
90
- # as the one that triggered the failure.
91
- Kernel.srand config.seed
92
- end
93
-
94
- ChefSpec::Coverage.start! if ENV['COVERAGE']
@@ -1,16 +0,0 @@
1
- #
2
- # Copyright (c) <%= year %> <%= copyright_holder %>
3
- #
4
-
5
- require 'spec_helper'
6
-
7
- # this is a generic ServerSpec test. It just runs 'whoami'
8
- # and confirms that it returns 'root'. In a real test suite,
9
- # you would want to test things like directories, users,
10
- # processes, services, etc.
11
- #
12
- # for more information on the things ServerSpec can test, refer
13
- # to the documentation at http://serverspec.org
14
- describe command('whoami') do
15
- its(:stdout) { should eq "root\n" }
16
- end
@@ -1,7 +0,0 @@
1
- #
2
- # Copyright (c) <%= year %> <%= copyright_holder %>
3
- #
4
-
5
- require 'serverspec'
6
-
7
- set :backend, :exec
@@ -1,84 +0,0 @@
1
- Feature: chef generate
2
-
3
- Verifies that 'chef generate cookbook' works when the generator
4
- path is dynamically chosen by chef-gen-flavors
5
-
6
- Scenario: verify cookbook contents
7
- Given a knife.rb that uses chef-gen-flavors
8
- And I set the environment variables to:
9
- | variable | value |
10
- |----------------|---------|
11
- | CHEFGEN_FLAVOR | example |
12
- When I generate a cookbook named "foo"
13
- Then the exit status should be 0
14
- And I cd to "foo"
15
- And the following files should exist:
16
- | Guardfile |
17
- | Rakefile |
18
- | .rubocop.yml |
19
- | spec/recipes/default_spec.rb |
20
- | test/integration/default/serverspec/recipes/default_spec.rb |
21
- And the following directories should exist:
22
- | recipes |
23
- | attributes |
24
- And the file "README.md" should match /^# foo$/
25
- And the file "README.md" should match /^Add 'recipe\[foo::default\]' to your node's run-list./
26
-
27
- Scenario: verify that the rake tasks are available after generation
28
- Given a knife.rb that uses chef-gen-flavors
29
- And I set the environment variables to:
30
- | variable | value |
31
- |----------------|---------|
32
- | CHEFGEN_FLAVOR | example |
33
- When I generate a cookbook named "foo"
34
- And I cd to "foo"
35
- And I bundle gems
36
- And I list the rake tasks
37
- Then the exit status should be 0
38
- And the output should match each of:
39
- | ^rake foodcritic |
40
- | ^rake rubocop |
41
- | ^rake spec |
42
- | ^rake kitchen:all |
43
- | ^rake style |
44
-
45
- Scenario: verify that the cookbook passes style checks after generation
46
- Given a knife.rb that uses chef-gen-flavors
47
- And I set the environment variables to:
48
- | variable | value |
49
- |----------------|---------|
50
- | CHEFGEN_FLAVOR | example |
51
- When I generate a cookbook named "foo"
52
- And I cd to "foo"
53
- And I bundle gems
54
- And I run a style test
55
- Then the exit status should be 0
56
- And the output should match /no offenses detected$/
57
-
58
- Scenario: verify that the cookbook passes unit tests after generation
59
- Given a knife.rb that uses chef-gen-flavors
60
- And I set the environment variables to:
61
- | variable | value |
62
- |----------------|---------|
63
- | CHEFGEN_FLAVOR | example |
64
- When I generate a cookbook named "foo"
65
- And I cd to "foo"
66
- And I bundle gems
67
- And I run a unit test
68
- Then the exit status should be 0
69
- And the output should match /0 failures$/
70
-
71
- Scenario: verify that the kitchen suites can be listed
72
- Given a knife.rb that uses chef-gen-flavors
73
- And I set the environment variables to:
74
- | variable | value |
75
- |----------------|---------|
76
- | CHEFGEN_FLAVOR | example |
77
- When I generate a cookbook named "foo"
78
- And I cd to "foo"
79
- And I bundle gems
80
- And I list the kitchen suites
81
- Then the exit status should be 0
82
- And the output should match each of:
83
- | ^default-ubuntu-1404 |
84
- | ^default-centos-66 |
@@ -1,15 +0,0 @@
1
- if ENV['COVERAGE']
2
- require 'simplecov'
3
- end
4
-
5
- require 'aruba/cucumber'
6
- require 'chef_gen/flavors/cucumber'
7
-
8
- # Travis runs tests in a limited environment which can take a long time to invoke
9
- # commands. Up the timeout when we're in a travis build based on the environment
10
- # variable set in .travis.yml
11
- if ENV['TRAVIS_BUILD']
12
- Before do
13
- @aruba_timeout_seconds = 15
14
- end
15
- end
@@ -1,86 +0,0 @@
1
- require 'chef_gen/flavor/example'
2
-
3
- RSpec.describe ChefGen::Flavor::Example do
4
- include ChefDKGeneratorContext
5
- include DummyRecipe
6
-
7
- before do
8
- @orig_stdout = $stdout
9
- $stdout = File.open(File::NULL, 'w')
10
- end
11
-
12
- after do
13
- $stdout = @orig_stdout
14
- end
15
-
16
- %w(
17
- templates
18
- templates/default
19
- files
20
- files/default
21
- test
22
- test/integration
23
- test/integration/default
24
- test/integration/default/serverspec
25
- test/integration/default/serverspec/recipes
26
- spec
27
- spec/recipes
28
- attributes
29
- recipes
30
- ).each do |dirname|
31
- it "should create the directory #{dirname}" do
32
- expect(@recipe).to receive(:directory).with(/#{dirname}$/)
33
- template = ChefGen::Flavor::Example.new(@recipe)
34
- template.generate
35
- end
36
- end
37
-
38
- %w(
39
- .rspec
40
- Gemfile
41
- Berksfile
42
- Rakefile
43
- Guardfile
44
- .rubocop.yml
45
- .kitchen.yml
46
- test/integration/default/serverspec/spec_helper.rb
47
- test/integration/default/serverspec/recipes/default_spec.rb
48
- spec/spec_helper.rb
49
- spec/recipes/default_spec.rb
50
- recipes/default.rb
51
- attributes/default.rb
52
- metadata.rb
53
- README.md
54
- CHANGELOG.md
55
- ).each do |filename|
56
- it "should generate the file #{filename} from a template" do
57
- expect(@recipe).to receive(:template).with(/#{filename}$/)
58
- template = ChefGen::Flavor::Example.new(@recipe)
59
- template.generate
60
- end
61
- end
62
-
63
- %w(
64
- templates/default/example.conf.erb
65
- files/default/example.conf
66
- ).each do |filename|
67
- it "should write the file #{filename}" do
68
- expect(@recipe).to receive(:cookbook_file).with(/#{filename}$/)
69
- template = ChefGen::Flavor::Example.new(@recipe)
70
- template.generate
71
- end
72
- end
73
-
74
- it 'should write a chefignore and .gitignore' do
75
- expect(@recipe).to receive(:file).with(/chefignore$/)
76
- expect(@recipe).to receive(:file).with(/\.gitignore$/)
77
- template = ChefGen::Flavor::Example.new(@recipe)
78
- template.generate
79
- end
80
-
81
- it 'should display the actions taken' do
82
- expect(@recipe).to receive(:ruby_block).with('report_actions_taken')
83
- template = ChefGen::Flavor::Example.new(@recipe)
84
- template.generate
85
- end
86
- end
@@ -1,48 +0,0 @@
1
- require 'rspec/core/shared_context'
2
-
3
- if ENV['COVERAGE']
4
- require 'simplecov'
5
- require 'simplecov-console'
6
- SimpleCov.formatters = [
7
- SimpleCov::Formatter::HTMLFormatter,
8
- SimpleCov::Formatter::Console
9
- ]
10
- SimpleCov.start
11
- end
12
-
13
- RSpec.configure do |config|
14
- config.expect_with :rspec do |expectations|
15
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
16
- end
17
-
18
- config.mock_with :rspec do |mocks|
19
- mocks.verify_partial_doubles = true
20
- end
21
-
22
- config.disable_monkey_patching!
23
- config.order = :random
24
- Kernel.srand config.seed
25
- end
26
-
27
- # a shared context that stubs a ChefDK Generator context
28
- module ChefDKGeneratorContext
29
- extend RSpec::Core::SharedContext
30
-
31
- before do
32
- @ctx = double('ChefDK generator context')
33
- allow(@ctx).to receive(:cookbook_root).and_return('/nonexistent')
34
- allow(@ctx).to receive(:cookbook_name).and_return('foo')
35
- allow(@ctx).to receive(:have_git).and_return(true)
36
- allow(@ctx).to receive(:skip_git_init).and_return(false)
37
- allow(ChefDK::Generator).to receive(:context).and_return(@ctx)
38
- end
39
- end
40
-
41
- # a shared context that allows a recipe double to receive unknown methods
42
- module DummyRecipe
43
- extend RSpec::Core::SharedContext
44
-
45
- before do
46
- @recipe = double('Chef recipe').as_null_object
47
- end
48
- end