chef-gen-flavors 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ARUBA_STEPS.md +74 -0
- data/History.md +16 -0
- data/Manifest.txt +25 -30
- data/README.md +121 -16
- data/chef-gen-flavors.gemspec +8 -5
- data/lib/chef_gen/flavor_base.rb +42 -34
- data/lib/chef_gen/flavors.rb +36 -10
- data/lib/chef_gen/snippet/attributes.rb +13 -0
- data/lib/chef_gen/snippet/chef_spec.rb +84 -14
- data/lib/chef_gen/snippet/cookbook_base.rb +109 -23
- data/lib/chef_gen/snippet/example_file.rb +15 -0
- data/lib/chef_gen/snippet/example_template.rb +15 -0
- data/lib/chef_gen/snippet/git_init.rb +2 -0
- data/lib/chef_gen/snippet/recipes.rb +15 -0
- data/lib/chef_gen/snippet/resource_provider.rb +18 -0
- data/lib/chef_gen/snippet/standard_ignore.rb +56 -80
- data/lib/chef_gen/snippet/style_foodcritic.rb +51 -0
- data/lib/chef_gen/snippet/style_rubocop.rb +80 -0
- data/lib/chef_gen/snippet/style_tailor.rb +48 -0
- data/lib/chef_gen/snippet/test_kitchen.rb +70 -15
- data/lib/chef_gen/snippets.rb +2 -0
- data/shared/snippet/attributes/attributes_default_rb.erb +8 -0
- data/{.rspec → shared/snippet/chef_spec/_rspec.erb} +0 -0
- data/shared/snippet/chef_spec/spec_chef_runner_context_rb.erb +36 -0
- data/shared/snippet/chef_spec/spec_recipes_default_spec_rb.erb +7 -0
- data/shared/snippet/chef_spec/spec_spec_helper_rb.erb +95 -0
- data/shared/snippet/cookbookbase/Berksfile.erb +5 -0
- data/shared/snippet/cookbookbase/CHANGELOG_md.erb +5 -0
- data/shared/snippet/cookbookbase/Gemfile.erb +7 -0
- data/shared/snippet/cookbookbase/Guardfile.erb +10 -0
- data/shared/snippet/cookbookbase/README_md.erb +92 -0
- data/shared/snippet/cookbookbase/Rakefile.erb +20 -0
- data/shared/snippet/cookbookbase/metadata_rb.erb +10 -0
- data/shared/snippet/examplefile/files_default_example_conf +34 -0
- data/shared/snippet/exampletemplate/templates_default_example_conf_erb +22 -0
- data/shared/snippet/recipes/recipes_default_rb.erb +9 -0
- data/shared/snippet/resourceprovider/providers_default_rb.erb +20 -0
- data/shared/snippet/resourceprovider/resources_default_rb.erb +9 -0
- data/shared/snippet/stylerubocop/_rubocop_yml.erb +27 -0
- data/shared/snippet/testkitchen/_kitchen_yml.erb +30 -0
- data/shared/snippet/testkitchen/libraries_kitchen_helper_rb +13 -0
- data/shared/snippet/testkitchen/test_integration_default_serverspec_recipes_default_spec_rb.erb +16 -0
- data/shared/snippet/testkitchen/test_integration_default_serverspec_spec_helper_rb.erb +7 -0
- metadata +42 -32
- data/.rubocop.yml +0 -27
- data/.travis.yml +0 -6
- data/Gemfile +0 -3
- data/Guardfile +0 -15
- data/Rakefile +0 -98
- data/features/generate.feature +0 -17
- data/features/support/env.rb +0 -15
- data/spec/lib/chef_gen/flavor_base_spec.rb +0 -167
- data/spec/lib/chef_gen/flavors_spec.rb +0 -132
- data/spec/lib/chef_gen/snippet/attributes_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/chef_spec_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/cookbook_base_spec.rb +0 -32
- data/spec/lib/chef_gen/snippet/example_file_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/example_template_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/git_init_spec.rb +0 -30
- data/spec/lib/chef_gen/snippet/recipes_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/resource_provider_spec.rb +0 -40
- data/spec/lib/chef_gen/snippet/standard_ignore_spec.rb +0 -35
- data/spec/lib/chef_gen/snippet/style_rubocop_spec.rb +0 -31
- data/spec/lib/chef_gen/snippet/test_kitchen_spec.rb +0 -44
- data/spec/spec_helper.rb +0 -64
- data/spec/support/fixtures/code_generator/metadata.rb +0 -2
- data/spec/support/fixtures/code_generator/recipes/cookbook.rb +0 -1
- data/spec/support/fixtures/code_generator_2/metadata.rb +0 -2
- data/spec/support/fixtures/code_generator_2/recipes/cookbook.rb +0 -3
- data/spec/support/fixtures/code_generator_2/templates/default/README_md.erb +0 -1
- data/spec/support/fixtures/lib/chef_gen/flavor/bar.rb +0 -21
- data/spec/support/fixtures/lib/chef_gen/flavor/baz.rb +0 -6
- data/spec/support/fixtures/lib/chef_gen/flavor/foo.rb +0 -9
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::StandardIgnore
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
RSpec.describe ChefGen::Snippet::StandardIgnore do
|
21
|
-
include ChefDKGeneratorContext
|
22
|
-
include DummyRecipe
|
23
|
-
|
24
|
-
it 'should create a chefignore file' do
|
25
|
-
expect(@recipe).to receive(:file).with(/chefignore$/)
|
26
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
27
|
-
template.generate
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should create a .gitignore file' do
|
31
|
-
expect(@recipe).to receive(:file).with(/\.gitignore$/)
|
32
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
33
|
-
template.generate
|
34
|
-
end
|
35
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::StyleRubocop
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
RSpec.describe ChefGen::Snippet::StyleRubocop do
|
21
|
-
include ChefDKGeneratorContext
|
22
|
-
include DummyRecipe
|
23
|
-
|
24
|
-
%w(.rubocop.yml).each do |fname|
|
25
|
-
it "should add a template for #{fname}" do
|
26
|
-
expect(@recipe).to receive(:template).with(/#{fname}$/)
|
27
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
28
|
-
template.generate
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'chef_gen/flavor_base'
|
2
|
-
require 'chef_gen/snippets'
|
3
|
-
|
4
|
-
module ChefGen
|
5
|
-
module Flavor
|
6
|
-
class Awesome < FlavorBase
|
7
|
-
include ChefGen::Snippet::TestKitchen
|
8
|
-
|
9
|
-
class << self
|
10
|
-
# :nocov:
|
11
|
-
def description
|
12
|
-
'my awesome template'
|
13
|
-
end
|
14
|
-
# :nocov:
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# rubocop:disable Style/RegexpLiteral
|
21
|
-
RSpec.describe ChefGen::Snippet::TestKitchen do
|
22
|
-
include ChefDKGeneratorContext
|
23
|
-
include DummyRecipe
|
24
|
-
|
25
|
-
%w(test test/integration test/integration/default
|
26
|
-
test/integration/default/serverspec
|
27
|
-
test/integration/default/serverspec/recipes).each do |dname|
|
28
|
-
it "should create the directory #{dname}" do
|
29
|
-
expect(@recipe).to receive(:directory).with(%r{#{dname}$})
|
30
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
31
|
-
template.generate
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
%w(.kitchen.yml test/integration/default/serverspec/spec_helper.rb
|
36
|
-
test/integration/default/serverspec/recipes/default_spec.rb)
|
37
|
-
.each do |fname|
|
38
|
-
it "should add a template for #{fname}" do
|
39
|
-
expect(@recipe).to receive(:template).with(%r{#{fname}$})
|
40
|
-
template = ChefGen::Flavor::Awesome.new(@recipe)
|
41
|
-
template.generate
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,64 +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 do
|
11
|
-
add_filter 'spec/support/fixtures'
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
RSpec.configure do |config|
|
16
|
-
config.expect_with :rspec do |expectations|
|
17
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
18
|
-
end
|
19
|
-
|
20
|
-
config.mock_with :rspec do |mocks|
|
21
|
-
mocks.verify_partial_doubles = true
|
22
|
-
end
|
23
|
-
|
24
|
-
config.disable_monkey_patching!
|
25
|
-
config.order = :random
|
26
|
-
Kernel.srand config.seed
|
27
|
-
end
|
28
|
-
|
29
|
-
# LittlePlugger doesn't expect to have its inclusion/exclusion
|
30
|
-
# lists reset in a single process, so we have to monkeypatch
|
31
|
-
# in some testing functionality
|
32
|
-
module LittlePlugger
|
33
|
-
module ClassMethods
|
34
|
-
def clear_plugins
|
35
|
-
@plugin_names = []
|
36
|
-
@disregard_plugin = []
|
37
|
-
@loaded = {}
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
# a shared context that stubs a ChefDK Generator context
|
43
|
-
module ChefDKGeneratorContext
|
44
|
-
extend RSpec::Core::SharedContext
|
45
|
-
|
46
|
-
before do
|
47
|
-
@ctx = double('ChefDK generator context')
|
48
|
-
allow(@ctx).to receive(:cookbook_root).and_return('/nonexistent')
|
49
|
-
allow(@ctx).to receive(:cookbook_name).and_return('foo')
|
50
|
-
allow(@ctx).to receive(:have_git).and_return(true)
|
51
|
-
allow(@ctx).to receive(:skip_git_init).and_return(false)
|
52
|
-
allow(@ctx).to receive(:generator_path=)
|
53
|
-
allow(ChefDK::Generator).to receive(:context).and_return(@ctx)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# a shared context that allows a recipe double to receive unknown methods
|
58
|
-
module DummyRecipe
|
59
|
-
extend RSpec::Core::SharedContext
|
60
|
-
|
61
|
-
before do
|
62
|
-
@recipe = double('Chef recipe').as_null_object
|
63
|
-
end
|
64
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
# [PH]
|
@@ -1 +0,0 @@
|
|
1
|
-
This is a README!
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module ChefGen
|
2
|
-
module Flavor
|
3
|
-
class Bar
|
4
|
-
class << self
|
5
|
-
def description
|
6
|
-
'bar cookbook template'
|
7
|
-
end
|
8
|
-
|
9
|
-
def code_generator_path(classfile)
|
10
|
-
File.expand_path(
|
11
|
-
File.join(
|
12
|
-
classfile,
|
13
|
-
'..', '..', '..', '..',
|
14
|
-
'code_generator_2'
|
15
|
-
)
|
16
|
-
)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|