chef-gen-flavors 0.8.6 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.md +5 -0
- data/LICENSE +2 -0
- data/Manifest.txt +0 -37
- data/README.md +113 -330
- data/chef-gen-flavors.gemspec +9 -9
- data/lib/chef_gen/flavors.rb +34 -100
- metadata +16 -47
- data/lib/chef_gen/flavor_base.rb +0 -266
- data/lib/chef_gen/snippet/attributes.rb +0 -35
- data/lib/chef_gen/snippet/chef_spec.rb +0 -111
- data/lib/chef_gen/snippet/cookbook_base.rb +0 -160
- data/lib/chef_gen/snippet/example_file.rb +0 -38
- data/lib/chef_gen/snippet/example_template.rb +0 -40
- data/lib/chef_gen/snippet/git_init.rb +0 -21
- data/lib/chef_gen/snippet/recipes.rb +0 -37
- data/lib/chef_gen/snippet/resource_provider.rb +0 -42
- data/lib/chef_gen/snippet/standard_ignore.rb +0 -73
- data/lib/chef_gen/snippet/style_foodcritic.rb +0 -51
- data/lib/chef_gen/snippet/style_rubocop.rb +0 -94
- data/lib/chef_gen/snippet/style_tailor.rb +0 -48
- data/lib/chef_gen/snippet/test_kitchen.rb +0 -109
- data/lib/chef_gen/snippets.rb +0 -18
- data/shared/snippet/attributes/attributes_default_rb.erb +0 -8
- data/shared/snippet/chef_spec/_rspec.erb +0 -2
- data/shared/snippet/chef_spec/spec_chef_runner_context_rb.erb +0 -36
- data/shared/snippet/chef_spec/spec_recipes_default_spec_rb.erb +0 -7
- data/shared/snippet/chef_spec/spec_spec_helper_rb.erb +0 -95
- data/shared/snippet/cookbookbase/Berksfile.erb +0 -12
- data/shared/snippet/cookbookbase/CHANGELOG_md.erb +0 -5
- data/shared/snippet/cookbookbase/Gemfile.erb +0 -18
- data/shared/snippet/cookbookbase/Guardfile.erb +0 -16
- data/shared/snippet/cookbookbase/README_md.erb +0 -92
- data/shared/snippet/cookbookbase/Rakefile.erb +0 -20
- data/shared/snippet/cookbookbase/metadata_rb.erb +0 -10
- data/shared/snippet/examplefile/files_default_example_conf +0 -34
- data/shared/snippet/exampletemplate/templates_default_example_conf_erb +0 -22
- data/shared/snippet/recipes/recipes_default_rb.erb +0 -9
- data/shared/snippet/resourceprovider/providers_default_rb.erb +0 -20
- data/shared/snippet/resourceprovider/resources_default_rb.erb +0 -9
- data/shared/snippet/stylerubocop/_rubocop_yml.erb +0 -31
- data/shared/snippet/testkitchen/_kitchen_yml.erb +0 -30
- data/shared/snippet/testkitchen/libraries_kitchen_helper_rb +0 -13
- data/shared/snippet/testkitchen/test_integration_default_serverspec_recipes_default_spec_rb.erb +0 -16
- data/shared/snippet/testkitchen/test_integration_default_serverspec_spec_helper_rb.erb +0 -7
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'rspec/core/shared_context'
|
2
|
-
|
3
|
-
# this is a 'standard' chef run, with no overrides
|
4
|
-
module ChefRun
|
5
|
-
extend RSpec::Core::SharedContext
|
6
|
-
|
7
|
-
let(:chef_run) do
|
8
|
-
ChefSpec::ServerRunner.new.converge(described_recipe)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
# the following are commented out to save memory
|
13
|
-
# they show how you can set up alternate Chef Runners that
|
14
|
-
# override the node's chef environment or other attributes
|
15
|
-
# module ChefRunTestEnv
|
16
|
-
# extend RSpec::Core::SharedContext
|
17
|
-
#
|
18
|
-
# let(:chef_run) do
|
19
|
-
# ChefSpec::ServerRunner.new do |node, server|
|
20
|
-
# server.create_environment('<%= cookbook_name %>-test')
|
21
|
-
# node.chef_environment = '<%= cookbook_name %>-test'
|
22
|
-
# server.create_node(node)
|
23
|
-
# end.converge(described_recipe)
|
24
|
-
# end
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# # a chef run where node attributes are overriden
|
28
|
-
# module ChefRunOverrideAttrs
|
29
|
-
# extend RSpec::Core::SharedContext
|
30
|
-
#
|
31
|
-
# let(:chef_run) do
|
32
|
-
# ChefSpec::ServerRunner.new do |node|
|
33
|
-
# node.set['<%= cookbook_name %>']['foobar'] = true
|
34
|
-
# end.converge(described_recipe)
|
35
|
-
# end
|
36
|
-
# end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
require 'chefspec'
|
2
|
-
require 'chefspec/berkshelf'
|
3
|
-
require 'chef_runner_context'
|
4
|
-
|
5
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
6
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
7
|
-
# The generated `.rspec` file contains `--require spec_helper` which will
|
8
|
-
# cause this file to always be loaded, without a need to explicitly require
|
9
|
-
# it in any files.
|
10
|
-
#
|
11
|
-
# Given that it is always loaded, you are encouraged to keep this file as
|
12
|
-
# light-weight as possible. Requiring heavyweight dependencies from this file
|
13
|
-
# will add to the boot time of your test suite on EVERY test run, even for
|
14
|
-
# an individual file that may not need all of that loaded. Instead, consider
|
15
|
-
# making a separate helper file that requires the additional dependencies
|
16
|
-
# and performs the additional setup, and require it from the spec files that
|
17
|
-
# actually need it.
|
18
|
-
#
|
19
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
20
|
-
# users commonly want.
|
21
|
-
#
|
22
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
23
|
-
RSpec.configure do |config|
|
24
|
-
# rspec-expectations config goes here. You can use an alternate
|
25
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
26
|
-
# assertions if you prefer.
|
27
|
-
config.expect_with :rspec do |expectations|
|
28
|
-
# This option will default to `true` in RSpec 4. It makes the `description`
|
29
|
-
# and `failure_message` of custom matchers include text for helper methods
|
30
|
-
# defined using `chain`, e.g.:
|
31
|
-
# be_bigger_than(2).and_smaller_than(4).description
|
32
|
-
# # => "be bigger than 2 and smaller than 4"
|
33
|
-
# ...rather than:
|
34
|
-
# # => "be bigger than 2"
|
35
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
36
|
-
end
|
37
|
-
|
38
|
-
# rspec-mocks config goes here. You can use an alternate test double
|
39
|
-
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
40
|
-
config.mock_with :rspec do |mocks|
|
41
|
-
# Prevents you from mocking or stubbing a method that does not exist on
|
42
|
-
# a real object. This is generally recommended, and will default to
|
43
|
-
# `true` in RSpec 4.
|
44
|
-
mocks.verify_partial_doubles = true
|
45
|
-
end
|
46
|
-
|
47
|
-
# The settings below are suggested to provide a good initial experience
|
48
|
-
# with RSpec, but feel free to customize to your heart's content.
|
49
|
-
# These two settings work together to allow you to limit a spec run
|
50
|
-
# to individual examples or groups you care about by tagging them with
|
51
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
52
|
-
# get run.
|
53
|
-
config.filter_run :focus
|
54
|
-
config.run_all_when_everything_filtered = true
|
55
|
-
|
56
|
-
# Limits the available syntax to the non-monkey patched syntax that is
|
57
|
-
# recommended. For more details, see:
|
58
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
59
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
60
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
61
|
-
config.disable_monkey_patching!
|
62
|
-
|
63
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
64
|
-
# be too noisy due to issues in dependencies.
|
65
|
-
config.warnings = false
|
66
|
-
|
67
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
68
|
-
# file, and it's useful to allow more verbose output when running an
|
69
|
-
# individual spec file.
|
70
|
-
if config.files_to_run.one?
|
71
|
-
# Use the documentation formatter for detailed output,
|
72
|
-
# unless a formatter has already been configured
|
73
|
-
# (e.g. via a command-line flag).
|
74
|
-
config.default_formatter = 'doc'
|
75
|
-
end
|
76
|
-
|
77
|
-
# Print the 10 slowest examples and example groups at the
|
78
|
-
# end of the spec run, to help surface which specs are running
|
79
|
-
# particularly slow.
|
80
|
-
config.profile_examples = 10
|
81
|
-
|
82
|
-
# Run specs in random order to surface order dependencies. If you find an
|
83
|
-
# order dependency and want to debug it, you can fix the order by providing
|
84
|
-
# the seed, which is printed after each run.
|
85
|
-
# --seed 1234
|
86
|
-
config.order = :random
|
87
|
-
|
88
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
89
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
90
|
-
# test failures related to randomization by passing the same `--seed` value
|
91
|
-
# as the one that triggered the failure.
|
92
|
-
Kernel.srand config.seed
|
93
|
-
end
|
94
|
-
|
95
|
-
ChefSpec::Coverage.start! if ENV['COVERAGE']
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<% @sources.each do |source| -%>
|
2
|
-
source '<%= source %>'
|
3
|
-
<% end -%>
|
4
|
-
|
5
|
-
metadata
|
6
|
-
|
7
|
-
# load local overrides
|
8
|
-
berksfile_dir = File.absolute_path(File.join('.', 'lib', 'berksfile'))
|
9
|
-
Dir.glob(File.join(berksfile_dir, '*.berks')).each do |snippet|
|
10
|
-
# rubocop:disable Lint/Eval
|
11
|
-
eval File.read(snippet), nil, snippet
|
12
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<% @sources.each do |source| -%>
|
2
|
-
source '<%= source %>'
|
3
|
-
<% end -%>
|
4
|
-
|
5
|
-
<% @gems.each do |gem, config| -%>
|
6
|
-
<% if config.is_a?(Array) -%>
|
7
|
-
gem '<%= gem %>', '<%= config[0] %>', <%= config[1..-1].join(', ') %>
|
8
|
-
<% else -%>
|
9
|
-
gem '<%= gem %>', '<%= config %>'
|
10
|
-
<% end -%>
|
11
|
-
<% end -%>
|
12
|
-
|
13
|
-
# load local overrides
|
14
|
-
gemfile_dir = File.absolute_path(File.join('.', 'lib', 'gemfile'))
|
15
|
-
Dir.glob(File.join(gemfile_dir, '*.bundler')).each do |snippet|
|
16
|
-
# rubocop:disable Lint/Eval
|
17
|
-
eval File.read(snippet), nil, snippet
|
18
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
notification :terminal_title
|
2
|
-
|
3
|
-
# prevent dropping into pry when nothing is happening
|
4
|
-
interactor :off
|
5
|
-
|
6
|
-
<% @guards.each do |name, guard| -%>
|
7
|
-
# <%= name %>
|
8
|
-
<%= guard %>
|
9
|
-
|
10
|
-
<% end -%>
|
11
|
-
|
12
|
-
# load local overrides
|
13
|
-
guardfile_dir = File.absolute_path(File.join('.', 'lib', 'guardfile'))
|
14
|
-
Dir.glob(File.join(guardfile_dir, '*.guard')).each do |snippet|
|
15
|
-
eval File.read(snippet), nil, snippet # rubocop:disable Lint/Eval
|
16
|
-
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,20 +0,0 @@
|
|
1
|
-
desc 'runs style tests'
|
2
|
-
task style: []
|
3
|
-
|
4
|
-
desc 'runs unit tests'
|
5
|
-
task spec: []
|
6
|
-
|
7
|
-
desc 'runs integration tests'
|
8
|
-
task integration: []
|
9
|
-
|
10
|
-
desc 'runs style and unit tests'
|
11
|
-
task test: [:style, :spec]
|
12
|
-
|
13
|
-
desc 'runs all tests'
|
14
|
-
task default: :test
|
15
|
-
|
16
|
-
<% @tasks.each do |name, task| -%>
|
17
|
-
# <%= name %>
|
18
|
-
<%= task %>
|
19
|
-
|
20
|
-
<% end -%>
|
@@ -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,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,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,20 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Resource: <%= cookbook_name %>
|
3
|
-
# Copyright (c) <%= year %> <%= copyright_holder %>
|
4
|
-
#
|
5
|
-
|
6
|
-
use_inline_resources
|
7
|
-
|
8
|
-
def whyrun_supported?
|
9
|
-
true
|
10
|
-
end
|
11
|
-
|
12
|
-
action :create do
|
13
|
-
converge_by 'create a <%= cookbook_name %>' do
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
action :delete do
|
18
|
-
converge_by 'delete a <%= cookbook_name %>' do
|
19
|
-
end
|
20
|
-
end
|
@@ -1,31 +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'
|
18
|
-
|
19
|
-
Style/EmptyLines:
|
20
|
-
Exclude:
|
21
|
-
- '**/Guardfile'
|
22
|
-
- '**/Rakefile'
|
23
|
-
|
24
|
-
Style/TrailingBlankLines:
|
25
|
-
Exclude:
|
26
|
-
- '**/Guardfile'
|
27
|
-
- '**/Rakefile'
|
28
|
-
|
29
|
-
Metrics/LineLength:
|
30
|
-
Exclude:
|
31
|
-
- '**/Gemfile'
|