chef-flavor-flay 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +18 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +10 -0
- data/LICENSE +21 -0
- data/README.md +35 -0
- data/Rakefile +9 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/flay.gemspec +28 -0
- data/lib/chef_gen/flavor/flay.rb +25 -0
- data/shared/flavor/flay/files/default/Berksfile +4 -0
- data/shared/flavor/flay/files/default/Gemfile +6 -0
- data/shared/flavor/flay/files/default/Rakefile +33 -0
- data/shared/flavor/flay/files/default/bundle_config +3 -0
- data/shared/flavor/flay/files/default/chefignore +100 -0
- data/shared/flavor/flay/files/default/encrypted_data_bag_secret +1 -0
- data/shared/flavor/flay/files/default/gitignore +17 -0
- data/shared/flavor/flay/files/default/keys.json +9 -0
- data/shared/flavor/flay/files/default/keys.plaintext.json +7 -0
- data/shared/flavor/flay/files/default/rspec +5 -0
- data/shared/flavor/flay/files/default/rubocop.yml +20 -0
- data/shared/flavor/flay/files/default/serverspec_spec_helper.rb +4 -0
- data/shared/flavor/flay/files/default/spec_helper.rb +11 -0
- data/shared/flavor/flay/files/default/travis.yml +9 -0
- data/shared/flavor/flay/metadata.rb +2 -0
- data/shared/flavor/flay/recipes/cookbook.rb +60 -0
- data/shared/flavor/flay/recipes/recipe.rb +12 -0
- data/shared/flavor/flay/resources/template.rb +24 -0
- data/shared/flavor/flay/templates/default/README.md.erb +3 -0
- data/shared/flavor/flay/templates/default/kitchen.yml.erb +17 -0
- data/shared/flavor/flay/templates/default/metadata.rb.erb +15 -0
- data/shared/flavor/flay/templates/default/recipe.rb.erb +5 -0
- data/shared/flavor/flay/templates/default/recipe_spec.rb.erb +16 -0
- data/shared/flavor/flay/templates/default/serverspec_default_spec.rb.erb +4 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b11b897ae58ee764c0e1cfd790c63363bdb6684
|
4
|
+
data.tar.gz: 2fef60f581f35eea0313e37eddeebc3c0eeed4bb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 662c362a4e70aefabb7cd16f1cb5a45c5055021f91026873abe70d5a915ccf619577de4eb2a04178f33311f08ed329b13bfb64ef6d9d5a9dd864ed437ab86b4e
|
7
|
+
data.tar.gz: c1649da213bd6e125d2b8ab8630a8277df884d43d51fde3a57851a54cdcf1a2806a8c41f5bc3ba5bc71e23a597d0a728106b6338424824272eada9401ad2ae02
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
AllCops:
|
3
|
+
Exclude:
|
4
|
+
- "tmp/**/*"
|
5
|
+
- "vendor/**/*"
|
6
|
+
|
7
|
+
Style/StringLiterals:
|
8
|
+
EnforcedStyle: double_quotes
|
9
|
+
|
10
|
+
Style/Documentation:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Metrics/LineLength:
|
14
|
+
Max: 120
|
15
|
+
|
16
|
+
Metrics/ClassLength:
|
17
|
+
Exclude:
|
18
|
+
- spec/**/*_spec.rb
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.3
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at david.muto@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 pseudomuto
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Flay - cuz Bobbly Flay seems like a pretty good chef
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/sweeperio/flay.svg?branch=master)](https://travis-ci.org/sweeperio/flay)
|
4
|
+
|
5
|
+
This repo is a custom cookbook/recipe template for use with the [ChefDK].
|
6
|
+
|
7
|
+
[ChefDK]: https://downloads.chef.io/chef-dk/
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
* Make sure you've installed the [ChefDK]
|
12
|
+
* Run `chef gem install chef-flavor-flay`
|
13
|
+
|
14
|
+
Add the following to your `~/knife.rb` file:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
if defined?(ChefDK::CLI)
|
18
|
+
require "chef_gen/flavors"
|
19
|
+
chefdk.generator_cookbook = ChefGen::Flavors.path
|
20
|
+
end
|
21
|
+
```
|
22
|
+
|
23
|
+
Celebrate! :rocket:
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
`chef generate cookbook my_cookbook`
|
28
|
+
`chef generate recipe my_recipe`
|
29
|
+
|
30
|
+
You'll be presented with a set of options, choose `flay`
|
31
|
+
|
32
|
+
## License
|
33
|
+
|
34
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
35
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "flay"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/flay.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "chef_gen/flavor/flay"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "chef-flavor-flay"
|
8
|
+
spec.version = ChefGen::Flavor::Flay::VERSION
|
9
|
+
spec.authors = ["pseudomuto"]
|
10
|
+
spec.email = ["developers@sweeper.io"]
|
11
|
+
|
12
|
+
spec.summary = "A Chef cookbook generator using [chef-gen-flavors](https://rubygems.org/gems/chef-gen-flavors)"
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = "https://github.com/sweeperio/flay"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_runtime_dependency "chef-gen-flavors", "~> 0.9"
|
23
|
+
|
24
|
+
spec.post_install_message = <<-EOM
|
25
|
+
Thanks for installing chef-flavor-flay! Be sure to update your knife.rb file
|
26
|
+
as outlined in the README at #{spec.homepage}
|
27
|
+
EOM
|
28
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module ChefGen
|
2
|
+
module Flavor
|
3
|
+
class Flay
|
4
|
+
NAME = "flay".freeze
|
5
|
+
DESC = "Generate a new cookbook with **better** defaults".freeze
|
6
|
+
VERSION = "0.1.0".freeze
|
7
|
+
|
8
|
+
attr_reader :temp_path
|
9
|
+
|
10
|
+
def initialize(temp_path: nil)
|
11
|
+
@temp_path = temp_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_content
|
15
|
+
FileUtils.cp_r(File.expand_path(flavor_cookbook_path) + "/.", temp_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def flavor_cookbook_path
|
21
|
+
File.join(File.dirname(__FILE__), "..", "..", "..", "shared", "flavor", NAME)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "chef"
|
3
|
+
require "rspec/core/rake_task"
|
4
|
+
require "rubocop/rake_task"
|
5
|
+
|
6
|
+
RuboCop::RakeTask.new(:rubocop)
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
task default: [:rubocop, :spec]
|
10
|
+
|
11
|
+
SECRET_FILE = "./test/integration/encrypted_data_bag_secret".freeze
|
12
|
+
INPUT_PATH_FORMAT = "./test/integration/data_bags/%s/%s.plaintext.json".freeze
|
13
|
+
OUTPUT_PATH_FORMAT = "./test/integration/data_bags/%s/%s.json".freeze
|
14
|
+
|
15
|
+
def raw_bag_item(args)
|
16
|
+
path = format(INPUT_PATH_FORMAT, *args.values_at(:bag, :item))
|
17
|
+
hash = JSON.parse(File.read(path))
|
18
|
+
|
19
|
+
Chef::DataBagItem.from_hash(hash)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "encrypts a data bag item for integration tests"
|
23
|
+
task :encrypt_data_bag, [:bag, :item] do |_, args|
|
24
|
+
data_bag_item = raw_bag_item(args)
|
25
|
+
data_bag_secret = Chef::EncryptedDataBagItem.load_secret(SECRET_FILE)
|
26
|
+
encrypted_item = Chef::EncryptedDataBagItem.encrypt_data_bag_item(data_bag_item, data_bag_secret)
|
27
|
+
|
28
|
+
pretty_json = JSON.pretty_generate(encrypted_item.to_hash)
|
29
|
+
output_path = format(OUTPUT_PATH_FORMAT, *args.values_at(:bag, :item))
|
30
|
+
File.open(output_path, "w") { |file| file.write(pretty_json) }
|
31
|
+
|
32
|
+
puts format("encrypted test data bag: %s", output_path)
|
33
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Put files/directories that should be ignored in this file when uploading
|
2
|
+
# or sharing to the community site.
|
3
|
+
# Lines that start with '# ' are comments.
|
4
|
+
|
5
|
+
# OS generated files #
|
6
|
+
######################
|
7
|
+
.DS_Store
|
8
|
+
Icon?
|
9
|
+
nohup.out
|
10
|
+
ehthumbs.db
|
11
|
+
Thumbs.db
|
12
|
+
|
13
|
+
# SASS #
|
14
|
+
########
|
15
|
+
.sass-cache
|
16
|
+
|
17
|
+
# EDITORS #
|
18
|
+
###########
|
19
|
+
\#*
|
20
|
+
.#*
|
21
|
+
*~
|
22
|
+
*.sw[a-z]
|
23
|
+
*.bak
|
24
|
+
REVISION
|
25
|
+
TAGS*
|
26
|
+
tmtags
|
27
|
+
*_flymake.*
|
28
|
+
*_flymake
|
29
|
+
*.tmproj
|
30
|
+
.project
|
31
|
+
.settings
|
32
|
+
mkmf.log
|
33
|
+
|
34
|
+
## COMPILED ##
|
35
|
+
##############
|
36
|
+
a.out
|
37
|
+
*.o
|
38
|
+
*.pyc
|
39
|
+
*.so
|
40
|
+
*.com
|
41
|
+
*.class
|
42
|
+
*.dll
|
43
|
+
*.exe
|
44
|
+
*/rdoc/
|
45
|
+
|
46
|
+
# Testing #
|
47
|
+
###########
|
48
|
+
.watchr
|
49
|
+
.rspec
|
50
|
+
spec/*
|
51
|
+
spec/fixtures/*
|
52
|
+
test/*
|
53
|
+
features/*
|
54
|
+
examples/*
|
55
|
+
Guardfile
|
56
|
+
Procfile
|
57
|
+
.kitchen*
|
58
|
+
.rubocop.yml
|
59
|
+
|
60
|
+
# SCM #
|
61
|
+
#######
|
62
|
+
.git
|
63
|
+
*/.git
|
64
|
+
.gitignore
|
65
|
+
.gitmodules
|
66
|
+
.gitconfig
|
67
|
+
.gitattributes
|
68
|
+
.svn
|
69
|
+
*/.bzr/*
|
70
|
+
*/.hg/*
|
71
|
+
*/.svn/*
|
72
|
+
|
73
|
+
# Berkshelf #
|
74
|
+
#############
|
75
|
+
Berksfile
|
76
|
+
Berksfile.lock
|
77
|
+
cookbooks/*
|
78
|
+
tmp
|
79
|
+
|
80
|
+
# Cookbooks #
|
81
|
+
#############
|
82
|
+
CONTRIBUTING*
|
83
|
+
CHANGELOG*
|
84
|
+
TESTING*
|
85
|
+
|
86
|
+
# Strainer #
|
87
|
+
############
|
88
|
+
Colanderfile
|
89
|
+
Strainerfile
|
90
|
+
.colander
|
91
|
+
.strainer
|
92
|
+
|
93
|
+
# Vagrant #
|
94
|
+
###########
|
95
|
+
.vagrant
|
96
|
+
Vagrantfile
|
97
|
+
|
98
|
+
# Travis #
|
99
|
+
##########
|
100
|
+
.travis.yml
|
@@ -0,0 +1 @@
|
|
1
|
+
bycct9M3oOMZJ0Cjt8MHYSZiP4Xb7CRJJnVy3vzNPnwZYxUt57BRjjU0j7tVLskPDs5WJR8A6gHT1KCWVdx2QykPJgaUOvmNhlcsZZJ4eB/uKB7eTvZz4uyYSwDyyFH/R3vraniObVcPFrlk4xaX5PJfz+fy6df5yvH0LJovljwcyOPL09pDjWYYDwU3Sec4JypPaLAg5nd+RBLBSvDsPKGEiyftticZG9k6fPBhQQYktvV2uvr8ssw/BNzwsGAh2OprgJN+tYySSsZ289H0DF0FwGmPJZjvFzGV930sBoGMWPX0ANxa6Md7A4J0xPmS5GK5iOK0rZJUG6e7R/al2/4RmP5xARBKJs/U1cQnDr1QuUtwywQCt7TE85sSC421r2wjoFCf/qL37lyhPOva/Fma1LOlfW3hsQ1Z+yerrJdE1xS9N3bRdd1nk199VPCCAkUoXPTknzXPqKWqdzpB7U9zgwz/KWrY3npHYWhU/Xws00QkpyUAyyOslgLiemjCEeFSccoGcP1IVMNJvwkTywMYlFpxM2C1kxxklzqj+LW24hdvSMHHkp0Pv0jIZTnDC/3QywWKdAt4BQmmN4bZLXNNzORgJLpRGW59lJXhq9DJ3HOUXOLMEgF5MCcvAw/f0dE9E0atiIMwXecxzmGRG7KD3QzmQjJeQI5SIq+Fm1k=
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
AllCops:
|
3
|
+
Exclude:
|
4
|
+
- "vendor/**/*"
|
5
|
+
|
6
|
+
Style/StringLiterals:
|
7
|
+
EnforcedStyle: double_quotes
|
8
|
+
|
9
|
+
Style/ClassAndModuleChildren:
|
10
|
+
EnforcedStyle: compact
|
11
|
+
|
12
|
+
Style/Documentation:
|
13
|
+
Enabled: false
|
14
|
+
|
15
|
+
Metrics/LineLength:
|
16
|
+
Max: 120
|
17
|
+
|
18
|
+
Metrics/ClassLength:
|
19
|
+
Exclude:
|
20
|
+
- test/**/*_test.rb
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "chefspec"
|
2
|
+
require "chefspec/berkshelf"
|
3
|
+
|
4
|
+
Dir["./libraries/**/*.rb"].each { |f| require f }
|
5
|
+
Dir["./test/unit/support/**/*.rb"].each { |f| require f }
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.log_level = :fatal
|
9
|
+
config.platform = "ubuntu"
|
10
|
+
config.version = "14.04"
|
11
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
context = ChefDK::Generator.context
|
2
|
+
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
3
|
+
|
4
|
+
# Common Cookbook Things
|
5
|
+
directory cookbook_dir
|
6
|
+
directory "#{cookbook_dir}/.bundle"
|
7
|
+
directory "#{cookbook_dir}/recipes"
|
8
|
+
|
9
|
+
cookbook_file("#{cookbook_dir}/.gitignore") { source "gitignore" }
|
10
|
+
cookbook_file("#{cookbook_dir}/.rubocop.yml") { source "rubocop.yml" }
|
11
|
+
cookbook_file("#{cookbook_dir}/Berksfile") { action :create_if_missing }
|
12
|
+
cookbook_file("#{cookbook_dir}/.bundle/config") { source "bundle_config" }
|
13
|
+
cookbook_file "#{cookbook_dir}/chefignore"
|
14
|
+
cookbook_file "#{cookbook_dir}/Gemfile"
|
15
|
+
cookbook_file "#{cookbook_dir}/Rakefile"
|
16
|
+
|
17
|
+
flay_template "#{cookbook_dir}/metadata.rb"
|
18
|
+
flay_template "#{cookbook_dir}/README.md"
|
19
|
+
|
20
|
+
# ChefSpec
|
21
|
+
directory("#{cookbook_dir}/test/unit/recipes") { recursive true }
|
22
|
+
|
23
|
+
cookbook_file("#{cookbook_dir}/.rspec") { source "rspec" }
|
24
|
+
cookbook_file("#{cookbook_dir}/.travis.yml") { source "travis.yml" }
|
25
|
+
|
26
|
+
flay_template("#{cookbook_dir}/recipes/default.rb") { source "recipe.rb.erb" }
|
27
|
+
flay_template("#{cookbook_dir}/test/unit/recipes/default_spec.rb") { source "recipe_spec.rb.erb" }
|
28
|
+
|
29
|
+
# Test Kitchen
|
30
|
+
directory("#{cookbook_dir}/test/integration/data_bags/ejson") { recursive true }
|
31
|
+
directory("#{cookbook_dir}/test/integration/default/serverspec") { recursive true }
|
32
|
+
directory("#{cookbook_dir}/test/integration/helpers/serverspec") { recursive true }
|
33
|
+
|
34
|
+
cookbook_file("#{cookbook_dir}/test/integration/encrypted_data_bag_secret") { source "encrypted_data_bag_secret" }
|
35
|
+
cookbook_file("#{cookbook_dir}/test/integration/data_bags/ejson/keys.json") { source "keys.json" }
|
36
|
+
cookbook_file("#{cookbook_dir}/test/integration/data_bags/ejson/keys.plaintext.json") { source "keys.plaintext.json" }
|
37
|
+
|
38
|
+
cookbook_file "#{cookbook_dir}/test/integration/helpers/serverspec/spec_helper.rb" do
|
39
|
+
source "serverspec_spec_helper.rb"
|
40
|
+
action :create_if_missing
|
41
|
+
end
|
42
|
+
|
43
|
+
cookbook_file "#{cookbook_dir}/test/unit/spec_helper.rb" do
|
44
|
+
source "spec_helper.rb"
|
45
|
+
action :create_if_missing
|
46
|
+
end
|
47
|
+
|
48
|
+
flay_template("#{cookbook_dir}/.kitchen.yml") { source "kitchen.yml.erb" }
|
49
|
+
|
50
|
+
flay_template "#{cookbook_dir}/test/integration/default/serverspec/default_spec.rb" do
|
51
|
+
source "serverspec_default_spec.rb.erb"
|
52
|
+
end
|
53
|
+
|
54
|
+
# git
|
55
|
+
if context.have_git && !context.skip_git_init
|
56
|
+
execute("initialize-git") do
|
57
|
+
command("git init .")
|
58
|
+
cwd cookbook_dir
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
context = ChefDK::Generator.context
|
2
|
+
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
3
|
+
recipe_path = File.join(cookbook_dir, "recipes", "#{context.new_file_basename}.rb")
|
4
|
+
spec_helper_path = File.join(cookbook_dir, "test", "unit", "spec_helper.rb")
|
5
|
+
spec_path = File.join(cookbook_dir, "test", "unit", "recipes", "#{context.new_file_basename}_spec.rb")
|
6
|
+
|
7
|
+
directory("#{cookbook_dir}/test/unit/recipes") { recursive true }
|
8
|
+
|
9
|
+
cookbook_file(spec_helper_path) { action :create_if_missing }
|
10
|
+
|
11
|
+
flay_template(recipe_path) { source "recipe.rb.erb" }
|
12
|
+
flay_template(spec_path) { source "recipe_spec.rb.erb" }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
default_action :create_if_missing
|
2
|
+
|
3
|
+
property :name, String, name_property: true
|
4
|
+
property :source, String
|
5
|
+
property :use_helpers, [TrueClass, FalseClass], default: true
|
6
|
+
|
7
|
+
action :create do
|
8
|
+
template new_resource.name do
|
9
|
+
source new_resource.source
|
10
|
+
helpers new_resource.helpers
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
action :create_if_missing do
|
15
|
+
template new_resource.name do
|
16
|
+
source new_resource.source
|
17
|
+
helpers new_resource.helpers
|
18
|
+
action :create_if_missing
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def helpers
|
23
|
+
use_helpers ? ChefDK::Generator::TemplateHelper : []
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
driver:
|
3
|
+
name: vagrant
|
4
|
+
|
5
|
+
provisioner:
|
6
|
+
name: chef_zero
|
7
|
+
data_bags_path: test/integration/data_bags
|
8
|
+
encrypted_data_bag_secret_key_path: test/integration/encrypted_data_bag_secret
|
9
|
+
|
10
|
+
platforms:
|
11
|
+
- name: ubuntu-14.04
|
12
|
+
|
13
|
+
suites:
|
14
|
+
- name: default
|
15
|
+
run_list:
|
16
|
+
- recipe[<%= cookbook_name %>]
|
17
|
+
attributes:
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# rubocop:disable Style/SingleSpaceBeforeFirstArg
|
2
|
+
name "<%= cookbook_name %>"
|
3
|
+
maintainer "<%= copyright_holder %>"
|
4
|
+
maintainer_email "<%= email %>"
|
5
|
+
license "<%= license %>"
|
6
|
+
description "Installs/Configures <%= cookbook_name %>"
|
7
|
+
long_description "Installs/Configures <%= cookbook_name %>"
|
8
|
+
version "0.1.0"
|
9
|
+
# rubocop:enable Style/SingleSpaceBeforeFirstArg
|
10
|
+
|
11
|
+
supports "ubuntu"
|
12
|
+
|
13
|
+
chef_version ">= 12.5" if respond_to?(:chef_version)
|
14
|
+
source_url "YOUR SOURCE REPO URL" if respond_to?(:source_url)
|
15
|
+
issues_url "WHERE TO LOG ISSUES" if respond_to?(:issues_url)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: <%= cookbook_name %>
|
3
|
+
# Spec:: <%= recipe_name %>
|
4
|
+
#
|
5
|
+
<%= license_description("#") %>
|
6
|
+
|
7
|
+
describe "<%= cookbook_name %>::<%= recipe_name %>" do
|
8
|
+
cached(:chef_run) do
|
9
|
+
runner = ChefSpec::SoloRunner.new
|
10
|
+
runner.converge(described_recipe)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "converges successfully" do
|
14
|
+
expect { chef_run }.to_not raise_error
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chef-flavor-flay
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- pseudomuto
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: chef-gen-flavors
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
description: A Chef cookbook generator using [chef-gen-flavors](https://rubygems.org/gems/chef-gen-flavors)
|
28
|
+
email:
|
29
|
+
- developers@sweeper.io
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- ".ruby-version"
|
37
|
+
- ".travis.yml"
|
38
|
+
- CODE_OF_CONDUCT.md
|
39
|
+
- Gemfile
|
40
|
+
- LICENSE
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- bin/console
|
44
|
+
- bin/setup
|
45
|
+
- flay.gemspec
|
46
|
+
- lib/chef_gen/flavor/flay.rb
|
47
|
+
- shared/flavor/flay/files/default/Berksfile
|
48
|
+
- shared/flavor/flay/files/default/Gemfile
|
49
|
+
- shared/flavor/flay/files/default/Rakefile
|
50
|
+
- shared/flavor/flay/files/default/bundle_config
|
51
|
+
- shared/flavor/flay/files/default/chefignore
|
52
|
+
- shared/flavor/flay/files/default/encrypted_data_bag_secret
|
53
|
+
- shared/flavor/flay/files/default/gitignore
|
54
|
+
- shared/flavor/flay/files/default/keys.json
|
55
|
+
- shared/flavor/flay/files/default/keys.plaintext.json
|
56
|
+
- shared/flavor/flay/files/default/rspec
|
57
|
+
- shared/flavor/flay/files/default/rubocop.yml
|
58
|
+
- shared/flavor/flay/files/default/serverspec_spec_helper.rb
|
59
|
+
- shared/flavor/flay/files/default/spec_helper.rb
|
60
|
+
- shared/flavor/flay/files/default/travis.yml
|
61
|
+
- shared/flavor/flay/metadata.rb
|
62
|
+
- shared/flavor/flay/recipes/cookbook.rb
|
63
|
+
- shared/flavor/flay/recipes/recipe.rb
|
64
|
+
- shared/flavor/flay/resources/template.rb
|
65
|
+
- shared/flavor/flay/templates/default/README.md.erb
|
66
|
+
- shared/flavor/flay/templates/default/kitchen.yml.erb
|
67
|
+
- shared/flavor/flay/templates/default/metadata.rb.erb
|
68
|
+
- shared/flavor/flay/templates/default/recipe.rb.erb
|
69
|
+
- shared/flavor/flay/templates/default/recipe_spec.rb.erb
|
70
|
+
- shared/flavor/flay/templates/default/serverspec_default_spec.rb.erb
|
71
|
+
homepage: https://github.com/sweeperio/flay
|
72
|
+
licenses:
|
73
|
+
- MIT
|
74
|
+
metadata: {}
|
75
|
+
post_install_message: |2
|
76
|
+
Thanks for installing chef-flavor-flay! Be sure to update your knife.rb file
|
77
|
+
as outlined in the README at https://github.com/sweeperio/flay
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5.1
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: A Chef cookbook generator using [chef-gen-flavors](https://rubygems.org/gems/chef-gen-flavors)
|
97
|
+
test_files: []
|